/*

  OpenLayers.js -- OpenLayers Map Viewer Library

  Copyright 2005-2007 MetaCarta, Inc., released under the BSD license.
  Please see http://svn.openlayers.org/trunk/openlayers/release-license.txt
  for the full text of the license.

  Includes compressed code under the following licenses:

  (For uncompressed versions of the code used please see the
  OpenLayers SVN repository: <http://openlayers.org/>)

*/

/* Contains portions of Prototype.js:
 *
 * Prototype JavaScript framework, version 1.4.0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/

/**  
*  
*  Contains portions of Rico <http://openrico.org/>
* 
*  Copyright 2005 Sabre Airline Solutions  
*  
*  Licensed under the Apache License, Version 2.0 (the "License"); you
*  may not use this file except in compliance with the License. You
*  may obtain a copy of the License at
*  
*         http://www.apache.org/licenses/LICENSE-2.0  
*  
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
*  implied. See the License for the specific language governing
*  permissions and limitations under the License. 
*
**/

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();String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+0.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+0.5;},pulse:function(pos,pulses){pulses=pulses||5;return(((pos%(1/pulses))*pulses).round()==0?((pos*pulses*2)-(pos*pulses*2).floor()):1-((pos*pulses*2)-(pos*pulses*2).floor()));},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;eval('this.render = function(pos){ '+'if (this.state=="idle"){this.state="running";'+
codeForEvent(this.options,'beforeSetup')+
(this.setup?'this.setup();':'')+
codeForEvent(this.options,'afterSetup')+'};if (this.state=="running"){'+'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+'this.position=pos;'+
codeForEvent(this.options,'beforeUpdate')+
(this.update?'this.update(pos);':'')+
codeForEvent(this.options,'afterUpdate')+'}}');this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset(),max=(window.height||document.body.scrollHeight)-document.viewport.getHeight();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1]>max?max:elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round())});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element)},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}})}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}})}})}})}})}})}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options))}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{};var oldOpacity=element.getInlineOpacity();var transition=options.transition||Effect.Transitions.sinoidal;var reverser=function(pos){return transition(1-Effect.Transitions.pulse(pos,options.pulses))};reverser.bind(transition);return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});}}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16)});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))))});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(hash,property){hash.set(property,css[property]);return hash;});if(!styles.opacity)styles.set('opacity',element.getOpacity());return styles;};};Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element)
var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;}});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={}
Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element)
this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
this.setOptions(options);else
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keypress',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(Prototype.Browser.WebKit)Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(Prototype.Browser.WebKit)Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--
else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index<this.entryCount-1)this.index++
else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;entry=myKaMap.interact.noaccent(entry);for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];elem2=myKaMap.interact.noaccent(elem);var foundPos=instance.options.ignoreCase?elem2.toLowerCase().indexOf(entry.toLowerCase()):elem2.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))
return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);}
Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
this.options.formId='';}
if(this.options.externalControl)
this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_'+mode+'_link';if(extraClasses)
link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
fld.name=this.options.paramName;fld.value=text;fld.className='editor_field';if(this.options.submitOnBlur)
fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML;},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
params=params.toQueryParams();params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
text=text.stripTags();this._controls.editor.value=text;this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
$(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
this.element.observe(pair.key,listener);if(this.options.externalControl)
this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
this.loadCollection();else
this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
throw'Server returned an invalid collection representation.';this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
this.loadExternalText();else
this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});var kaCurrentTool=null;function kaTool(oKaMap){this.kaMap=oKaMap;this.name='kaTool';this.bInfoTool=false;this.wheelPlus=new Array(oKaMap,oKaMap.zoomOut,null);this.wheelMinus=new Array(oKaMap,oKaMap.zoomIn,null);this.kaMap.registerTool(this);};kaTool.prototype.isInfoTool=function(){return this.bInfoTool;};kaTool.prototype.activate=function(){this.kaMap.activateTool(this);document.kaCurrentTool=this;};kaTool.prototype.deactivate=function(){this.kaMap.deactivateTool(this);document.kaCurrentTool=null;};kaTool.prototype.onmousemove=function(e){return false;};kaTool.prototype.onmousedown=function(e){return false;};kaTool.prototype.onmouseup=function(e){return false;};kaTool.prototype.ondblclick=function(e){return false;};kaTool.prototype.setMouseWheel=function(minusSet,plusSet){this.wheelMinus=minusSet;this.wheelPlus=plusSet;};kaTool.prototype.onmousewheel=function(e){e=(e)?e:((event)?event:null);var wheelDelta=e.wheelDelta?e.wheelDelta:e.detail*-1;var wheelSet=null;if(wheelDelta>0)
wheelSet=this.wheelMinus;else
wheelSet=this.wheelPlus;if(wheelSet){obj=(wheelSet[0])?wheelSet[0]:null;func=(wheelSet[1])?wheelSet[1]:null;args=(wheelSet[2])?wheelSet[2]:null;if(func){if(args){func.apply(obj,args);}else{func.apply(obj);}}}};kaTool.prototype.adjustPixPosition=function(x,y){var obj=this.kaMap.domObj;var offsetLeft=0;var offsetTop=0;while(obj){offsetLeft+=parseInt(obj.offsetLeft);offsetTop+=parseInt(obj.offsetTop);obj=obj.offsetParent;}
var pX=parseInt(this.kaMap.theInsideLayer.style.left)+
offsetLeft-this.kaMap.xOrigin-x;var pY=parseInt(this.kaMap.theInsideLayer.style.top)+
offsetTop-this.kaMap.yOrigin-y;return[pX,pY];};function kaTool_redirect_onkeypress(e){if(document.kaCurrentTool){document.kaCurrentTool.onkeypress(e);}};kaTool.prototype.onkeypress=function(e){e=(e)?e:((event)?event:null);if(e){var charCode=(e.charCode)?e.charCode:e.keyCode;var b=true;var nStep=16;switch(charCode){case 38:this.kaMap.moveBy(0,nStep);this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.getGeoExtents());break;case 40:this.kaMap.moveBy(0,-nStep);this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.getGeoExtents());break;case 37:this.kaMap.moveBy(nStep,0);this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.getGeoExtents());break;case 39:this.kaMap.moveBy(-nStep,0);this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.getGeoExtents());break;case 33:this.kaMap.slideBy(0,this.kaMap.viewportHeight/2);break;case 34:this.kaMap.slideBy(0,-this.kaMap.viewportHeight/2);break;case 36:this.kaMap.slideBy(this.kaMap.viewportWidth/2,0);break;case 35:this.kaMap.slideBy(-this.kaMap.viewportWidth/2,0);break;case 43:case 61:this.kaMap.zoomIn();break;case 45:this.kaMap.zoomOut();break;default:b=false;}
if(b){return this.cancelEvent(e);}
return true;}};kaTool.prototype.onmouseover=function(e){return false;};kaTool.prototype.onmouseout=function(e){if(this.kaMap.isIE4){document.onkeydown=null;}
document.onkeypress=null;return false;};kaTool.prototype.cancelEvent=function(e){e=(e)?e:((event)?event:null);e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation){e.stopPropogation();}
if(e.preventDefault){e.preventDefault();}
return false;};function kaNavigator(oKaMap){kaTool.apply(this,[oKaMap]);this.name='kaNavigator';this.cursorNormal=["url('/images/grab.cur'),move",'-moz-grab','grab','move'];this.cursorDrag=["url('/images/grabbing.cur'),move",'-moz-grabbing','grabbing','move'];this.cursor=this.cursorNormal;this.activeImage=this.kaMap.server+'/images/button_pan_3.png';this.disabledImage=this.kaMap.server+'/images/button_pan_2.png';this.lastx=null;this.lasty=null;this.bMouseDown=false;for(var p in kaTool.prototype){if(!kaNavigator.prototype[p])
kaNavigator.prototype[p]=kaTool.prototype[p];}};kaNavigator.prototype.onmouseout=function(e){e=(e)?e:((event)?event:null);if(!e.target)e.target=e.srcElement;if(e.target.id==this.kaMap.domObj.id){this.bMouseDown=false;try{return kaTool.prototype.onmouseout.apply(this,[e]);}
catch(e){}}};kaNavigator.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);if(!this.bMouseDown){return false;}
if(!this.kaMap.layersHidden){this.kaMap.hideLayers();}
var newTop=safeParseInt(this.kaMap.theInsideLayer.style.top);var newLeft=safeParseInt(this.kaMap.theInsideLayer.style.left);var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));newTop=newTop-this.lasty+y;newLeft=newLeft-this.lastx+x;this.kaMap.theInsideLayer.style.top=newTop+'px';this.kaMap.theInsideLayer.style.left=newLeft+'px';this.kaMap.checkWrap.apply(this.kaMap,[]);this.lastx=x;this.lasty=y;return false;};kaNavigator.prototype.onmousedown=function(e){e=(e)?e:((event)?event:null);if(e.button==2){return this.cancelEvent(e);}else{this.cursor=this.cursorDrag;this.kaMap.setCursor(this.cursorDrag);if(this.kaMap.isIE4){document.onkeydown=kaTool_redirect_onkeypress;}
document.onkeypress=kaTool_redirect_onkeypress;this.bMouseDown=true;var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));this.lastx=x;this.lasty=y;this.startx=this.lastx;this.starty=this.lasty;e.cancelBubble=true;e.returnValue=false;if(e.stopPropogation)e.stopPropogation();if(e.preventDefault)e.preventDefault();return false;}};var gDblClickTimer=null;kaNavigator.prototype.onmouseup=function(e){this.cursor=this.cursorNormal;this.kaMap.setCursor(this.cursorNormal);e=(e)?e:((event)?event:null);this.bMouseDown=false;var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));if(Math.abs(x-this.startx)<2&&Math.abs(y-this.starty)<2){if(!gDblClickTimer){gDblClickTimer=window.setTimeout(bind(this.dispatchMapClicked,this,x,y),250);}}else{gDblClickTimer=null;this.kaMap.showLayers();this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.getGeoExtents());}
return false;};kaNavigator.prototype.dispatchMapClicked=function(px,py){var a=this.adjustPixPosition(px,py);var p=this.kaMap.pixToGeo(a[0],a[1]);gDblClickTimer=null;this.kaMap.triggerEvent(KAMAP_MAP_CLICKED,p);};kaNavigator.prototype.ondblclick=function(e){if(gDblClickTimer){window.clearTimeout(gDblClickTimer);gDblClickTimer=null;}
e=(e)?e:((event)?event:null);var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));var a=this.adjustPixPosition(x,y);var p=this.kaMap.pixToGeo(a[0],a[1]);this.kaMap.zoomTo(p[0],p[1]);};function bind(m,o){var __method=arguments[0];var __object=arguments[1];var args=[];for(var i=2;i<arguments.length;i++){args.push(arguments[i])}
return function(){return __method.apply(__object,args);}}
function progZoomer(oKaMap){this.kaMap=oKaMap;this.isDragging=false;this.kaMap.progZoomer=this;this.kaMap.registerForEvent(KAMAP_MAP_INITIALIZED,this,this.draw);};progZoomer.prototype.draw=function(){var t=this;this.domObj=document.createElement("div");this.domObj.id="progZoomer";this.kaMap.domObj.appendChild(this.domObj);this.domObj.onmouseover=function(){t.setOpacityOfController(1)};this.domObj.onmouseout=function(){t.setOpacityOfController(0.8)};var table=document.createElement("table");table.id="progZoomer_tableText";this.domObj.appendChild(table);table.cellSpacing="0";table.style.borderSpacing="0px";var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="td1";td.innerHTML="Zoom";var table=document.createElement("table");this.domObj.appendChild(table);table.id="progZoomer_table";table.cellSpacing="0";table.style.borderSpacing="0px";var tBody=document.createElement("tbody");table.appendChild(tBody);var tr=document.createElement("tr");tBody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);var imageMINUS=document.createElement("img");td.appendChild(imageMINUS);imageMINUS.className="progZoomer_imgPLUSMINUS";imageMINUS.src="/OPO/tools/progZoomer/images/MINUS.gif";imageMINUS.onclick=function(){t.kaMap.zoomOut()};var td=document.createElement("td");tr.appendChild(td);td.className="progZoomer_td_support";this.support=document.createElement("div");td.appendChild(this.support);this.support.id="progZoomer_support";this.support.style.position="relative";this.support.style.overflow="visible";this.support.onclick=function(e){t.handleSupportClick(e)};this.slider=document.createElement("div");this.support.appendChild(this.slider);this.slider.id="progZoomer_slider";this.slider.style.position="absolute";var td=document.createElement("td");tr.appendChild(td);var imagePLUS=document.createElement("img");td.appendChild(imagePLUS);imagePLUS.src="/OPO/tools/progZoomer/images/PLUS.gif";imagePLUS.className="progZoomer_imgPLUSMINUS";imagePLUS.onclick=function(){t.kaMap.zoomIn()};var oMap=this.kaMap.getCurrentMap();var nScales=oMap.getScales().length;var currentScale=oMap.currentScale;this.supportWidth=this.kaMap.getObjectWidth(this.support);this.supportHeight=this.kaMap.getObjectHeight(this.support);this.sliderWidth=this.kaMap.getObjectWidth(this.slider);this.sliderHeight=this.kaMap.getObjectHeight(this.slider);this.vertSliderPos=-(Math.round((this.sliderHeight-this.supportHeight)/2));this.slider.style.display="inline";this.slider.style.top=this.vertSliderPos+"px";this.slider.style.left="0px";Drag.init(this.slider,null,0,this.supportWidth-this.sliderWidth,this.vertSliderPos,this.vertSliderPos);this.slider.onDragStart=function(){t.isDragging=true};this.slider.onDragEnd=function(){t.findScale();t.isDragging=false;t.setOpacityOfController(0.8)};this.kaMap.registerForEvent(KAMAP_SCALE_CHANGED,this,this.update);};progZoomer.prototype.setOpacityOfController=function(amount){if(!this.isDragging){this.domObj.style.opacity=amount;this.domObj.style.mozOpacity=amount;this.domObj.style.filter="Alpha(opacity="+(amount*100)+")";}};progZoomer.prototype.findScale=function(){var sliderPosition=this.slider.offsetLeft;var nbScales=this.kaMap.getCurrentMap().getScales().length;var nearestScale=Math.round((sliderPosition/(this.supportWidth-this.sliderWidth))*(nbScales-1));if(nearestScale>nbScales-1){nearestScale=nbScales-1;}
this.adjustSliderOnScale(nearestScale);this.kaMap.zoomToScale(this.kaMap.getCurrentMap().aScales[nearestScale]);};progZoomer.prototype.adjustSliderOnScale=function(scale){var nbScales=this.kaMap.getCurrentMap().getScales().length;var moveX=scale*Math.round(((this.supportWidth-this.sliderWidth)/(nbScales-1)));if(scale==(nbScales-1)){moveX=this.supportWidth-this.sliderWidth;}
this.slider.style.left=moveX+"px";};progZoomer.prototype.update=function(){var currentScale=this.kaMap.getCurrentScale();var allScales=this.kaMap.getCurrentMap().getScales();for(var i=0;i<allScales.length;i++){if(allScales[i]==currentScale)
var currentScaleNb=i;}
this.adjustSliderOnScale(currentScaleNb);};progZoomer.prototype.handleSupportClick=function(e){e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);if(src.id=="progZoomer_support"){var relPos=(typeof(e.offsetX)!="undefined")?(e.offsetX):((typeof(e.layerX)!="undefined")?(e.layerX):null);if(relPos>this.supportWidth-this.sliderWidth)
relPos=this.supportWidth-this.sliderWidth;this.slider.style.left=relPos+"px";this.findScale();}};var gnLastEventId=0;var KAMAP_ERROR=gnLastEventId++;var KAMAP_WARNING=gnLastEventId++;var KAMAP_NOTICE=gnLastEventId++;var KAMAP_INITIALIZED=gnLastEventId++;var KAMAP_MAP_INITIALIZED=gnLastEventId++;var KAMAP_EXTENTS_CHANGED=gnLastEventId++;var KAMAP_SCALE_CHANGED=gnLastEventId++;var KAMAP_LAYERS_CHANGED=gnLastEventId++;var KAMAP_LAYER_STATUS_CHANGED=gnLastEventId++;var KAMAP_CONTEXT_MENU=gnLastEventId++;var KAMAP_METAEXTENTS_CHANGED=gnLastEventId++;var KAMAP_MAP_CLICKED=gnLastEventId++;function safeParseInt(val){return Math.round(parseFloat(val));};function kaMap(szID){this.isCSS=false;this.isW3C=false;this.isIE4=false;this.isNN4=false;this.isIE6CSS=false;if(document.images){this.isCSS=(document.body&&document.body.style)?true:false;this.isW3C=(this.isCSS&&document.getElementById)?true:false;this.isIE4=(this.isCSS&&document.all)?true:false;this.isNN4=(document.layers)?true:false;this.isIE6CSS=(document.compatMode&&document.compatMode.indexOf("CSS1")>=0)?true:false;}
this.domObj=this.getRawObject(szID);this.domObj.style.overflow='hidden';this.hideLayersOnMove=false;this.loadUnchecked=false;this.initializationState=0;this.bMouseDown=false;this.lastx=0;this.lasty=0;this.theInsideLayer=null;this.viewportWidth=this.getObjectWidth(this.domObj);this.viewportHeight=this.getObjectHeight(this.domObj);this.xOffset=0;this.yOffset=0;this.xOrigin=0;this.yOrigin=0;this.currentMap='';this.nWide=0;this.nHigh=0;this.nCurrentTop=0;this.nCurrentLeft=0;this.aPixel=new Image(1,1);this.aPixel.src='/images/a_pixel.gif';this.imgErrors=new Array();this.aMaps=new Array();this.tileWidth=null;this.tileHeight=null;this.nBuffer=1;this.baseURL='';this.cellSize=null;this.gImageID=0;this.eventManager=new _eventManager();this.as=slideid=null;this.accelerationFactor=1;this.pixelsPerStep=30;this.timePerStep=25;this.server="http://kamap.swissgeo.ch/";this.cache_server=new Array();this.cache_server[0]="mc1.swissgeo.ch";this.cache_server[1]="mc2.swissgeo.ch";this.cache_server[2]="mc3.swissgeo.ch";this.cache_server[3]="mc4.swissgeo.ch";this.cacheIDX=0;this.init="../init.php";this.tileURL=null;this.aObjects=[];this.aCanvases=[];this.layersHidden=false;this.aTools=[];this.aInfoTools=[];for(var i=0;i<gnLastEventId;i++){this.registerEventID(i);}
this.createLayers();};kaMap.prototype.seekLayer=function(doc,name){var theObj;for(var i=0;i<doc.layers.length;i++){if(doc.layers[i].name==name){theObj=doc.layers[i];break;}
if(doc.layers[i].document.layers.length>0){theObj=this.seekLayer(document.layers[i].document,name);}}
return theObj;};kaMap.prototype.getRawObject=function(obj){var theObj;if(typeof obj=="string"){if(this.isW3C){theObj=document.getElementById(obj);}else if(this.isIE4){theObj=document.all(obj);}else if(this.isNN4){theObj=seekLayer(document,obj);}}else{theObj=obj;}
return theObj;};kaMap.prototype.getObject=function(obj){var theObj=this.getRawObject(obj);if(theObj&&this.isCSS){theObj=theObj.style;}
return theObj;};kaMap.prototype.getObjectWidth=function(obj){var elem=this.getRawObject(obj);var result=0;if(elem.offsetWidth){result=elem.offsetWidth;}else if(elem.clip&&elem.clip.width){result=elem.clip.width;}else if(elem.style&&elem.style.pixelWidth){result=elem.style.pixelWidth;}
return parseInt(result);};kaMap.prototype.getObjectHeight=function(obj){var elem=this.getRawObject(obj);var result=0;if(elem.offsetHeight){result=elem.offsetHeight;}else if(elem.clip&&elem.clip.height){result=elem.clip.height;}else if(elem.style&&elem.style.pixelHeight){result=elem.style.pixelHeight;}
return parseInt(result);};kaMap.prototype.zoomTo=function(cgX,cgY){var oMap=this.getCurrentMap();var inchesPerUnit=new Array(1,12,63360.0,39.3701,39370.1,4374754);var newScale;var bScaleChanged=false;if(arguments.length==3){newScale=arguments[2];bScaleChanged=(newScale!=this.getCurrentScale())}else{newScale=this.getCurrentScale();}
var bZoomTo=true;if(!bScaleChanged){var extents=this.getGeoExtents();if(cgX>=extents[0]&&cgX<=extents[2]&&cgY>=extents[1]&&cgY<=extents[3]){var cx=(extents[0]+extents[2])/2;var cy=(extents[1]+extents[3])/2;var dx=(cx-cgX)/this.cellSize;var dy=(cgY-cy)/this.cellSize;this.slideBy(dx,dy);bZoomTo=false;}}
if(bZoomTo){this.cellSize=newScale/(oMap.resolution*inchesPerUnit[oMap.units]);var nFactor=oMap.zoomToScale(newScale);this.setMapLayers();var cpX=cgX/this.cellSize;var cpY=cgY/this.cellSize;var vpLeft=Math.round(cpX-this.viewportWidth/2);var vpTop=Math.round(cpY+this.viewportHeight/2);var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth;var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight;var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=cTileX-nTilesLeft;this.nCurrentTop=-1*(cTileY+nTilesUp);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(vpLeft-this.xOrigin)+"px";this.theInsideLayer.style.top=(vpTop+this.yOrigin)+"px";var layers=oMap.getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.tileLoadingImg.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}
this.checkWrap();this.updateObjects();}
if(bScaleChanged){this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale());}
this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());};kaMap.prototype.zoomToExtents=function(minx,miny,maxx,maxy){var inchesPerUnit=new Array(1,12,63360.0,39.3701,39370.1,4374754);var oMap=this.getCurrentMap();var cgX=(maxx+minx)/2;var cgY=(maxy+miny)/2;var tmpCellSizeX=(maxx-minx)/this.viewportWidth;var tmpCellSizeY=(maxy-miny)/this.viewportHeight;var tmpCellSize=Math.max(tmpCellSizeX,tmpCellSizeY);var tmpScale=tmpCellSize*oMap.resolution*inchesPerUnit[oMap.units];var newScale=oMap.aScales[0];for(var i=1;i<oMap.aScales.length;i++){if(tmpScale>=oMap.aScales[i]){break;}
newScale=oMap.aScales[i];}
this.cellSize=newScale/(oMap.resolution*inchesPerUnit[oMap.units]);var nFactor=oMap.zoomToScale(newScale);this.setMapLayers();var cpX=cgX/this.cellSize;var cpY=cgY/this.cellSize;var vpLeft=Math.round(cpX-this.viewportWidth/2);var vpTop=Math.round(cpY+this.viewportHeight/2);var cTileX=Math.floor(cpX/this.tileWidth)*this.tileWidth;var cTileY=Math.floor(cpY/this.tileHeight)*this.tileHeight;var nTilesLeft=Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth;var nTilesUp=Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight;this.nCurrentLeft=cTileX-nTilesLeft;this.nCurrentTop=-1*(cTileY+nTilesUp);this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=-1*(vpLeft-this.xOrigin)+"px";this.theInsideLayer.style.top=(vpTop+this.yOrigin)+"px";var layers=oMap.getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.tileLoadingImg.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}
this.checkWrap();this.updateObjects();this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());};kaMap.prototype.createDrawingCanvas=function(idx){var d=document.createElement('div');d.style.position='absolute';d.style.left='0px';d.style.top='0px';d.style.width='3000px';d.style.height='3000px';d.style.zIndex=idx;this.theInsideLayer.appendChild(d);this.aCanvases.push(d);d.kaMap=this;return d;};kaMap.prototype.removeDrawingCanvas=function(canvas){for(var i=0;i<this.aCanvases.length;i++){if(this.aCanvases[i]==canvas){this.aCanvases.splice(i,1);}}
this.theInsideLayer.removeChild(canvas);canvas.kaMap=null;return true;};kaMap.prototype.addObjectGeo=function(canvas,lon,lat,obj){obj.lon=lon;obj.lat=lat;var aPix=this.geoToPix(lon,lat);return this.addObjectPix(canvas,aPix[0],aPix[1],obj);};kaMap.prototype.addObjectPix=function(canvas,x,y,obj){var xOffset=(obj.xOffset)?obj.xOffset:0;var yOffset=(obj.yOffset)?obj.yOffset:0;var top=(y-this.yOrigin+yOffset);var left=(x-this.xOrigin+xOffset);obj.style.position='absolute';obj.style.top=top+"px";obj.style.left=left+"px";obj.canvas=canvas;canvas.appendChild(obj);this.aObjects.push(obj);return true;};kaMap.prototype.shiftObject=function(x,y,obj){var top=safeParseInt(obj.style.top);var left=safeParseInt(obj.style.left);obj.style.top=(top+y)+"px";obj.style.left=(left+x)+"px";return true;};kaMap.prototype.removeObject=function(obj){if(obj==null){for(var i=0;i<this.aObjects.length;i++){obj=this.aObjects[i];if(obj.canvas){obj.canvas.removeChild(obj);}}
this.aObjects=[];return true;}else{for(var i=0;i<this.aObjects.length;i++){if(this.aObjects[i]==obj){obj=this.aObjects[i];if(obj.canvas){obj.canvas.removeChild(obj);obj.canvas=null;}
this.aObjects.splice(i,1);return true;}}
return false;}};kaMap.prototype.removeAllObjects=function(canvas){for(var i=0;i<this.aObjects.length;i++){obj=this.aObjects[i];if(obj.canvas&&obj.canvas==canvas){obj.canvas.removeChild(obj);obj.canvas=null;this.aObjects.splice(i--,1);}}
return true;};kaMap.prototype.centerObject=function(obj){var vpX=-safeParseInt(this.theInsideLayer.style.left)+this.viewportWidth/2;var vpY=-safeParseInt(this.theInsideLayer.style.top)+this.viewportHeight/2;var xOffset=(obj.xOffset)?obj.xOffset:0;var yOffset=(obj.yOffset)?obj.yOffset:0;var dx=safeParseInt(obj.style.left)-xOffset-vpX;var dy=safeParseInt(obj.style.top)-yOffset-vpY;this.slideBy(-dx,-dy);return true;};kaMap.prototype.geoToPix=function(gX,gY){var pX=gX/this.cellSize;var pY=-1*gY/this.cellSize;return[Math.floor(pX),Math.floor(pY)];};kaMap.prototype.pixToGeo=function(pX,pY){var bAdjust=(arguments.length==3&&arguments[2])?true:false;if(bAdjust){pX=pX+this.xOrigin;pY=pY+this.yOrigin;}
var gX=-1*pX*this.cellSize;var gY=pY*this.cellSize;return[gX,gY];};kaMap.prototype.initialize=function(){if(this.initializationState==2){this.triggerEvent(KAMAP_ERROR,'ERROR: ka-Map! is already initialized!');return false;}else if(this.intializationState==1){this.triggerEvent(KAMAP_WARNING,'WARNING: ka-Map! is currently initializing ... wait for the KAMAP_INITIALIZED event to be triggered.');return false;}
this.initializationState=1;var szURL=this.server+this.init;var sep=(this.init.indexOf("?")==-1)?"?":"&";if(arguments.length>0&&arguments[0]!=''){szURL=szURL+sep+"map="+arguments[0];sep="&";}
if(arguments.length>1&&arguments[1]!=''){szURL=szURL+sep+"extents="+arguments[1];sep="&";}
if(arguments.length>2&&arguments[2]!=''){szURL=szURL+sep+"centerPoint="+arguments[2];sep="&";}
call(szURL,this,this.initializeCallback);return true;};kaMap.prototype.initializeFromRemoteServer=function(){if(this.initializationState==2){this.triggerEvent(KAMAP_ERROR,'ERROR: ka-Map! is already initialized!');return false;}else if(this.intializationState==1){this.triggerEvent(KAMAP_WARNING,'WARNING: ka-Map! is currently initializing ... wait for the KAMAP_INITIALIZED event to be triggered.');return false;}
this.initializationState=1;var szURL="";if(arguments.length>0&&arguments[0]!=''){szURL="map="+arguments[0];}
if(arguments.length>1&&arguments[1]!=''){szURL=szURL+sep+"extents="+arguments[1];}
if(arguments.length>2&&arguments[2]!=''){szURL=szURL+sep+"centerPoint="+arguments[2];}
if(arguments.length>3&&arguments[3]!=''){szURL=arguments[3]+"?page=init.php&params="+szURL;}
call(szURL,this,this.initializeCallback);return true;};kaMap.prototype.initializeCallback=function(szInit){if(szInit.substr(0,1)!="/"){this.triggerEvent(KAMAP_ERROR,'ERROR: ka-Map! initialization '+'failed on the server.  Message returned was:\n'+
szInit);return false;}
eval(szInit);this.triggerEvent(KAMAP_INITIALIZED);this.initializationState=2;};kaMap.prototype.setBackgroundColor=function(color){this.domObj.style.backgroundColor=color;return true;};kaMap.prototype.createLayers=function(){this.theInsideLayer=document.createElement('div');this.theInsideLayer.id='theInsideLayer';this.theInsideLayer.style.position='absolute';this.theInsideLayer.style.left='0px';this.theInsideLayer.style.top='0px';this.theInsideLayer.style.zIndex='1';this.theInsideLayer.kaMap=this;if(this.currentTool){this.theInsideLayer.style.cursor=this.currentTool.cursor;}
this.domObj.appendChild(this.theInsideLayer);this.domObj.kaMap=this;this.theInsideLayer.onmousedown=kaMap_onmousedown;this.theInsideLayer.onmouseup=kaMap_onmouseup;this.theInsideLayer.onmousemove=kaMap_onmousemove;this.theInsideLayer.onmouseover=kaMap_onmouseover;this.domObj.onmouseout=kaMap_onmouseout;this.theInsideLayer.onkeypress=kaMap_onkeypress;this.theInsideLayer.ondblclick=kaMap_ondblclick;this.theInsideLayer.oncontextmenu=kaMap_oncontextmenu;this.theInsideLayer.onmousewheel=kaMap_onmousewheel;if(window.addEventListener&&navigator.product&&navigator.product=="Gecko"){this.domObj.addEventListener("DOMMouseScroll",kaMap_onmousewheel,false);}
this.theInsideLayer.ondragstart=new Function([],'var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;');};kaMap.prototype.initializeLayers=function(nFactor){var deltaMouseX=this.nCurrentLeft+safeParseInt(this.theInsideLayer.style.left)-this.xOrigin;var deltaMouseY=this.nCurrentTop+safeParseInt(this.theInsideLayer.style.top)-this.yOrigin;var vpTop=this.nCurrentTop-deltaMouseY;var vpLeft=this.nCurrentLeft-deltaMouseX;var vpCenterX=vpLeft+this.viewportWidth/2;var vpCenterY=vpTop+this.viewportHeight/2;var currentTileX=Math.floor(vpCenterX/this.tileWidth)*this.tileWidth;var currentTileY=Math.floor(vpCenterY/this.tileHeight)*this.tileHeight;var tileDeltaX=currentTileX-this.nCurrentLeft;var tileDeltaY=currentTileY-this.nCurrentTop;var newVpCenterX=vpCenterX*nFactor;var newVpCenterY=vpCenterY*nFactor;var newTileX=Math.floor(newVpCenterX/this.tileWidth)*this.tileWidth;var newTileY=Math.floor(newVpCenterY/this.tileHeight)*this.tileHeight;var newCurrentLeft=newTileX-tileDeltaX;var newCurrentTop=newTileY-tileDeltaY;this.nCurrentLeft=newCurrentLeft;this.nCurrentTop=newCurrentTop;var newTilLeft=-newVpCenterX+this.viewportWidth/2;var newTilTop=-newVpCenterY+this.viewportHeight/2;var xOldOrigin=this.xOrigin;var yOldOrigin=this.yOrigin;this.xOrigin=this.nCurrentLeft;this.yOrigin=this.nCurrentTop;this.theInsideLayer.style.left=(newTilLeft+this.xOrigin)+"px";this.theInsideLayer.style.top=(newTilTop+this.yOrigin)+"px";var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.src=this.tileLoadingImg.src;img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";layers[k].setTile(img);}}}
this.checkWrap();this.updateObjects();};kaMap.prototype.paintLayer=function(l){var d=l.domObj;if(!d)return;for(var j=0;j<this.nHigh;j++){for(var i=0;i<this.nWide;i++){var img=d.childNodes[(j*this.nWide)+i];img.style.top=(this.nCurrentTop+j*this.tileHeight-this.yOrigin)+"px";img.style.left=(this.nCurrentLeft+i*this.tileWidth-this.xOrigin)+"px";l.setTile(img);}}
this.checkWrap();};kaMap.prototype.updateObjects=function(){for(var i=0;i<this.aObjects.length;i++){var obj=this.aObjects[i];var xOffset=(obj.xOffset)?obj.xOffset:0;var yOffset=(obj.yOffset)?obj.yOffset:0;var aPix=this.geoToPix(obj.lon,obj.lat);var top=(aPix[1]-this.yOrigin+yOffset);var left=(aPix[0]-this.xOrigin+xOffset);obj.style.top=top+"px";obj.style.left=left+"px";}};kaMap.prototype.resize=function(){if(this.initializationState!=2){return false;}
var newViewportWidth=this.getObjectWidth(this.domObj);var newViewportHeight=this.getObjectHeight(this.domObj);this.theInsideLayer.style.top=safeParseInt(this.theInsideLayer.style.top)+(newViewportHeight-this.viewportHeight)/2+"px";this.theInsideLayer.style.left=safeParseInt(this.theInsideLayer.style.left)+(newViewportWidth-this.viewportWidth)/2+"px";var newWide=Math.ceil((newViewportWidth/this.tileWidth)+2*this.nBuffer);var newHigh=Math.ceil((newViewportHeight/this.tileHeight)+2*this.nBuffer);this.viewportWidth=newViewportWidth;this.viewportHeight=newViewportHeight;while(this.nHigh<newHigh){this.appendRow();}
while(this.nHigh>newHigh){this.removeRow();}
while(this.nWide<newWide){this.appendColumn();}
while(this.nWide>newWide){this.removeColumn();}
var map=this.getCurrentMap();var layers=map.getLayers();for(var i=0;i<layers.length;i++){layers[i].setTileLayer();}};kaMap.prototype.createImage=function(top,left,obj){var img=document.createElement('img');img.src=this.tileLoadingImg.src;img.width=this.tileWidth;img.height=this.tileHeight;img.setAttribute('style','position:absolute; top:'+top+'px; left:'+left+'px;');img.style.position='absolute';img.style.top=(top-this.yOrigin)+'px';img.style.left=(left-this.xOrigin)+'px';img.style.width=this.tileWidth+"px";img.style.height=this.tileHeight+"px";img.style.visibility='hidden';img.galleryimg="no";img.onerror=kaMap_imgOnError;img.onload=kaMap_imgOnLoad;img.errorCount=0;img.id="i"+this.gImageID;img.layer=obj;img.kaMap=this;this.gImageID++;img.ie_hack=false;if(this.isIE4){if(obj.imageformat&&(obj.imageformat.toLowerCase()=="alpha")){img.ie_hack=true;}}
return img;};kaMap.prototype.resetTile=function(id,bForce){var img=this.DHTMLapi.getRawObject(id);if(img.layer){img.layer.setTile(this,bForce);}};kaMap.prototype.reloadImage=function(id){};kaMap.prototype.resetImage=function(id){};kaMap_imgOnError=function(e){if(this.layer){this.layer.setTile(this,true);}};kaMap_imgOnLoad=function(e){if((this.ie_hack)&&(this.src!=this.kaMap.aPixel.src)){var src=this.src;this.src=this.kaMap.aPixel.src;this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"')";}
this.style.visibility='visible';};kaMap.prototype.appendRow=function(layer){if(this.nWide==0){return;}
var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}
for(var i=0;i<layers.length;i++){var obj=layers[i].domObj;for(var j=0;j<this.nWide;j++){var top=this.nCurrentTop+(this.nHigh*this.tileHeight);var left=this.nCurrentLeft+(j*this.tileWidth);var img=this.createImage(top,left,layers[i]);if(this.isIE4){img.style.filter="Alpha(opacity="+layers[i].opacity+")";}
obj.appendChild(img);}}
this.nHigh++;};kaMap.prototype.appendColumn=function(layer){if(this.nHigh==0){return;}
var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}
for(var i=0;i<layers.length;i++){var obj=layers[i].domObj;for(var j=this.nHigh-1;j>=0;j--){var top=this.nCurrentTop+(j*this.tileHeight);var left=this.nCurrentLeft+(this.nWide*this.tileWidth);var img=this.createImage(top,left,layers[i]);if(this.isIE4){img.style.filter="Alpha(opacity="+layers[i].opacity+")";}
if(j<this.nHigh-1){obj.insertBefore(img,obj.childNodes[((j+1)*this.nWide)]);}else{obj.appendChild(img);}}}
this.nWide++;};kaMap.prototype.removeColumn=function(layer){if(this.nWide<3){return;}
var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}
for(var i=0;i<layers.length;i++){var d=layers[i].domObj;for(var j=this.nHigh-1;j>=0;j--){var img=d.childNodes[((j+1)*this.nWide)-1];d.removeChild(img);img.onload=null;img.onerror=null;}}
this.nWide--;};kaMap.prototype.removeRow=function(layer){if(this.nHigh<3){return;}
var layers=null;if(arguments.length==1){layers=Array(layer);}else{layers=this.aMaps[this.currentMap].getLayers();}
for(var i=0;i<layers.length;i++){var d=layers[i].domObj;for(var j=this.nWide-1;j>=0;j--){var img=d.childNodes[((this.nHigh-1)*this.nWide)+j];d.removeChild(img);img.onload=null;img.onerror=null;}}
this.nHigh--;};kaMap.prototype.hideLayers=function(){if(!this.hideLayersOnMove){return;}
if(this.layersHidden){return;}
var layers=this.aMaps[this.currentMap].getLayers();for(var i=0;i<layers.length;i++){layers[i]._visible=layers[i].visible;if(layers[i].name!='__base__'){layers[i].setVisibility(false);}}
for(var i=0;i<this.aCanvases.length;i++){this.aCanvases[i].style.visibility='hidden';this.aCanvases[i].style.display='none';}
this.layersHidden=true;};kaMap.prototype.showLayers=function(){if(!this.hideLayersOnMove){return;}
if(!this.layersHidden){return;}
var layers=this.aMaps[this.currentMap].getLayers();for(var i=0;i<layers.length;i++){layers[i].setVisibility(layers[i]._visible);}
for(var i=0;i<this.aCanvases.length;i++){this.aCanvases[i].style.visibility='visible';this.aCanvases[i].style.display='block';}
this.layersHidden=false;};kaMap.prototype.moveBy=function(x,y){var til=this.theInsideLayer;til.style.top=(safeParseInt(til.style.top)+y)+'px';til.style.left=(safeParseInt(til.style.left)+x)+'px';this.checkWrap();};kaMap.prototype.slideBy=function(x,y){if(this.slideid!=null){goQueueManager.dequeue(this.slideid);}
this.as=[];var absX=Math.abs(x);var absY=Math.abs(y);var signX=x/absX;var signY=y/absY;var distance=absX>absY?absX:absY;var steps=Math.floor(distance/this.pixelsPerStep);var dx=dy=0;if(steps>0){dx=(x)/(steps*this.pixelsPerStep);dy=(y)/(steps*this.pixelsPerStep);}
var remainderX=x-dx*steps*this.pixelsPerStep;var remainderY=y-dy*steps*this.pixelsPerStep;var px=py=0;var curspeed=this.accelerationFactor;var i=0;while(i<steps){if(i>0){px+=this.as[i-1][0];py+=this.as[i-1][1];}
var cx=px+Math.round(dx*this.pixelsPerStep);var cy=py+Math.round(dy*this.pixelsPerStep);this.as[i]=new Array(cx-px,cy-py);i++;}
if(remainderX!=0||remainderY!=0){this.as[i]=[remainderX,remainderY];}
this.hideLayers();this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[0]);};kaMap.prototype.slide=function(pos){if(pos>=this.as.length){this.as=slideid=null;this.showLayers();this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());return;}
this.moveBy(this.as[pos][0],this.as[pos][1]);pos++;this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[pos]);};kaMap_onkeypress=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onkeypress(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onkeypress(e);}}};kaMap_onmousemove=function(e){e=(e)?e:((event)?event:null);if(e.button==2){this.kaMap.triggerEvent(KAMAP_CONTEXT_MENU);}
if(this.kaMap.currentTool){this.kaMap.currentTool.onmousemove(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onmousemove(e);}}};kaMap_onmousedown=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onmousedown(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onmousedown(e);}}};kaMap_onmouseup=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseup(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onmouseup(e);}}};kaMap_onmouseover=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseover(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onmouseover(e);}}};kaMap_onmouseout=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onmouseout(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].onmouseout(e);}}};kaMap_oncontextmenu=function(e){e=e?e:event;if(e.preventDefault){e.preventDefault();}
return false;};kaMap_ondblclick=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.ondblclick(e);}
if(this.kaMap.aInfoTools.length>0){for(var i=0;i<this.kaMap.aInfoTools.length;i++){this.kaMap.aInfoTools[i].ondblclick(e);}}};kaMap_onmousewheel=function(e){if(this.kaMap.currentTool){this.kaMap.currentTool.onmousewheel(e);}};kaMap.prototype.cancelEvent=function(e){e=(e)?e:((event)?event:null);e.returnValue=false;if(e.preventDefault){e.preventDefault();}
return false;};kaMap.prototype.registerTool=function(toolObj){this.aTools.push(toolObj);};kaMap.prototype.activateTool=function(toolObj){if(toolObj.isInfoTool()){this.aInfoTools.push(toolObj);}else{if(this.currentTool){this.currentTool.deactivate();}
this.currentTool=toolObj;if(this.theInsideLayer){this.setCursor(this.currentTool.cursor);}}};kaMap.prototype.deactivateTool=function(toolObj){if(toolObj.isInfoTool()){for(var i=0;i<this.aInfoTools.length;i++){if(this.aInfoTools[i]==toolObj){this.aInfoTools.splice(i,1);break;}}}else{if(this.currentTool==toolObj){this.currentTool=null;}
if(this.theInsideLayer){this.theInsideLayer.style.cursor='auto';}}};kaMap.prototype.setCursor=function(cursor){if(cursor&&cursor.length&&typeof cursor=='object'){for(var i=0;i<cursor.length;i++){this.theInsideLayer.style.cursor=cursor[i];if(this.theInsideLayer.style.cursor==cursor[i]){break;}}}else if(typeof cursor=='string'){this.theInsideLayer.style.cursor=cursor;}else{this.theInsideLayer.style.cursor='auto';}};kaMap.prototype.checkWrap=function(){var bWrapped=false;this.checkMaxExtents();this.xOffset=safeParseInt(this.theInsideLayer.style.left)+this.nCurrentLeft-this.xOrigin;this.yOffset=safeParseInt(this.theInsideLayer.style.top)+this.nCurrentTop-this.yOrigin;while(this.xOffset>0){this.wrapR2L();bWrapped=true;}
while(this.xOffset<-(this.nBuffer*this.tileWidth)){this.wrapL2R();bWrapped=true;}
while(this.yOffset>-(this.nBuffer*this.tileHeight)){this.wrapB2T();bWrapped=true;}
while(this.yOffset<-(2*this.nBuffer*this.tileHeight)){this.wrapT2B();bWrapped=true;}
var layer=this.aMaps[this.currentMap].getLayers()[0];if(layer){var img=layer.domObj.childNodes[0].style;this.nCurrentTop=safeParseInt(img.top)+this.yOrigin;this.nCurrentLeft=safeParseInt(img.left)+this.xOrigin;}
if(bWrapped){this.triggerEvent(KAMAP_METAEXTENTS_CHANGED,this.getMetaExtents());}};kaMap.prototype.checkMaxExtents=function(){var maxExtents=this.getCurrentMap().maxExtents;if(maxExtents.length==4){if((maxExtents[0]>=maxExtents[2])||(maxExtents[1]>=maxExtents[3])){return false;}
var geoExtents=this.getGeoExtents();var hPixelAdjustment=0;var vPixelAdjustment=0;if(geoExtents[0]<maxExtents[0]){hPixelAdjustment=Math.round((maxExtents[0]-geoExtents[0])/this.cellSize);}
if(geoExtents[2]>maxExtents[2]){if(hPixelAdjustment!=0)
{hPixelAdjustment+=Math.round((maxExtents[2]-geoExtents[2])/this.cellSize);hPixelAdjustment/=2;}else{hPixelAdjustment+=Math.round((maxExtents[2]-geoExtents[2])/this.cellSize);}}
if(hPixelAdjustment!=0){this.theInsideLayer.style.left=(safeParseInt(this.theInsideLayer.style.left)-hPixelAdjustment)+'px';}
if(geoExtents[1]<maxExtents[1]){vPixelAdjustment=Math.round((maxExtents[1]-geoExtents[1])/this.cellSize);}
if(geoExtents[3]>maxExtents[3]){if(vPixelAdjustment!=0){vPixelAdjustment+=Math.round((maxExtents[3]-geoExtents[3])/this.cellSize);vPixelAdjustment/=2;}else{vPixelAdjustment=Math.round((maxExtents[3]-geoExtents[3])/this.cellSize);}}
if(vPixelAdjustment!=0){this.theInsideLayer.style.top=(safeParseInt(this.theInsideLayer.style.top)+vPixelAdjustment)+'px';}}};kaMap.prototype.wrapR2L=function(){this.xOffset=this.xOffset-(this.nBuffer*this.tileWidth);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refLeft=safeParseInt(d.childNodes[0].style.left);for(var j=0;j<this.nHigh;j++){var imgLast=d.childNodes[((j+1)*this.nWide)-1];var imgNext=d.childNodes[j*this.nWide];imgLast.style.left=(refLeft-this.tileWidth)+'px';imgLast.src=this.tileLoadingImg.src;d.removeChild(imgLast);d.insertBefore(imgLast,imgNext);if(layers[k].visible){layers[k].setTile(imgLast);}}}};kaMap.prototype.wrapL2R=function(){this.xOffset=this.xOffset+(this.nBuffer*this.tileWidth);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refLeft=safeParseInt(d.childNodes[this.nWide-1].style.left);for(var j=0;j<this.nHigh;j++){var imgFirst=d.childNodes[j*this.nWide];var imgNext;if(j<this.nHigh-1){imgNext=d.childNodes[((j+1)*this.nWide)];}else{imgNext=null;}
imgFirst.style.left=(refLeft+this.tileWidth)+'px';imgFirst.src=this.tileLoadingImg.src;d.removeChild(imgFirst);if(imgNext){d.insertBefore(imgFirst,imgNext);}else{d.appendChild(imgFirst);}
if(layers[k].visible){layers[k].setTile(imgFirst);}}}};kaMap.prototype.wrapT2B=function(){this.yOffset=this.yOffset+(this.nBuffer*this.tileHeight);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refTop=safeParseInt(d.childNodes[(this.nHigh*this.nWide)-1].style.top);for(var i=0;i<this.nWide;i++){var imgBottom=d.childNodes[0];imgBottom.style.top=(refTop+this.tileHeight)+'px';imgBottom.src=this.tileLoadingImg.src;d.removeChild(imgBottom);d.appendChild(imgBottom);if(layers[k].visible){layers[k].setTile(imgBottom);}}}};kaMap.prototype.wrapB2T=function(){this.yOffset=this.yOffset-(this.nBuffer*this.tileHeight);var layers=this.aMaps[this.currentMap].getLayers();for(var k=0;k<layers.length;k++){var d=layers[k].domObj;var refTop=safeParseInt(d.childNodes[0].style.top);for(var i=0;i<this.nWide;i++){var imgTop=d.childNodes[(this.nHigh*this.nWide)-1];imgTop.style.top=(refTop-this.tileHeight)+'px';imgTop.src=this.tileLoadingImg.src;d.removeChild(imgTop);d.insertBefore(imgTop,d.childNodes[0]);if(layers[k].visible){layers[k].setTile(imgTop);}}}};kaMap.prototype.addMap=function(oMap){oMap.kaMap=this;this.aMaps[oMap.name]=oMap;};kaMap.prototype.getMaps=function(){return this.aMaps;};kaMap.prototype.getCurrentMap=function(){return this.aMaps[this.currentMap];};kaMap.prototype.selectMap=function(name){if(!this.aMaps[name]){return false;}else{this.currentMap=name;var oMap=this.getCurrentMap();this.setBackgroundColor(oMap.backgroundColor);this.setMapLayers();if(arguments[1]&&arguments[1].length==3){this.zoomTo(arguments[1][0],arguments[1][1],arguments[1][2]);oMap.aZoomTo.length=0;}else if(oMap.aZoomTo.length!=0){this.zoomTo(oMap.aZoomTo[0],oMap.aZoomTo[1],oMap.aZoomTo[2]);oMap.aZoomTo.length=0;}else if(arguments[1]&&arguments[1].length==4){this.zoomToExtents(arguments[1][0],arguments[1][1],arguments[1][2],arguments[1][3]);}else{this.zoomToExtents(oMap.currentExtents[0],oMap.currentExtents[1],oMap.currentExtents[2],oMap.currentExtents[3]);}
this.triggerEvent(KAMAP_MAP_INITIALIZED,this.currentMap);return true;}};kaMap.prototype.setMapLayers=function(){var oMap=this.getCurrentMap();for(var i=this.theInsideLayer.childNodes.length-1;i>=0;i--){if(this.theInsideLayer.childNodes[i].className=='mapLayer'){this.theInsideLayer.childNodes[i].appended=false;this.theInsideLayer.removeChild(this.theInsideLayer.childNodes[i]);}}
layers=oMap.getLayers();for(var i=0;i<layers.length;i++){if(!layers[i].domObj){var d=this.createMapLayer(layers[i].name);this.theInsideLayer.appendChild(d);d.appended=true;layers[i].domObj=d;layers[i].setOpacity(layers[i].opacity);layers[i].setZIndex(layers[i].zIndex);layers[i].setVisibility(layers[i].visible);this.nWide=0;this.nHigh=0;this.drawGroup(layers[i]);}else if(!layers[i].domObj.appended){this.theInsideLayer.appendChild(layers[i].domObj);layers[i].domObj.appended=true;layers[i].setZIndex(layers[i].zIndex);}}
return true;};kaMap.prototype.drawGroup=function(group){var newViewportWidth=this.getObjectWidth(this.domObj);var newViewportHeight=this.getObjectHeight(this.domObj);if(this.viewportWidth==null){this.theInsideLayer.style.top=(-1*this.nCurrentTop+this.yOrigin)+"px";this.theInsideLayer.style.left=(-1*this.nCurrentLeft+this.xOrigin)+"px";this.viewportWidth=newViewportWidth;this.viewportHeight=newViewportHeight;}
var newWide=Math.ceil((newViewportWidth/this.tileWidth)+2*this.nBuffer);var newHigh=Math.ceil((newViewportHeight/this.tileHeight)+2*this.nBuffer);this.viewportWidth=newViewportWidth;this.viewportHeight=newViewportHeight;if(this.nHigh==0&&this.nWide==0){this.nWide=newWide;}
while(this.nHigh<newHigh){this.appendRow(group);}
while(this.nHigh>newHigh){this.removeRow(group);}
while(this.nWide<newWide){this.appendColumn(group);}
while(this.nWide>newWide){this.removeColumn(group);}
return true;};kaMap.prototype.createMapLayer=function(id){var d=document.createElement('div');d.id=id;d.className='mapLayer';d.style.position='absolute';d.style.visibility='visible';d.style.left='0px';d.style.top='0px';d.style.width='3000px';d.style.height='3000px';d.appended=false;return d;};kaMap.prototype.addMapLayer=function(l){var map=this.getCurrentMap();map.addLayer(l);this.setMapLayers();if(l.domObj)
this.paintLayer(l);this.triggerEvent(KAMAP_LAYERS_CHANGED,this.currentMap);};kaMap.prototype.removeMapLayer=function(name){var map=this.getCurrentMap();var layer=map.getLayer(name);if(!layer){return false;}
if(map.removeLayer(map.getLayer(name))){this.setMapLayers();this.triggerEvent(KAMAP_LAYERS_CHANGED,this.currentMap);}};kaMap.prototype.getCenter=function(){var deltaMouseX=this.nCurrentLeft-this.xOrigin+safeParseInt(this.theInsideLayer.style.left);var deltaMouseY=this.nCurrentTop-this.yOrigin+safeParseInt(this.theInsideLayer.style.top);var vpTop=this.nCurrentTop-deltaMouseY;var vpLeft=this.nCurrentLeft-deltaMouseX;var vpCenterX=vpLeft+this.viewportWidth/2;var vpCenterY=vpTop+this.viewportHeight/2;return new Array(vpCenterX,vpCenterY);};kaMap.prototype.getGeoExtents=function(){var minx=-1*(safeParseInt(this.theInsideLayer.style.left)-this.xOrigin)*this.cellSize;var maxx=minx+this.viewportWidth*this.cellSize;var maxy=(safeParseInt(this.theInsideLayer.style.top)-this.yOrigin)*this.cellSize;var miny=maxy-this.viewportHeight*this.cellSize;return[minx,miny,maxx,maxy];};kaMap.prototype.getMetaExtents=function(){var result=this.getGeoExtents();var oMap=this.getCurrentMap();layers=oMap.getLayers();for(var i=0;i<layers.length;i++){if(layers[i].domObj){var d=layers[i].domObj;var pl=safeParseInt(d.childNodes[0].style.left);var pt=safeParseInt(d.childNodes[0].style.top);var glt=this.pixToGeo(pl,pt,true);var left=-1*glt[0];var top=-1*glt[1];var right=left+this.nWide*this.tileWidth*this.cellSize;var bottom=top-this.nHigh*this.tileHeight*this.cellSize;result=[left,bottom,right,top];break;}}
return result;};kaMap.prototype.zoomIn=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomIn());};kaMap.prototype.zoomOut=function(){this.zoomByFactor(this.aMaps[this.currentMap].zoomOut());};kaMap.prototype.zoomToScale=function(scale){this.zoomByFactor(this.aMaps[this.currentMap].zoomToScale(scale));};kaMap.prototype.zoomByFactor=function(nZoomFactor){if(nZoomFactor==1){this.triggerEvent(KAMAP_NOTICE,"NOTICE: changing to current scale aborted");return;}
this.cellSize=this.cellSize/nZoomFactor;this.setMapLayers();this.initializeLayers(nZoomFactor);this.triggerEvent(KAMAP_SCALE_CHANGED,this.getCurrentScale());this.triggerEvent(KAMAP_EXTENTS_CHANGED,this.getGeoExtents());};kaMap.prototype.getCurrentScale=function(){return this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale];};kaMap.prototype.setLayerQueryable=function(name,bQueryable){this.aMaps[this.currentMap].setLayerQueryable(name,bQueryable);};kaMap.prototype.setLayerVisibility=function(name,bVisible){if(!this.loadUnchecked&&bVisible){layer=this.aMaps[this.currentMap].getLayer(name);layer.visible=true;this.setMapLayers();this.aMaps[this.currentMap].setLayerVisibility(name,bVisible);this.paintLayer(layer);}else{this.aMaps[this.currentMap].setLayerVisibility(name,bVisible);}};kaMap.prototype.setLayerOpacity=function(name,opacity){this.aMaps[this.currentMap].setLayerOpacity(name,opacity);};kaMap.prototype.registerEventID=function(eventID){return this.eventManager.registerEventID(eventID);};kaMap.prototype.registerForEvent=function(eventID,obj,func){return this.eventManager.registerForEvent(eventID,obj,func);};kaMap.prototype.deregisterForEvent=function(eventID,obj,func){return this.eventManager.deregisterForEvent(eventID,obj,func);};kaMap.prototype.triggerEvent=function(eventID){return this.eventManager.triggerEvent.apply(this.eventManager,arguments);};kaMap.prototype.findObjectPos=function(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}
return[curleft,curtop];};function _map(o){this.aLayers=[];this.aZoomTo=[];this.kaMap=null;this.name=(typeof(o.name)!='undefined')?o.name:'noname';this.title=(typeof(o.title)!='undefined')?o.title:'no title';this.aScales=(typeof(o.scales)!='undefined')?o.scales:[1];this.currentScale=(typeof(o.currentScale)!='undefined')?parseFloat(o.currentScale):0;this.units=(typeof(o.units)!='undefined')?o.units:5;this.resolution=(typeof(o.resolution)!='undefined')?o.resolution:72;this.defaultExtents=(typeof(o.defaultExtents)!='undefined')?o.defaultExtents:[];this.currentExtents=(typeof(o.currentExtents)!='undefined')?o.currentExtents:[];this.maxExtents=(typeof(o.maxExtents)!='undefined')?o.maxExtents:[];this.backgroundColor=(typeof(o.backgroundColor)!='undefined')?o.backgroundColor:'#ffffff';this.version=(typeof(o.version)!='undefined')?o.version:"";};_map.prototype.addLayer=function(layer){layer._map=this;layer.zIndex=this.aLayers.length;this.aLayers.push(layer);};_map.prototype.removeLayer=function(l){var alayer=Array();for(i=0,a=0;i<this.aLayers.length;i++){if(this.aLayers[i]!=l){alayer[a]=this.aLayers[i];a++;}}
this.aLayers=alayer;return true;};_map.prototype.getQueryableLayers=function(){var r=[];var l=this.getLayers();for(var i=0;i<l.length;i++){if(l[i].isQueryable()){r.push(l[i]);}}
return r;};_map.prototype.getLayers=function(){var r=[];for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].isVisible()&&(this.aLayers[i].visible||this.kaMap.loadUnchecked)){r.push(this.aLayers[i]);}}
return r;};_map.prototype.getAllQueryableLayers=function(){var r=[];for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].isQueryable()){r.push(this.aLayers[i]);}}
return r;};_map.prototype.getAllLayers=function(){return this.aLayers;};_map.prototype.getLayer=function(name){for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].name==name){return this.aLayers[i];}}};_map.prototype.getScales=function(){return this.aScales;};_map.prototype.zoomIn=function(){var nZoomFactor=1;if(this.currentScale<this.aScales.length-1){nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale+1];this.currentScale=this.currentScale+1;}
return nZoomFactor;};_map.prototype.zoomOut=function(){var nZoomFactor=1;if(this.currentScale>0){nZoomFactor=this.aScales[this.currentScale]/this.aScales[this.currentScale-1];this.currentScale=this.currentScale-1;}
return nZoomFactor;};_map.prototype.zoomToScale=function(scale){var nZoomFactor=1;for(var i=0;i<this.aScales.length;i++){if(this.aScales[i]==scale){nZoomFactor=this.aScales[this.currentScale]/scale;this.currentScale=parseInt(i);}}
return nZoomFactor;};_map.prototype.setLayerQueryable=function(name,bQueryable){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setQueryable(bQueryable);}};_map.prototype.setLayerVisibility=function(name,bVisible){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setVisibility(bVisible);}};_map.prototype.setLayerOpacity=function(name,opacity){var layer=this.getLayer(name);if(typeof(layer)!='undefined'){layer.setOpacity(opacity);}};_map.prototype.setDefaultExtents=function(minx,miny,maxx,maxy){this.defaultExtents=[minx,miny,maxx,maxy];if(this.currentExtents.length==0)
this.setCurrentExtents(minx,miny,maxx,maxy);};_map.prototype.setCurrentExtents=function(minx,miny,maxx,maxy){this.currentExtents=[minx,miny,maxx,maxy];};_map.prototype.setMaxExtents=function(minx,miny,maxx,maxy){this.maxExtents=[minx,miny,maxx,maxy];};_map.prototype.setBackgroundColor=function(szBgColor){this.backgroundColor=szBgColor;};function _layer(o){this.domObj=null;this._map=null;this.name=(typeof(o.name)!='undefined')?o.name:'unnamed';this.visible=(typeof(o.visible)!='undefined')?o.visible:true;this.opacity=(typeof(o.opacity)!='undefined')?o.opacity:100;this.imageformat=(typeof(o.imageformat)!='undefined')?o.imageformat:null;this.queryablE=(typeof(o.queryable)!='undefined')?o.queryable:false;this.queryState=(typeof(o.queryable)!='undefined')?o.queryable:false;this.tileSource=(typeof(o.tileSource)!='undefined')?o.tileSource:'auto';this.tileFolder=((o.tileFolder)!='undefined')?o.tileFolder:null;this.iconPath=((o.iconPath)!='')?o.iconPath:null;this.scales=(typeof(o.scales)!='undefined')?o.scales:new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);this.toLoad=0;var ts=new Date();this.timeStamp=Math.round(ts.getTime()/1000)+ts.getTimezoneOffset()*60;this.redrawInterval=(typeof(o.redrawInterval)!='undefined')?o.redrawInterval:-1;this.refreshInterval=(typeof(o.refreshInterval)!='undefined')?o.refreshInterval:-1;if(this.refreshInterval>0){goQueueManager.enqueue(this.refreshInterval*1000,this,this.redraw);}};_layer.prototype.isQueryable=function(){return this.queryState;};_layer.prototype.setQueryable=function(bQueryable){if(this.queryable){this.queryState=bQueryable;}};_layer.prototype.isVisible=function(){return(this.scales[this._map.currentScale]==1)?true:false;};_layer.prototype.setOpacity=function(amount){this.opacity=amount;if(this.domObj){this.domObj.style.opacity=amount/100;this.domObj.style.mozOpacity=amount/100;for(var i=0;i<this.domObj.childNodes.length;i++){this.domObj.childNodes[i].style.filter="Alpha(opacity="+amount+")";}}};_layer.prototype.setTile=function(img){var l=safeParseInt(img.style.left)+this._map.kaMap.xOrigin;var t=safeParseInt(img.style.top)+this._map.kaMap.yOrigin;var szImageformat='';var src;var image_format='';if(this.imageformat&&this.imageformat!=''){image_format=this.imageformat;szImageformat='&i='+image_format;}
if(this.tileSource=='cache'){var metaLeft=Math.floor(l/(this._map.kaMap.tileWidth*this._map.kaMap.metaWidth))*this._map.kaMap.tileWidth*this._map.kaMap.metaWidth;var metaTop=Math.floor(t/(this._map.kaMap.tileHeight*this._map.kaMap.metaHeight))*this._map.kaMap.tileHeight*this._map.kaMap.metaHeight;var metaTileId='t'+metaTop+'/l'+metaLeft;var groupsDir=(this.name!='')?this.name.replace(/\W/g,'_'):'def';if(this.tileFolder!=null){var cacheDir=this._map.kaMap.webCache+this.tileFolder+'/'+this._map.aScales[this._map.currentScale]+'/'+groupsDir+'/def/'+metaTileId;}
else
var cacheDir=this._map.kaMap.webCache+this._map.name+'/'+this._map.aScales[this._map.currentScale]+'/'+groupsDir+'/def/'+metaTileId;var tileId="t"+t+"l"+l;var imageExtension=this.imageformat.toLowerCase().replace(/[\de]/g,'');src=cacheDir+"/"+tileId+"."+imageExtension;var idx=this._map.kaMap.cacheIDX;src="http:\/\/"+this._map.kaMap.cache_server[idx]+src;idx++;if(idx==this._map.kaMap.cache_server.length){this._map.kaMap.cacheIDX=0;}
else{this._map.kaMap.cacheIDX=idx;}}else{var szVersion='';if(this._map.version!=''){szVersion='&version='+this._map.version;}
var szForce='';var szLayers='';if(arguments[1]||this.tileSource=="redraw"){szForce='&force=true';}
var szTimestamp='';if(this.tileSource=='redraw'||this.tileSource=="refresh"){szTimestamp='&ts='+this.timeStamp;if(this.redrawInterval){szTimestamp=szTimestamp+'&interval='+this.redrawInterval;}}
var szGroup='&g='+img.layer.domObj.id;var szScale='&s='+this._map.aScales[this._map.currentScale];var q='?';if(this._map.kaMap.tileURL.indexOf('?')!=-1){if(this._map.kaMap.tileURL.slice(-1)!='&'){q='&';}else{q='';}}
if(this.tileSource=='nocache'){src=this._map.kaMap.server+
this._map.kaMap.tileURL.replace('tile.php','tile_nocache.php')+
q+'map='+this._map.name+'&t='+t+'&l='+l+
szScale+szForce+szGroup+szImageformat;if(typeof(this.replacementVariables)!='undefined'){for(var key in this.replacementVariables){src+='&'+encodeURIComponent(key)+'='+encodeURIComponent(this.replacementVariables[key]);}}}
else{src=this._map.kaMap.server+
this._map.kaMap.tileURL+
q+'map='+this._map.name+'&t='+t+'&l='+l+
szScale+szForce+szGroup+szImageformat+szTimestamp+szVersion;if(this.tileFolder!=null){src+='&tf='+this.tileFolder;}}}
if(img.src!=src){img.style.visibility='hidden';img.src=src;}};_layer.prototype.setVisibility=function(bVisible){this.visible=bVisible;if(this.domObj){this.domObj.style.visibility=bVisible?'visible':'hidden';this.domObj.style.display=bVisible?'block':'none';for(var i=0;i<this.domObj.childNodes.length;i++){this.setTile(this.domObj.childNodes[i]);}
this._map.kaMap.triggerEvent(KAMAP_LAYER_STATUS_CHANGED,this);}};_layer.prototype.setZIndex=function(zIndex){this.zIndex=zIndex;if(this.domObj){this.domObj.style.zIndex=zIndex;}};_layer.prototype.setTileLayer=function(){this.loaded=0;for(i=0;i<this.domObj.childNodes.length;i++){img=this.domObj.childNodes[i];if(arguments[0]){this.setTile(img,arguments[0]);}
else{this.setTile(img);}}};_layer.prototype.redraw=function(){if(arguments[0]){this.refreshInterval=arguments[0];}
if(this.visible){var ts=new Date();this.timeStamp=Math.round(ts.getTime()/1000)+ts.getTimezoneOffset()*60;this.setTileLayer();}
if(this.refreshInterval>0){goQueueManager.enqueue(this.refreshInterval*1000,this,this.redraw);}};function _eventManager()
{this.events=[];this.lastEventID=0;}
_eventManager.prototype.registerEventID=function(eventID){var ev=new String(eventID);if(!this.events[eventID]){this.events[eventID]=[];}};_eventManager.prototype.registerForEvent=function(eventID,obj,func){var ev=new String(eventID);this.events[eventID].push([obj,func]);};_eventManager.prototype.deregisterForEvent=function(eventID,obj,func){var ev=new String(eventID);var bResult=false;if(!this.events[eventID]){return false;}
for(var i=0;i<this.events[eventID].length;i++){if(this.events[eventID][i][0]==obj&&this.events[eventID][i][1]==func){this.events[eventID].splice(i,1);bResult=true;}}
return bResult;};_eventManager.prototype.triggerEvent=function(eventID){var ev=new String(eventID);if(!this.events[eventID]){return false;}
var args=new Array();for(i=1;i<arguments.length;i++){args[args.length]=arguments[i];}
for(var i=0;i<this.events[eventID].length;i++){this.events[eventID][i][1].apply(this.events[eventID][i][0],arguments);}
return true;};var goQueueManager=new _queueManager();function _queueManager(){this.queue=new Array();}
_queueManager.prototype.enqueue=function(timeout,obj,func,args){var pos=this.queue.length;for(var i=0;i<this.queue.length;i++){if(this.queue[i]==null){pos=i;break;}}
var id=window.setTimeout("_queueManager_execute("+pos+")",timeout);this.queue[pos]=new Array(id,obj,func,args);return pos;};_queueManager.prototype.dequeue=function(pos){if(this.queue[pos]!=null){window.clearTimeout(this.queue[pos][0]);this.queue[pos]=null;}};function _queueManager_execute(pos){if(goQueueManager.queue[pos]!=null){var obj=goQueueManager.queue[pos][1];var func=goQueueManager.queue[pos][2];if(goQueueManager.queue[pos][3]!=null){func.apply(obj,goQueueManager.queue[pos][3]);}else{func.apply(obj);}
goQueueManager.queue[pos]=null;}};function $d(elem){if(typeof elem!="undefined")
return true;else
return false;}
function utils(oKaMap){this.kaMap=oKaMap;this.kaMap.utils=this;}
utils.prototype.getEventSrc=function(e){e=(e)?e:((event)?event:null);if(e==null)
return null;var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);return src;}
utils.prototype.createTable=function(id,rows,cols){var table=document.createElement("table");if(id!=null)
table.id=id;var tbody=document.createElement("tbody");table.appendChild(tbody);var tableContent=new Array();for(var i=0;i<rows;i++){tr=document.createElement("tr");tbody.appendChild(tr);tableContent.push(tr);for(var j=0;j<cols;j++){td=document.createElement("td");tr.appendChild(td);tableContent[tableContent.length-1][j]=td;}}
return[table,tableContent];}
utils.prototype.createButton=function(){try{var button=document.createElement("<input type='button'>");}
catch(e){var button=document.createElement("input");button.type="button";}
return button;}
utils.prototype.listenToEnter=function(elem,trigger){elem=$(elem);trigger=$(trigger);if(elem==null||trigger==null)
return false;if($d(trigger.onclick))
elem.onkeyup=function(e){if(isReturn(e))trigger.onclick()};if($d(trigger.click))
elem.onkeyup=function(e){if(isReturn(e))trigger.click()};else if($d(trigger.onmousedown))
elem.onkeyup=function(e){if(isReturn(e))trigger.onmousedown()};else if($d(trigger.onmouseup))
elem.onkeyup=function(e){if(isReturn(e))trigger.onmouseup()};else if($d(trigger.launchSearchFct))
elem.onkeyup=function(e){if(isReturn(e))trigger.launchSearchFct()};else
return false;function isReturn(e){e=(e)?e:((event)?event:null);var code=e.charCode||e.keyCode;if(code==Event.KEY_RETURN)
return true;else
return false;}
return true;}
utils.prototype.insertAfter=function(parent,node,referenceNode){parent.insertBefore(node,referenceNode.nextSibling);}
utils.prototype.setOpacity=function(elem,op){elem=$(elem);elem.style.opacity=op/100;elem.style.mozOpacity=op/100;elem.style.filter="Alpha(opacity="+op+")";}
utils.prototype.isLeftClick=function(e){var rightclick;if(e.which)
rightclick=(e.which==3);else if(e.button)
rightclick=(e.button==2);return rightclick;}
utils.prototype.getPageSize=function(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}
else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}
else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}
else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}
else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}
else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
utils.prototype.getGeoAndPixCoords=function(e){e=(e)?e:((event)?event:null);var x=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var obj=this.kaMap.domObj;var offsetLeft=0;var offsetTop=0;while(obj){offsetLeft+=parseInt(obj.offsetLeft);offsetTop+=parseInt(obj.offsetTop);obj=obj.offsetParent;}
var pX=parseInt(this.kaMap.theInsideLayer.style.left)+offsetLeft-this.kaMap.xOrigin-x;var pY=parseInt(this.kaMap.theInsideLayer.style.top)+offsetTop-this.kaMap.yOrigin-y;var geoCoords=this.kaMap.pixToGeo(pX,pY);var itop=(-pY-this.kaMap.yOrigin);var ileft=(-pX-this.kaMap.xOrigin);return{geo:{x:geoCoords[0],y:geoCoords[1]},pix:{x:ileft,y:itop}};};var foundLocationsListArray=new Array();var generatedMap=null;var mapDefinitionList=null;var currImgFormat=0;var currWithCopyright=true;var pinLogoList=new Array();var polylinesList=new Array();var numericCriteriaList=new Array();var pixelPointList=new Array();var mapActionList=new Array();var inputPOIList=new Array();var inputAddressList=new Array();var geoCoordinatesList=new Array();var categoryList=new Array();var ititraceList=null;function Cost(price,currency){this.price=price;this.currency=currency;};function ItineraryPreferences(favourMotorways,avoidCrossingBorders,avoidTolls,avoidRoadTaxAreas,avoidOffroadConnections,avoidMountainPass){this.favourMotorways=favourMotorways;this.avoidCrossingBorders=avoidCrossingBorders;this.avoidTolls=avoidTolls;this.avoidRoadTaxAreas=avoidRoadTaxAreas;this.avoidOffroadConnections=avoidOffroadConnections;;this.avoidMountainPass=avoidMountainPass;};function ItineraryOptions(itiDate,vehicleType,itiType,itiPref,fuelCost,fuelConsumption){this.itiDate=itiDate;this.vehicleType=vehicleType;this.itiType=itiType;this.itiPref=itiPref;this.fuelCost=fuelCost;this.fuelConsumption=fuelConsumption;};function ExtendedPresentationOptions(detailLevel,language,instructionsFormat,tollCategory){this.detailLevel=detailLevel;this.language=language;this.instructionsFormat=instructionsFormat;this.tollCategory=tollCategory;};function ResponseOptions(responseElts,mapDefCalc,mainMapWidth,mainMapHeight,blocMapWidth,blocMapHeight){this.responseElts=responseElts;this.mapDefCalc=mapDefCalc;this.mainMapWidth=mainMapWidth;this.mainMapHeight=mainMapHeight;this.blocMapWidth=blocMapWidth;this.blocMapHeight=blocMapHeight;};function ItineraryRequest(locDefList,itiOptions,presentationOptions,responseOptions){this.locDefList=locDefList;this.itiOptions=itiOptions;this.presentationOptions=presentationOptions;this.responseOptions=responseOptions;};function DecodeItineraryTraceRequest(itiTrace,range){this.itiTrace=itiTrace;this.range=range;};function NumericCriteria(criteriaKey,criteriaValue,compOp){this.key=criteriaKey;this.val=criteriaValue;this.compOp=compOp;};function InputPOI(id,lat,lon){this.id=id;this.coord=new GeoCoordinates(lon,lat);};function InputAddress(address,cityName,stateName,postalCode,countryCode){this.address=address;this.cityName=cityName;this.countryCode=countryCode;this.postalCode=postalCode;this.stateName=stateName;};function MapDefinitionByID(MapId,MapWidth,MapHeight){this.MapId=MapId;this.MapWidth=MapWidth;this.MapHeight=MapHeight;};function MapDefinitionByScale(psize,center,MapWidth,MapHeight){this.psize=psize;this.center=center;this.MapWidth=MapWidth;this.MapHeight=MapHeight;};function MapDefinitionByRect(northWestPoint,southEastPoint,MapWidth,MapHeight){this.MapWidth=MapWidth;this.MapHeight=MapHeight;this.northWestPoint=northWestPoint;this.southEastPoint=southEastPoint;};function MapDefinitionList(byId,byRect,byScale){this.byId=byId;this.byRect=byRect;this.byScale=byScale;};function GeneratedMap(mapURL,copyright,mapDefinitions){this.mapURL=mapURL;this.copyright=copyright;this.mapDefinitions=mapDefinitions;this.zoomout=function anonymous(){var omapActionList=new Array();var mapAction=new MapAction(3,0);omapActionList[omapActionList.length]=mapAction;mapManagement_getMapByID(this.mapDefinitions.byId.MapId,this.mapDefinitions.byId.MapWidth,this.mapDefinitions.byId.MapHeight,omapActionList,currImgFormat,currWithCopyright,pinLogoList,polylinesList,ititraceList);};this.zoomin=function anonymous(){var omapActionList=new Array();var mapAction=new MapAction(2,0);omapActionList[omapActionList.length]=mapAction;mapManagement_getMapByID(this.mapDefinitions.byId.MapId,this.mapDefinitions.byId.MapWidth,this.mapDefinitions.byId.MapHeight,omapActionList,currImgFormat,currWithCopyright,pinLogoList,polylinesList,ititraceList);};this.move=function anonymous(dir){var omapActionList=new Array();var mapAction=null;if(dir==1){mapAction=new MapAction(0,0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==2){mapAction=new MapAction(0,0.5);omapActionList[omapActionList.length]=mapAction;mapAction=new MapAction(1,0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==3){mapAction=new MapAction(1,0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==4){mapAction=new MapAction(0,-0.5);omapActionList[omapActionList.length]=mapAction;mapAction=new MapAction(1,0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==5){mapAction=new MapAction(0,-0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==6){mapAction=new MapAction(0,-0.5);omapActionList[omapActionList.length]=mapAction;mapAction=new MapAction(1,-0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==7){mapAction=new MapAction(1,-0.5);omapActionList[omapActionList.length]=mapAction;}else if(dir==8){mapAction=new MapAction(0,0.5);omapActionList[omapActionList.length]=mapAction;mapAction=new MapAction(1,-0.5);omapActionList[omapActionList.length]=mapAction;}
mapManagement_getMapByID(this.mapDefinitions.byId.MapId,this.mapDefinitions.byId.MapWidth,this.mapDefinitions.byId.MapHeight,omapActionList,currImgFormat,currWithCopyright,pinLogoList,polylinesList,ititraceList);};this.setPixelSize=function anonymous(newPs){genMapByScale(newPs,this.mapDefinitions.byScale.center,this.mapDefinitions.byScale.MapWidth,this.mapDefinitions.byScale.MapHeight,null,currImgFormat,currWithCopyright,pinLogoList,polylinesList,ititraceList);};this.resize=function anonymous(x0,y0,x1,y1){var newPs=this.mapDefinitions.byScale.psize;if(parseInt(x1)==parseInt(x0)){newPs=this.mapDefinitions.byScale.psize;}else if(parseInt(x1)>parseInt(x0)){newPs=this.mapDefinitions.byScale.psize*((parseInt(x1)-parseInt(x0))/this.mapDefinitions.byScale.MapWidth);}else{newPs=this.mapDefinitions.byScale.psize*((parseInt(x0)-parseInt(x1))/this.mapDefinitions.byScale.MapWidth);}
var x=parseInt((parseInt(x0)+parseInt(x1))/2);var y=parseInt((parseInt(y0)+parseInt(y1))/2);var pixelPoint=new PixelPoint(x,y);var pixelsList=new Array();pixelsList[pixelsList.length]=pixelPoint;var geoCoordinatesList=mapManagement_pixelsToXY(this.mapDefinitions.byId,null,pixelsList);var newcenter=geoCoordinatesList[0];genMapByScale(newPs,newcenter,this.mapDefinitions.byScale.MapWidth,this.mapDefinitions.byScale.MapHeight,null,currImgFormat,currWithCopyright,pinLogoList,polylinesList,ititraceList);};};function FoundLocationFormat(order,bPhoto,bAddr,bAddrDetail,bMetanum,bMetaStr,bDescLst,bCatLst,datasheetContent,language){this.order=order;this.bPhoto=bPhoto;this.bAddr=bAddr;this.bAddrDetail=bAddrDetail;this.bMetanum=bMetanum;this.bMetaStr=bMetaStr;this.bDescLst=bDescLst;this.bCatLst=bCatLst;this.datasheetContent=datasheetContent;this.language=language;};function KeyValuePair(key,val){this.key=key;this.val=val;};function POI(poiDB,poilang,poiID,poiName,poiDatasheet,metanumList,metastringList,descriptionList,categories,photos){this.poiDB=poiDB;this.poilang=poilang;this.poiID=poiID;this.poiName=poiName;this.poiDatasheet=poiDatasheet;this.metanumList=metanumList;this.metastringList=metastringList;this.descriptionList=descriptionList;this.categories=categories;this.photos=photos;};function CoherenceDegreeInfo(streetCoherence,cityCoherence){this.streetCoherence=streetCoherence;this.cityCoherence=cityCoherence;};function AddressDetails(city,countryCode,countryLabel,district,gathering,officialCountryCode,state,streetLabel,streetNumber,zipCode){this.city=city;this.countryCode=countryCode;this.countryLabel=countryLabel;this.district=district;this.gathering=gathering;this.officialCountryCode=officialCountryCode;this.state=state;this.streetLabel=streetLabel;this.streetNumber=streetNumber;this.zipCode=zipCode;};function Address(coherenceDegreeInfo,formattedCityLine,formattedStreetLine,details){this.coherenceDegreeInfo=coherenceDegreeInfo;this.formattedCityLine=formattedCityLine;this.formattedStreetLine=formattedStreetLine;this.details=details;};function PixelPoint(x,y){this.x=x;this.y=y;};function GeoCoordinates(lon,lat){this.lat=lat;this.lon=lon;};function Location(locid,locType,geoCoord,address,poi){this.locid=locid;this.locationType=locType;this.geoCoord=geoCoord;this.address=address;this.poi=poi;};function FoundLocation(distance,duration,locDesc){this.distance=distance;this.duration=duration;this.locDesc=locDesc;};function FoundLocationList(searchStatus,size,foundLocations){this.searchStatus=searchStatus;this.size=size;this.foundLocations=foundLocations;};function PoiID(id,dbId,lang){this.id=id;this.dbId=dbId;this.lang=lang;};function LocDefinition(coord,locID,poiID){this.coord=coord;this.locID=locID;this.poiID=poiID;};function MapAction(type,value){this.type=type;this.value=value;};function InputTrace(color,thickness,pixelPointList,geoCoordinatesList){this.color=color;this.thickness=thickness;this.pixelPointList=pixelPointList;this.geoCoordinatesList=geoCoordinatesList;};function PinLogo(id,pixelPos,coord,displayMode,IconName,IconWidth,IconHeight,hotArea){this.id=id;this.pixelPos=pixelPos;this.coord=coord;this.displayMode=displayMode;this.IconName=IconName;this.IconWidth=IconWidth;this.IconHeight=IconHeight;this.hotArea=hotArea;};function FindNearbyDailyServicesParams(searchCenter,maxResult,maxDistance,categories){this.searchCenter=searchCenter;this.maxResult=maxResult;this.maxDistance=maxDistance;this.categories=categories;};function FindByKeywordsParams(keywords,maxResult,countryCode){this.keywords=keywords;this.maxResult=maxResult;this.countryCode=countryCode;};function FindNearbyByRoadParams(searchCenter,maxResult,maxDistance,maxDuration,mode,itineraryOptions){this.searchCenter=searchCenter;this.maxResult=maxResult;this.maxDistance=maxDistance;this.maxDuration=maxDuration;this.mode=mode;this.itineraryOptions=itineraryOptions;};function FindNearbyParams(searchCenter,maxResult,maxDistance){this.searchCenter=searchCenter;this.maxResult=maxResult;this.maxDistance=maxDistance;};function NumCriteriaDefinition(mode,numericCriteriaList){this.mode=mode;this.numericCriteriaList=numericCriteriaList;};function TextCriteriaDefinition(keywords,mode,scope){this.keywords=keywords;this.mode=mode;this.scope=scope;};function SearchCriteria(textCriteria,numCriteria){this.textCriteria=textCriteria;this.numCriteria=numCriteria;};function FindPOIRequest(searchDataset,searchParams,searchFilter,resultFormat){this.searchDataset=searchDataset;this.searchParams=searchParams;this.searchFilter=searchFilter;this.resultFormat=resultFormat;};function getxhr_object(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}else{return null;}};function mapManagement_pixelsToXY(mapDefByID,mapDefByScale,pixelsList){var xhr_object=getxhr_object();if(xhr_object==null)return;var methodName='pixelsToXY';params='method='+methodName;if((mapDefByID!=null)&&(typeof(mapDefByID)!="undefined")){params=params+"&mapDefByIdMapId="+mapDefByID.MapId+"&mapDefWidth="+mapDefByID.MapWidth+"&mapDefHeight="+mapDefByID.MapHeight;}
if((mapDefByScale!=null)&&(typeof(mapDefByScale)!="undefined")){params=params+"&mapDefps="+mapDefByScale.psize+"&mapDefcenterlon="+mapDefByScale.center.lon+"&mapDefcenterlat="+mapDefByScale.center.lat+"&mapDefWidth="+mapDefByScale.MapWidth+"&mapDefHeight="+mapDefByScale.MapHeight;}
if((typeof(pixelsList)!="undefined")){params=params+"&pixelsListSize="+pixelsList.length;for(var cpt=0;cpt<pixelsList.length;cpt++){params=params+"&x"+cpt+"="+pixelsList[cpt].x+"&y"+cpt+"="+pixelsList[cpt].y;}}
xhr_object.open("POST",lib_folder+"pixelsToXY.php",false);xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhr_object.send(params);if(xhr_object.readyState==4){var items=new Array();var str=xhr_object.responseText;items=str.split('|');var idx=0;var lat=0;var lon=0;var geoCoordinatesList=new Array();if((pixelsList!=null)&&(typeof(pixelsList)!="undefined")){for(var cpt=0;cpt<pixelsList.length;cpt++){var cpti=0;var bfound=false;while((cpti<items.length)&&(bfound==false)){if(items[cpti].indexOf("lon"+cpt+":")!=-1){lon=parseFloat(items[cpti].substring(("lon"+cpt+":").length));lat=parseFloat(items[cpti+1].substring(("lat"+cpt+":").length));var coord=new GeoCoordinates(lon,lat);geoCoordinatesList[cpt]=coord;bfound=true;}
cpti=cpti+1;}
if(!bfound){geoCoordinatesList[cpt]=null;}}}
cpti=0;var errorMsg=null;var errorMsgDetail=null;while(cpti<items.length){if(items[cpti].indexOf("error:")!=-1){errorMsg=items[cpti].substring("error:".length);}else if(items[cpti].indexOf("errorDetail:")!=-1){errorMsgDetail=items[cpti].substring("errorDetail:".length);}
cpti=cpti+1;}
if((errorMsg!=null)||(errorMsgDetail!=null)){errorMsg='[method: '+methodName+'] '+errorMsg;displayError(errorMsg,errorMsgDetail);}
return geoCoordinatesList;}};function getParamsFromMapActionList(omapActionList){var _params='';if(omapActionList!=null){_params=_params+'&mapActionSize='+omapActionList.length;for(var cptj=0;cptj<omapActionList.length;cptj++){if(omapActionList[cptj]!=null){_params=_params+'&mapActionType'+cptj+'='+omapActionList[cptj].type;_params=_params+'&mapActionValue'+cptj+'='+omapActionList[cptj].value;}}}
return _params;};function getParamsFromPinLogoList(opinLogoList){var _params='';if(opinLogoList!=null){_params=_params+'&pinLogoSize='+opinLogoList.length;for(var cptk=0;cptk<opinLogoList.length;cptk++){if(opinLogoList[cptk]!=null){_params=_params+'&pinLogoID'+cptk+'='+opinLogoList[cptk].id;if(opinLogoList[cptk].pixelPos!=null){_params=_params+'&pinLogoX'+cptk+'='+opinLogoList[cptk].pixelPos.x+'&pinLogoY'+cptk+'='+opinLogoList[cptk].pixelPos.y;}
if(opinLogoList[cptk].coord!=null){_params=_params+'&pinLogoLon'+cptk+'='+opinLogoList[cptk].coord.lon+'&pinLogoLat'+cptk+'='+opinLogoList[cptk].coord.lat;}
_params=_params+'&pinLogoMode'+cptk+'='+opinLogoList[cptk].displayMode;_params=_params+'&pinLogoIconName'+cptk+'='+opinLogoList[cptk].IconName;_params=_params+'&pinLogoIconWidth'+cptk+'='+opinLogoList[cptk].IconWidth;_params=_params+'&pinLogoIconHeight'+cptk+'='+opinLogoList[cptk].IconHeight;_params=_params+'&pinLogohotArea'+cptk+'='+opinLogoList[cptk].hotArea;}}}
return _params;};function getParamsFromPolylinesList(opolylinesList){var _params='';if(opolylinesList!=null){_params=_params+'&polylinesSize='+opolylinesList.length;for(var cptl=0;cptl<opolylinesList.length;cptl++){if(opolylinesList[cptl]!=null){_params=_params+'&polylinesColor'+cptl+'='+opolylinesList[cptl].color;;_params=_params+'&polylinesThickness'+cptl+'='+opolylinesList[cptl].thickness;if(opolylinesList[cptl].pixelPointList!=null){_params=_params+'&polylinespixelPointListSize'+cptl+'='+opolylinesList[cptl].pixelPointList.length;for(var cptm=0;cptm<opolylinesList[cptl].pixelPointList.length;cptm++){if(opolylinesList[cptl].pixelPointList[cptm]!=null){_params=_params+'&polylinespixelPointList'+cptl+'X'+cptm+'='+opolylinesList[cptl].pixelPointList[cptm].x;_params=_params+'&polylinespixelPointList'+cptl+'Y'+cptm+'='+opolylinesList[cptl].pixelPointList[cptm].y;}}}
if(opolylinesList[cptl].geoCoordinatesList!=null){_params=_params+'&polylinesgeoCoordListSize'+cptl+'='+opolylinesList[cptl].geoCoordinatesList.length;for(var cptn=0;cptn<opolylinesList[cptl].geoCoordinatesList.length;cptn++){if(opolylinesList[cptl].geoCoordinatesList[cptn]!=null){_params=_params+'&polylinesgeoCoordList'+cptl+'Lon'+cptn+'='+opolylinesList[cptl].geoCoordinatesList[cptn].lon;_params=_params+'&polylinesgeoCoordList'+cptl+'Lat'+cptn+'='+opolylinesList[cptl].geoCoordinatesList[cptn].lat;}}}}}}
return _params;};function getParamsFromItitraceList(oititraceList){var _params='';if((oititraceList!=null)&&(typeof(oititraceList)!="undefined")){_params=_params+'&ititraceSize='+oititraceList.length;for(var cptm=0;cptm<oititraceList.length;cptm++){_params=_params+'&ititracePart'+cptm+'='+oititraceList[cptm];}}
return _params;};function displayGeneratedMap(methodName,xhr_object){if(xhr_object.readyState==4){var str=xhr_object.responseText;var items=new Array();var errorMsg=null;var errorMsgDetail=null;items=str.split('|');for(cpt=0;cpt<items.length;cpt++){if(items[cpt].indexOf("js:")!=-1){eval(items[cpt].substring("js:".length));myKaMap.routingFuncs.getGeneratedMap(generatedMap);return true;}else if(items[cpt].indexOf("error:")!=-1){errorMsg=items[cpt].substring("error:".length);}else if(items[cpt].indexOf("errorDetail:")!=-1){errorMsgDetail=items[cpt].substring("errorDetail:".length);}}
if((errorMsg!=null)||(errorMsgDetail!=null)){errorMsg='[method: '+methodName+'] '+errorMsg;displayError(errorMsg,errorMsgDetail);}}
return false;};function mapManagement_getMapByScale(ps,center,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,oititraceList){var xhr_object=getxhr_object();if(xhr_object==null)return;currImgFormat=imgFormat;currWithCopyright=withCopyright;var methodName='getMapByScale';params='method='+methodName+'&ps='+ps+'&width='+width+'&height='+height+'&imgFormat='+imgFormat+'&withCopyright='+withCopyright;params=params+'&centerLon='+center.lon;params=params+'&centerLat='+center.lat;params=params+getParamsFromMapActionList(mapActionList);params=params+getParamsFromPinLogoList(pinLogoList);params=params+getParamsFromPolylinesList(polylinesList);params=params+getParamsFromItitraceList(oititraceList);xhr_object.open("POST",lib_folder+"getMapByScale.php",true);xhr_object.onreadystatechange=function anonymous(){displayGeneratedMap(methodName,xhr_object);};xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);};function mapManagement_getMapByID(mapId,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,oititraceList){var xhr_object=getxhr_object();if(xhr_object==null)return;currImgFormat=imgFormat;currWithCopyright=withCopyright;var methodName='getMapByID';params='method='+methodName+'&mapId='+mapId+'&width='+width+'&height='+height+'&imgFormat='+imgFormat+'&withCopyright='+withCopyright;params=params+getParamsFromMapActionList(mapActionList);params=params+getParamsFromPinLogoList(pinLogoList);params=params+getParamsFromPolylinesList(polylinesList);params=params+getParamsFromItitraceList(oititraceList);xhr_object.open("POST",lib_folder+"getMapByID.php",true);xhr_object.onreadystatechange=function anonymous(){displayGeneratedMap(methodName,xhr_object);};xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);};function getGeneratedMap(methodName,xhr_object){if(xhr_object.readyState==4){var str=xhr_object.responseText;var items=new Array();var errorMsg=null;var errorMsgDetail=null;items=str.split('|');for(cpt=0;cpt<items.length;cpt++){if(items[cpt].indexOf("js:")!=-1){eval(items[cpt].substring("js:".length));return generatedMap;return true;}else if(items[cpt].indexOf("error:")!=-1){errorMsg=items[cpt].substring("error:".length);}else if(items[cpt].indexOf("errorDetail:")!=-1){errorMsgDetail=items[cpt].substring("errorDetail:".length);}}
if((errorMsg!=null)||(errorMsgDetail!=null)){errorMsg='[method: '+methodName+'] '+errorMsg;displayError(errorMsg,errorMsgDetail);}}
return null;};function mapManagement_getMapByID_sync(mapId,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,oititraceList){var xhr_object=getxhr_object();if(xhr_object==null)return;currImgFormat=imgFormat;currWithCopyright=withCopyright;var methodName='getMapByID';params='method='+methodName+'&mapId='+mapId+'&width='+width+'&height='+height+'&imgFormat='+imgFormat+'&withCopyright='+withCopyright;params=params+getParamsFromMapActionList(mapActionList);params=params+getParamsFromPinLogoList(pinLogoList);params=params+getParamsFromPolylinesList(polylinesList);params=params+getParamsFromItitraceList(oititraceList);xhr_object.open("POST",lib_folder+"getMapByID.php",false);xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);return getGeneratedMap(methodName,xhr_object);};function geocoding_getLocationList_sync(formid,mode,inputAddressList){var xhr_object=getxhr_object();if(xhr_object==null)return;params="size="+inputAddressList.length+"&mode="+mode;for(cpt=0;cpt<inputAddressList.length;cpt++){if(inputAddressList[cpt]!=null){params=params+'&address'+cpt+'='+encodeURIComponent(inputAddressList[cpt].address);params=params+'&cityName'+cpt+'='+encodeURIComponent(inputAddressList[cpt].cityName);params=params+'&countryCode'+cpt+'='+inputAddressList[cpt].countryCode;params=params+'&postalCode'+cpt+'='+inputAddressList[cpt].postalCode;params=params+'&stateName'+cpt+'='+encodeURIComponent(inputAddressList[cpt].stateName);params=params+'&coordX'+cpt+'='+encodeURIComponent(inputAddressList[cpt].coordX);params=params+'&coordY'+cpt+'='+encodeURIComponent(inputAddressList[cpt].coordY);}}
params=params+'&form='+formid;params=params+'&select=lstLocation';xhr_object.open("POST",lib_folder+"getLocation.php",false);xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);if(xhr_object.readyState==4){var str=xhr_object.responseText;var items=new Array();var errorMsg=null;var errorMsgDetail=null;items=str.split('|');for(cpt=0;cpt<items.length;cpt++){if(items[cpt].indexOf("js:")!=-1){eval(items[cpt].substring("js:".length));}
else if(items[cpt].indexOf("error:")!=-1){errorMsg=items[cpt].substring("error:".length);}
else if(items[cpt].indexOf("errorDetail:")!=-1){errorMsgDetail=items[cpt].substring("errorDetail:".length);}}
if((errorMsg!=null)||(errorMsgDetail!=null)){errorMsg='[method: '+methodName+'] '+errorMsg;displayError(errorMsg,errorMsgDetail);return false;}else{return true;}}};function displayCalculatedRoute(calculatedRoute,itiRequest){if((calculatedRoute!=null)&&(typeof(calculatedRoute)!="undefined")){if(calculatedRoute.roadmap!=null)
showItineraryRoadmap(calculatedRoute.roadmap);if(calculatedRoute.mapId!=null)
showItineraryMap(calculatedRoute.mapId,itiRequest.responseOptions.mainMapWidth,itiRequest.responseOptions.mainMapHeight,calculatedRoute.ititrace);}};function getCalculatedRoute(methodName,xhr_object){if(xhr_object.readyState==4){var str=xhr_object.responseText;var items=new Array();items=str.split('|');var errorMsg=null;var errorMsgDetail=null;var oititraceList=null;var mapId=null;var roadmap=null;for(cpt=0;cpt<items.length;cpt++){if(items[cpt].indexOf("html:")!=-1){roadmap=items[cpt].substring("html:".length);}else if(items[cpt].indexOf("mapID:")!=-1){if(items[cpt].length>"mapID:".length){mapId=items[cpt].substring("mapID:".length);}}else if(items[cpt].indexOf("itiTraceSize:")!=-1){nbtrace=parseInt(items[cpt].substring("itiTraceSize:".length));oititraceList=new Array();for(var cpti=cpt+1;cpti<cpt+1+nbtrace;cpti++){oititraceList[oititraceList.length]=items[cpti].substring(("itiTracePart"+cpti+":").length);}
currentItiTrace=oititraceList;}else if(items[cpt].indexOf("error:")!=-1){errorMsg=items[cpt].substring("error:".length);}else if(items[cpt].indexOf("errorDetail:")!=-1){errorMsgDetail=items[cpt].substring("errorDetail:".length);}}
if((errorMsg!=null)||(errorMsgDetail!=null)){errorMsg='[method: '+methodName+'] '+errorMsg;displayError(errorMsg,errorMsgDetail);}else{return{roadmap:roadmap,mapId:mapId,ititrace:oititraceList}}}};function getParamsFromResponseOptions(oresponseOptions){var _params='';_params=_params+'&relt='+oresponseOptions.responseElts;_params=_params+'&mapdef='+oresponseOptions.mapDefCalc;_params=_params+'&mmw='+oresponseOptions.mainMapWidth;_params=_params+'&mmh='+oresponseOptions.mainMapHeight;_params=_params+'&dmw='+oresponseOptions.blocMapWidth;_params=_params+'&dmh='+oresponseOptions.blocMapHeight;return _params;};function getParamsFromLocDefList(olocDefList){var _params='';if(olocDefList!=null){_params=_params+'&locDefSize='+olocDefList.length;for(var cpti=0;cpti<olocDefList.length;cpti++){if((olocDefList[cpti].locID!=null)&&(typeof(olocDefList[cpti].locID)!="undefined")){_params=_params+'&locDefLocID'+cpti+'='+olocDefList[cpti].locID;}
if((olocDefList[cpti].poiID!=null)&&(typeof(olocDefList[cpti].poiID)!="undefined")){_params=_params+'&locDefPoiID'+cpti+'='+olocDefList[cpti].poiID.id;_params=_params+'&locDefPoiLang'+cpti+'='+olocDefList[cpti].poiID.lang;_params=_params+'&locDefPoiDB'+cpti+'='+olocDefList[cpti].poiID.dbId;}
if((olocDefList[cpti].coord!=null)&&(typeof(olocDefList[cpti].coord)!="undefined")){_params=_params+'&locDefCoordLon'+cpti+'='+olocDefList[cpti].coord.lon;_params=_params+'&locDefCoordLat'+cpti+'='+olocDefList[cpti].coord.lat;}}}
return _params;};function routeCalculation_getRoute(itiRequest){var xhr_object=getxhr_object();if(xhr_object==null)return;var methodName='getRoute';params='method='+methodName;params=params+'&itiDate='+itiRequest.itiOptions.itiDate;params=params+'&vType='+itiRequest.itiOptions.vehicleType;params=params+'&iType='+itiRequest.itiOptions.itiType;params=params+'&fmw='+itiRequest.itiOptions.itiPref.favourMotorways;params=params+'&acb='+itiRequest.itiOptions.itiPref.avoidCrossingBorders;params=params+'&at='+itiRequest.itiOptions.itiPref.avoidTolls;params=params+'&art='+itiRequest.itiOptions.itiPref.avoidRoadTaxAreas;params=params+'&aoc='+itiRequest.itiOptions.itiPref.avoidOffroadConnections;params=params+'&amp='+itiRequest.itiOptions.itiPref.avoidMountainPass;params=params+'&fprice='+itiRequest.itiOptions.fuelCost.price;params=params+'&fcurr='+itiRequest.itiOptions.fuelCost.currency;params=params+'&fcons1='+itiRequest.itiOptions.fuelConsumption[0];params=params+'&fcons2='+itiRequest.itiOptions.fuelConsumption[1];params=params+'&fcons3='+itiRequest.itiOptions.fuelConsumption[2];params=params+'&dL='+itiRequest.presentationOptions.detailLevel;params=params+'&lang='+itiRequest.presentationOptions.language;params=params+'&format='+itiRequest.presentationOptions.instructionsFormat;params=params+'&toll='+itiRequest.presentationOptions.tollCategory;params=params+getParamsFromResponseOptions(itiRequest.responseOptions);params=params+getParamsFromLocDefList(itiRequest.locDefList);xhr_object.open("POST",lib_folder+"getRoute.php",true);xhr_object.onreadystatechange=function anonymous(){myKaMap.routingFuncs.routingCallback(getCalculatedRoute(methodName,xhr_object),itiRequest);};xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);};function routeCalculation_getRouteNonMotorized(itiRequest){var xhr_object=getxhr_object();if(xhr_object==null)return;var methodName='getRouteNonMotorized';params='method='+methodName;params=params+'&itiDate='+itiRequest.itiOptions.itiDate;params=params+'&vType='+itiRequest.itiOptions.vehicleType;params=params+'&dL='+itiRequest.presentationOptions.detailLevel;params=params+'&lang='+itiRequest.presentationOptions.language;params=params+'&format='+itiRequest.presentationOptions.instructionsFormat;params=params+getParamsFromResponseOptions(itiRequest.responseOptions);params=params+getParamsFromLocDefList(itiRequest.locDefList);xhr_object.open("POST",lib_folder+"getNonMotorizedRoute.php",true);xhr_object.onreadystatechange=function anonymous(){displayCalculatedRoute(getCalculatedRoute(methodName,xhr_object),itiRequest);};xhr_object.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-1");xhr_object.send(params);};function popUp(oKaMap,id){this.kaMap=oKaMap;this.kaMap.popUp=this;this.forbidden=false;this.disableBody();this.popUp=document.createElement("div");document.body.appendChild(this.popUp);this.popUp.id=id;this.popUp.style.position="absolute";this.popUp.style.display="none";return this;};popUp.prototype.setText=function(content){this.popUp.innerHTML=content;};popUp.prototype.updatePosition=function(){this.popUp.style.display="block";var pageSize=this.kaMap.utils.getPageSize();var width=this.kaMap.getObjectWidth(this.popUp);var height=this.kaMap.getObjectHeight(this.popUp);this.popUp.style.top=pageSize[3]/2-height/2+"px";this.popUp.style.left=pageSize[2]/2-width/2+"px";this.popUp.style.display="none";}
popUp.prototype.display=function(){var t=this;this.updatePosition();if(!this.forbidden){new Effect.SlideDown(this.popUp,{duration:0.6});}
else
setTimeout(function(){t.display()},800);}
popUp.prototype.hide=function(){new Effect.SlideUp(this.popUp);}
popUp.prototype.appendChild=function(elem){this.popUp.appendChild(elem);}
popUp.prototype.removeChild=function(elem){this.popUp.removeChild(elem);}
popUp.prototype.disableBody=function(){var t=this;var pageSize=this.kaMap.utils.getPageSize();this.disabler=document.createElement("div");document.body.appendChild(this.disabler);this.disabler.style.opacity=0;this.disabler.style.mozOpacity=0;this.disabler.style.filter="Alpha(opacity=0)";this.disabler.id="popUpDisabler";this.disabler.style.position="absolute";this.disabler.style.top="0px";this.disabler.style.left="0px";this.disabler.style.width="100%";this.disabler.style.height=pageSize[1]+"px";if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){var aSelects=document.getElementsByTagName("select");for(var i=0;i<aSelects.length;i++){aSelects[i].style.visibility="hidden";}}
new Effect.Opacity(this.disabler,{duration:0.6,from:0,to:0.7});this.forbidden=true;this.noPopUpChrono=window.setTimeout(function(){t.forbidden=false},0.6);};popUp.prototype.destroy=function(){var t=this;document.body.removeChild(this.popUp);document.body.removeChild(this.disabler);if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){var aSelects=document.getElementsByTagName("select");for(var i=0;i<aSelects.length;i++){aSelects[i].style.visibility="visible";}}};function admin(oKaMap){this.kaMap=oKaMap;this.kaMap.admin=this;this.isMinimizedControl=true;this.divH=0;this.modulesRights=new Object();var t=this;};admin.prototype.showLogin=function(){var t=this;var oLoginPopUp=new kaMapPopUp(this.kaMap,"loginPopUp");var loginPopUp=$('loginPopUp');var loginBox=document.createElement("div");loginPopUp.appendChild(loginBox);loginBox.className="loginBox";var mainTable=this.kaMap.utils.createTable(null,3,1);loginBox.appendChild(mainTable[0]);var loginTitleSpan=document.createElement("span");loginTitleSpan.className='LoginUserMsg';mainTable[1][0][0].appendChild(loginTitleSpan);var title=document.createTextNode(tra['admin_login']);loginTitleSpan.appendChild(title);var userMsgSpan=document.createElement("span");userMsgSpan.id='LoginUserMsg';mainTable[1][1][0].appendChild(userMsgSpan);var userMsg=document.createTextNode("");userMsgSpan.appendChild(userMsg);var table=this.kaMap.utils.createTable(null,3,2);mainTable[1][2][0].appendChild(table[0]);var tbody=table[1];var text1=document.createTextNode(tra['admin_username']);tbody[0][0].appendChild(text1);var input1=document.createElement("input");input1.type="text";input1.className='loginInput';tbody[0][1].appendChild(input1);var text2=document.createTextNode(tra['admin_password']);tbody[1][0].appendChild(text2);var input2=document.createElement("input");input2.type="Password";input2.className='loginInput';tbody[1][1].appendChild(input2);var text3=document.createTextNode(" ");tbody[2][0].appendChild(text3);var button=this.kaMap.utils.createButton();tbody[2][1].appendChild(button);button.value=tra['admin_btnannuler'];button.onclick=function(){oLoginPopUp.destroyKaMapPopUp()}
var button2=this.kaMap.utils.createButton();tbody[2][1].appendChild(button2);button2.value=tra['admin_btnok'];button2.onclick=function(){t.tryLogin(input1,input2)}
input1.focus();};admin.prototype.tryLogin=function(input1,input2){if((/^\s*$/g).test(input1.value)){blink([input1],150,3);return;}
if((/^\s*$/g).test(input2.value)){blink([input2],150,3);return;}
var username=input1.value;var password=input2.value;var t=this;var url="/OPO/admin.php?action=login&username="+encodeURI(username)+"&password="+encodeURI(password);if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;call(url,t,t.loginCallback,true);};admin.prototype.loginCallback=function(result){eval(result);var t=this;if(this.authenticated){if(typeof(myKaMap.kaMapPopUp)!='undefined'){myKaMap.kaMapPopUp.destroyKaMapPopUp();}
var loginImg=myKaMap.getRawObject('login');loginImg.src='/OPO/images/logout.gif';loginImg.alt=tra['admin_logout'];loginImg.title=tra['admin_logout'];loginImg.onclick=function(){t.logout()};this.createToolBar();}
else{if(action=='login'){myKaMap.getRawObject('LoginUserMsg').innerHTML=tra['admin_wrong_username'];}
else{var loginImg=myKaMap.getRawObject('login');loginImg.src='/OPO/images/login.gif';loginImg.alt=tra['admin_login'];loginImg.title=tra['admin_login'];loginImg.onclick=function(){t.showLogin()};try{document.body.removeChild($('toolTab'));}
catch(e){}
$('poiInfoContainer').innerHTML="";if($('centerView')!=null){$('centerView').remove();}
this.resetNewLink();this.resetNewPOI();this.resetModifyGastro();this.resetGastroPosition();this.resetModifyGastro();this.resetAccountDiv();this.resetListAccountDiv();this.resetListLink();this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';}}};admin.prototype.logout=function(){var t=this;var url="/OPO/admin.php?action=logout";if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;call(url,t,t.loginCallback,true);$('keymap').style.display='';};admin.prototype.checkLogin=function(){var t=this;var url="/OPO/admin.php?action=checkLogin";if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;call(url,t,t.loginCallback,true);};admin.prototype.createToolBar=function(){var toolTab=document.createElement("div");toolTab.id="toolTab";document.body.appendChild(toolTab);var adminControl=document.createElement("div");adminControl.id="adminControl";toolTab.appendChild(adminControl);var ongletDiv=document.createElement("div");ongletDiv.innerHTML=tra['admin_title']+"<img id='GISwitcherArrow' src='/OPO/images/arrowdown1.png' border='0' width='11' height='6' hspace='6'>";ongletDiv.style.paddingTop="5px";ongletDiv.style.textAlign="center";ongletDiv.style.width="100%";ongletDiv.style.height="24px";ongletDiv.style.backgroundColor='';ongletDiv.style.cursor='pointer';ongletDiv.style.background="url('/OPO/images/onglet1.png') no-repeat";ongletDiv.onclick=this.switchControl.bindAsEventListener(this);toolTab.appendChild(ongletDiv);new Ajax.Updater('adminControl','/OPO/admin.php?action=getAdminMenu&'+sessionName+'='+sessionId,{asynchronous:false});this.divH=adminControl.offsetHeight;toolTab.style.top=(-1)*this.divH+"px";toolTab.style.display='block';this.isMinimizedControl=true;};admin.prototype.switchControl=function(e){$('toolTab').style.left=$('toolTab').offsetLeft+'px';if(this.isMinimizedControl){new Effect.Move($('toolTab'),{x:0,y:this.divH,mode:'relative'});this.isMinimizedControl=false;$('GISwitcherArrow').src='/OPO/images/arrowup1.png';}
else{new Effect.Move($('toolTab'),{x:0,y:(-1)*this.divH,mode:'relative'});this.isMinimizedControl=true;$('GISwitcherArrow').src='/OPO/images/arrowdown1.png';}
if(e!=null){Event.stop(e);}};admin.prototype.createLink=function(){var t=this;var id=null;var centerX=null;var centerY=null;if(arguments.length>0){id=arguments[0];centerX=arguments[1];centerY=arguments[2];}
var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var url="/OPO/admin.php?action=drawCreateLink";if(id!=null){url+="&id="+id;this.kaMap.zoomTo(centerX,centerY);}
if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;new Ajax.Updater('poiInfoContainer',url);$('keymap').style.display='none';this.nbMapMove=0;this.positionTarget();this.kaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);};admin.prototype.listLink=function(){var t=this;if($('linkContainer')==null){var linkContainer=document.createElement("div");linkContainer.id="linkContainer";linkContainer.className="floatingDiv";linkContainer.style.zIndex="1000";var linkContainerHandle=document.createElement("div");linkContainerHandle.id="linkContainerHandle";linkContainerHandle.className="floatingDivHandle";linkContainerHandle.innerHTML=tra['admin_listlink'];linkContainer.appendChild(linkContainerHandle);document.body.appendChild(linkContainer);var img=document.createElement("img");linkContainerHandle.appendChild(img);img.src="/OPO/images/popUpSchliessen.gif";img.onclick=function(){linkContainerDrag.destroy();document.body.removeChild(linkContainer);};linkContainerDrag=new Draggable(linkContainer,{handle:'linkContainerHandle'});linkContainerLinks=document.createElement("div");linkContainerLinks.id="linkContainerLinks";linkContainerLinks.className="floatingDivContent";linkContainer.appendChild(linkContainerLinks);}
else{$('linkContainer').style.left="250px";$('linkContainer').style.top="100px";}
new Ajax.Updater('linkContainerLinks','/OPO/admin.php?action=getAllLinks&p=1&'+sessionName+'='+sessionId);};admin.prototype.listLinkChangePage=function(p){new Ajax.Updater('linkContainerLinks','/OPO/admin.php?action=getAllLinks&p='+p+'&'+sessionName+'='+sessionId);};admin.prototype.resetListLink=function(){if($('linkContainer')!=null){$('linkContainer').remove();}};admin.prototype.positionTarget=function(){this.nbMapMove++;if($('centerView')!=null){$('centerView').remove();}
var tip=document.createElement("div");tip.innerHTML="<img style='position : relative;' src='/OPO/images/cible.png'/>";tip.id="centerView";var centerPos=this.kaMap.getCenter();var xOffset=-10;var yOffset=-10;var top=$('viewport').clientHeight/2+yOffset;var left=$('viewport').clientWidth/2+xOffset;tip.style.position='absolute';tip.style.top=top+"px";tip.style.left=left+"px";tip.style.zIndex="30";tip.style.width="20px";$('viewport').appendChild(tip);};admin.prototype.saveNewLink=function(){var parameters=new Object;var t=this;parameters.action='saveNewLink';eval('parameters.'+sessionName+'=\''+sessionId+'\'');var centerPos=this.kaMap.getCenter();var centerPosGeom=this.kaMap.pixToGeo(-centerPos[0],-centerPos[1]);parameters.centerX=centerPosGeom[0];parameters.centerY=centerPosGeom[1];parameters.zoom=this.kaMap.getCurrentScale();$('adminLinkForm').request({parameters:parameters,onComplete:t.saveNewLinkCallBack});};admin.prototype.saveNewLinkCallBack=function(result){if(result.responseText=="error"){alert(tra['admin_newLink_error']);}
else{$('poiInfoContainer').innerHTML=result.responseText;if($('centerView')!=null){$('centerView').remove();}
$('keymap').style.display='';this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);}};admin.prototype.resetNewLink=function(){var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
if($('centerView')!=null){$('centerView').remove();}
this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';};admin.prototype.modifyGastro=function(id){var t=this;if($('modifyGastro')==null){var linkContainer=document.createElement("div");linkContainer.id="modifyGastro";linkContainer.className="floatingDiv";linkContainer.style.zIndex="1000";var linkContainerHandle=document.createElement("div");linkContainerHandle.id="modifyGastroHandle";linkContainerHandle.className="floatingDivHandle";linkContainerHandle.innerHTML=tra['admin_gastroModify'];linkContainer.appendChild(linkContainerHandle);document.body.appendChild(linkContainer);var img=document.createElement("img");linkContainerHandle.appendChild(img);img.src="/OPO/images/popUpSchliessen.gif";img.onclick=function(){linkContainerDrag.destroy();t.resetModifyGastro();};linkContainerDrag=new Draggable(linkContainer,{handle:'modifyGastroHandle'});linkContainerLinks=document.createElement("div");linkContainerLinks.id="modifyGastroLinks";linkContainerLinks.className="floatingDivContent";linkContainer.appendChild(linkContainerLinks);}
else{$('modifyGastro').style.left="250px";$('modifyGastro').style.top="100px";}
new Ajax.Updater('modifyGastroLinks','/OPO/adminGastro.php?id='+id+'&'+sessionName+'='+sessionId);};admin.prototype.modifyGastroCheckAndSend=function(idResto){$("modifyResto_loading").style.display="inline";var form=$('modifyRestoForm');var fields=["name","titel","street","zipcity_zip","zipcity_city","zipcity_ortid","tel1","tel2","fax","url","e_mail","remarque"];var params="id="+idResto;for(var i=0;i<fields.length;i++){if(eval("!form."+fields[i]+".disabled"))
params+="&"+fields[i]+"="+encodeURI(eval("form."+fields[i]+".value"));}
var checks=["box_cat108","box_cat105","box_cat101","box_cat109","box_cat103","box_cat106","box_cat102","box_cat107","box_cat104"];var checks2=["box_cuisine_1","box_cuisine_2","box_cuisine_3","box_cuisine_4","box_cuisine_5","box_cuisine_6","box_cuisine_7","box_cuisine_8","box_cuisine_9","box_cuisine_10"];var types="";var types2="";for(var i=0;i<checks.length;i++){if(eval("!form."+fields[i]+".disabled")){if(eval("form."+checks[i]+".checked")){types+=checks[i].replace(/box_cat10/,"")+",";}}}
for(var i=0;i<checks2.length;i++){if(eval("!form."+fields[i]+".disabled")){if(eval("form."+checks2[i]+".checked")){types2+=checks2[i].replace(/box_cuisine_/,"")+",";}}}
types=types.replace(/,$/,"");if(types!="")
params+="&category="+types;types2=types2.replace(/,$/,"");if(types2!="")
params+="&cuisine="+types2;if(!form.placesAssises.disabled)
params+="&pl_assises="+form.placesAssises.value;var form=$('modifyRestoForm');if(form['posStatus'].value==1){params+="&coordx="+form['locateX'].value+"&coordy="+form['locateY'].value;}
if(typeof sessionId!="undefined"&&sessionId!=null){params+="&"+sessionName+"="+sessionId;}
params+="&debug=true";url="/OPO/adminGastroSave.php";new Ajax.Request(url,{onSuccess:this.modifyGastroSendCallback.bindAsEventListener(this),method:"post",parameters:params});};admin.prototype.modifyGastroSendCallback=function(trsp){if(trsp.responseText.match(/^ok/)!=null){var newContent="<div style='padding:10px'>";newContent+="<h3>"+tra['demandeDeCorrection']+"</h3>";newContent+=tra['envoyeMerci']+"<br><br>";newContent+="<input type='button' class='gastroButton' value='"+tra['general_fermer']+"' onclick='myKaMap.admin.resetModifyGastro()' />";newContent+="</div>";$("modifyGastroLinks").innerHTML=newContent;}
else{var newContent="<div style='padding:10px'>";newContent+="<h3>"+tra['demandeDeCorrection']+"</h3>";newContent+="error<br><br>";newContent+="<input type='button' class='gastroButton' value='"+tra['general_fermer']+"' onclick='myKaMap.admin.resetModifyGastro()' />";newContent+="</div>";$("modifyGastroLinks").innerHTML=newContent;}};admin.prototype.modifyGastroDefinePosition=function(){var t=this;var form=$('modifyRestoForm');var input1=form['locateX'];var input2=form['locateY'];var x=$F(input1);var y=$F(input2);$('modifyGastro').style.display='none';this.kaMap.zoomTo(x,y,6000);this.nbMapMove=0;this.positionTarget();this.kaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);var definePositionContainer=document.createElement("div");definePositionContainer.id="definePositionContainer";definePositionContainer.innerHTML=tra['admin_modifyGastroValidatePosition'];definePositionContainer.onclick=function(){t.modifyGastroPositionUpdated()};document.body.appendChild(definePositionContainer);};admin.prototype.modifyGastroPositionUpdated=function(){var center=this.kaMap.getCenter();var centerGeo=this.kaMap.pixToGeo(center[0],center[1]);this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';$('definePositionContainer').remove();if($('centerView')!=null){$('centerView').remove();}
$('modifyGastro').style.display='';centerGeo[0]=-1*parseInt(centerGeo[0]);centerGeo[1]=-1*parseInt(centerGeo[1]);var form=$('modifyRestoForm');var input1=form['locateX'];var input2=form['locateY'];var input3=form['posStatus'];input1.value=centerGeo[0];input2.value=centerGeo[1];input3.value='1';$('newRestoPosition').style.display='';};admin.prototype.resetGastroPosition=function(){if($('modifyRestoForm')!=null){var form=$('modifyRestoForm');var input1=form['locateX'];var input2=form['locateY'];var input3=form['posStatus'];var input4=form['origLocateX'];var input5=form['origLocateY'];input1.value=input4.value;input2.value=input5.value;input3.value='0';$('newRestoPosition').style.display='none';}
this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';};admin.prototype.modifyGastroDisableForm=function(elem){var formElems=$('modifyRestoForm').elements;for(i=0;i<formElems.length;i++){formElems[i].disabled=elem.checked;}};admin.prototype.resetModifyGastro=function(){if($('centerView')!=null){$('centerView').remove();}
if($('modifyGastro')!=null){document.body.removeChild($('modifyGastro'));}};admin.prototype.account=function(id){var t=this;var forceparent='';if(arguments.length>1){forceparent=arguments[1];}
if(forceparent==''){if($('accountDiv')!=null){this.resetAccountDiv();}
if($('accountDiv')==null){var accountContainer=document.createElement("div");accountContainer.id="accountDiv";accountContainer.className="floatingDiv";accountContainer.style.zIndex="1000";var accountContainerHandle=document.createElement("div");accountContainerHandle.id="accountDivHandle";accountContainerHandle.className="floatingDivHandle";if(id==this.authuserid){accountContainerHandle.innerHTML=tra['admin_myaccount'];}
else{accountContainerHandle.innerHTML=tra['admin_account'];}
accountContainer.appendChild(accountContainerHandle);document.body.appendChild(accountContainer);var img=document.createElement("img");accountContainerHandle.appendChild(img);img.src="/OPO/images/popUpSchliessen.gif";img.onclick=function(){accountContainerDrag.destroy();t.resetAccountDiv();};accountContainerDrag=new Draggable(accountContainer,{handle:'accountDivHandle'});accountContainerContent=document.createElement("div");accountContainerContent.id="accountDivContent";accountContainerContent.className="floatingDivContent";accountContainer.appendChild(accountContainerContent);}}
var accountDivContent=$('accountDivContent');var url='/OPO/admin.php?action=modifyUser&id='+id;if(forceparent!=""){url+='&forceparent='+forceparent;accountDivContent=$('modulesTD');}
url+='&'+sessionName+'='+sessionId;new Ajax.Updater(accountDivContent,url);};admin.prototype.resetAccountDiv=function(){if($('accountDiv')!=null){document.body.removeChild($('accountDiv'));}};admin.prototype.saveUser=function(){var parameters=new Object;var t=this;parameters.action='saveUser';eval('parameters.'+sessionName+'=\''+sessionId+'\'');$('adminUserForm').request({parameters:parameters,onComplete:t.saveUserCallBack});};admin.prototype.saveUserCallBack=function(result){if(result.responseText=="error"){alert(tra['admin_newLink_error']);}
else{$('accountDivContent').innerHTML=result.responseText;}};admin.prototype.genPass=function(){new Ajax.Request('/OPO/admin.php?action=genPass',{onSuccess:function(trsp){var form=$('adminUserForm');form['password'].value=trsp.responseText;}});};admin.prototype.resetListAccountDiv=function(){if($('listAccountDiv')!=null){document.body.removeChild($('listAccountDiv'));}};admin.prototype.listUsers=function(){var t=this;if($('listAccountDiv')==null){var listAccountDiv=document.createElement("div");listAccountDiv.id="listAccountDiv";listAccountDiv.className="floatingDiv";listAccountDiv.style.zIndex="999";var listAccountDivHandle=document.createElement("div");listAccountDivHandle.id="listAccountDivHandle";listAccountDivHandle.className="floatingDivHandle";listAccountDivHandle.innerHTML=tra['admin_account'];listAccountDiv.appendChild(listAccountDivHandle);document.body.appendChild(listAccountDiv);var img=document.createElement("img");listAccountDivHandle.appendChild(img);img.src="/OPO/images/popUpSchliessen.gif";img.onclick=function(){listAccountDivDrag.destroy();document.body.removeChild(listAccountDiv);};listAccountDivDrag=new Draggable(listAccountDiv,{handle:'listAccountDivHandle'});listAccountDivLinks=document.createElement("div");listAccountDivLinks.id="listAccountDivLinks";listAccountDivLinks.className="floatingDivContent";listAccountDiv.appendChild(listAccountDivLinks);}
new Ajax.Updater('listAccountDivLinks','/OPO/admin.php?action=getAllUsers&p=1&'+sessionName+'='+sessionId);};admin.prototype.modifyPOI=function(id){var t=this;var centerX=null;var centerY=null;if(arguments.length>1){centerX=arguments[1];centerY=arguments[2];}
var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var url="/OPO/admin.php?action=drawModifyPOI";if(id!=null){url+="&id="+id;}
if(centerX!=null&&centerY!=null){this.kaMap.zoomTo(centerX,centerY);}
if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;new Ajax.Updater('poiInfoContainer',url);this.nbMapMove=0;if(id==0){this.nbMapMove=1;}
this.positionTarget();this.kaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='none';};admin.prototype.deletePOI=function(id){var t=this;var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var url="/OPO/admin.php?action=drawDeletePOI";if(id!=null){url+="&id="+id;}
if(typeof sessionId!="undefined"&&sessionId!=null)
url+="&"+sessionName+"="+sessionId;new Ajax.Updater('poiInfoContainer',url);};admin.prototype.saveNewPOI=function(){var parameters=new Object;var t=this;$('adminPOIFormSubmit').disable();document.body.style.cursor='wait';parameters.action='saveNewPOI';eval('parameters.'+sessionName+'=\''+sessionId+'\'');if(this.nbMapMove>1){var centerPos=this.kaMap.getCenter();var centerPosGeom=this.kaMap.pixToGeo(-centerPos[0],-centerPos[1]);parameters.centerX=centerPosGeom[0];parameters.centerY=centerPosGeom[1];}
$('adminPOIForm').request({parameters:parameters,onComplete:t.saveNewPOICallBack});};admin.prototype.saveNewPOICallBack=function(result){document.body.style.cursor='default';if(result.responseText=="error"){alert(tra['admin_newPOI_error']);}
else{$('poiInfoContainer').innerHTML=result.responseText;if($('centerView')!=null){$('centerView').remove();}}
this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';};admin.prototype.resetNewPOI=function(){var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
if($('centerView')!=null){$('centerView').remove();}
this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this,this.positionTarget);$('keymap').style.display='';};function routingFuncs(oKaMap){this.kaMap=oKaMap;this.kaMap.routingFuncs=this;}
routingFuncs.prototype.initRouting=function(){if(typeof(foundLocationsListArray)!="undefined")
foundLocationsListArray.splice(0,foundLocationsListArray.length);if(typeof(foundLocations)!="undefined")
foundLocations.splice(0,foundLocations.length);if(typeof(locDefinitionList)!="undefined")
locDefinitionList.splice(0,locDefinitionList.length);var infoPOI=this.kaMap.getRawObject("r_goRouting").innerInfo;var dep=new Array();dep['adr']=this.kaMap.getRawObject("r_streetName").value+" "+this.kaMap.getRawObject("r_streetNo").value;dep['npa']=this.kaMap.getRawObject("r_NPA").value;dep['loc']=this.kaMap.getRawObject("r_city").value;dep['region']="";dep['pays']=this.kaMap.getRawObject("r_country").options[this.kaMap.getRawObject("r_country").selectedIndex].value;dep['coordX']='';dep['coordY']='';var arr=new Array();arr['adr']=infoPOI.NOM_RUE+infoPOI.NO_MAISON;arr['npa']=infoPOI.NPA;arr['loc']=infoPOI.LOCALITE_18;arr['region']="";arr['pays']="CHE";arr['coordX']=(typeof infoPOI.COORDX!="undefined")?infoPOI.COORDX:infoPOI.objectidx;arr['coordY']=(typeof infoPOI.COORDY!="undefined")?infoPOI.COORDY:infoPOI.objectidy;this.infoPOI=infoPOI;var res=this.getAddress(dep,"ambiguousLoc1");if(!res){alert("l'adresse "+dep['adr']+", "+dep['npa']+" "+dep['loc']+" est introuvable");return false;}
res=this.getAddress(arr,"ambiguousLoc2");if(!res){alert("l'adresse "+dep['adr']+", "+dep['npa']+" "+dep['loc']+" est introuvable");return false;}
if(this.kaMap.getRawObject("ambiguousLoc1").loc.length==1&&this.kaMap.getRawObject("ambiguousLoc2").loc.length==1){this.validateLocations();}
return;};routingFuncs.prototype.getAddress=function(input,ambi){var inputAddress=new InputAddress(input['adr'],input['loc'],input['region'],input['npa'],input['pays']);inputAddress.coordX=input['coordX'];inputAddress.coordY=input['coordY'];searchAddresse(inputAddress,0,ambi);if(foundLocationsListArray!=null&&foundLocationsListArray.length>0){if(foundLocationsListArray[0].size==0){alert("no result");return false;}
if(foundLocationsListArray[0].size==1){this.kaMap.getRawObject(ambi).loc=foundLocationsListArray[0].foundLocations;return true;}
if(foundLocationsListArray[0].size>1){this.kaMap.getRawObject(ambi).loc=foundLocationsListArray[0].foundLocations;this.displayChoicesForLocation();return true;}}
else{return false;}};routingFuncs.prototype.displayChoicesForLocation=function(){this.kaMap.getRawObject("ambiguousLocationsDiv").style.display="block";this.kaMap.getRawObject("r_table1").style.display="none";this.kaMap.getRawObject("r_table2").style.display="none";};routingFuncs.prototype.validateLocations=function(){addLocDefinition(this.kaMap.getRawObject("ambiguousLoc1").loc[this.kaMap.getRawObject("ambiguousLoc1").selectedIndex].locDesc.locid,'StopoversTable');addLocDefinition(this.kaMap.getRawObject("ambiguousLoc2").loc[this.kaMap.getRawObject("ambiguousLoc2").selectedIndex].locDesc.locid,'StopoversTable');this.kaMap.getRawObject("ambiguousLocationsDiv").style.display="none";this.kaMap.getRawObject("r_table1").style.display="block";this.kaMap.getRawObject("r_table2").style.display="block";this.kaMap.getRawObject("routingDiv").style.display="none";this.kaMap.getRawObject("sablier1").style.display="block";this.getRoute();};routingFuncs.prototype.getRoute=function(){var d=new Date();var jour=d.getDate();var mois=d.getMonth()+1;var annee=d.getYear()+1900;if(annee>3000)
annee=annee-1900;var itiDate=jour+"/"+mois+"/"+annee;var vehicleType=0;var itiType=0;var favourMotorways=false;var avoidCrossingBorders=false;var avoidTolls=false;var avoidRoadTaxAreas=false;var avoidOffroadConnections=false;var avoidMountainPass=false;var itiPref=new ItineraryPreferences(favourMotorways,avoidCrossingBorders,avoidTolls,avoidRoadTaxAreas,avoidOffroadConnections,avoidMountainPass);var fuelCost=new Cost("","");var fuelConsumption=new Array();fuelConsumption[fuelConsumption.length]="";fuelConsumption[fuelConsumption.length]="";fuelConsumption[fuelConsumption.length]="";var itiOptions=new ItineraryOptions(itiDate,vehicleType,itiType,itiPref,fuelCost,fuelConsumption);var detailLevel=1;switch(appLanguage){case"fr":var language="fra";break;case"de":var language="deu";break;case"it":var language="ita";break;case"en":var language="eng";break;}
var instructionsFormat=0;var tollCategory=1;var presentationOptions=new ExtendedPresentationOptions(detailLevel,language,instructionsFormat,tollCategory);var responseElts=3;var mapDefCalc=1;var mainMapWidth=600;var mainMapHeight=600;var blocMapWidth=200;var blocMapHeight=200;var responseOptions=new ResponseOptions(responseElts,mapDefCalc,mainMapWidth,mainMapHeight,blocMapWidth,blocMapHeight);var itiRequest=new ItineraryRequest(locDefinitionList,itiOptions,presentationOptions,responseOptions);if((vehicleType=="2")||(vehicleType=="3")){routeCalculation_getRouteNonMotorized(itiRequest);}
else{routeCalculation_getRoute(itiRequest);}};routingFuncs.prototype.routingCallback=function(calculatedRoute,itiRequest){locDefinitionList.splice(0,locDefinitionList.length);if((typeof(calculatedRoute)!="undefined")&&(calculatedRoute!=null)){if(calculatedRoute.roadmap!=null){this.itiHtmlCode=calculatedRoute.roadmap;}
if(calculatedRoute.mapId!=null){this.getItineraryMap(calculatedRoute.mapId,itiRequest.responseOptions.mainMapWidth,itiRequest.responseOptions.mainMapHeight,calculatedRoute.ititrace);}}};routingFuncs.prototype.getItineraryMap=function(mapId,mapWidth,mapHeight,oititraceList){ititraceList=oititraceList;mapManagement_getMapByID(mapId,mapWidth,mapHeight,null,0,true,null,null,oititraceList);};routingFuncs.prototype.getGeneratedMap=function(map){this.kaMap.getRawObject("sablier1").style.display="none";var VMPopUp=new kaMapPopUp(this.kaMap,"VMPopUp",15);var imgUrl=map.mapURL;var descrIti=this.itiHtmlCode.replace(/src=\"img\/iti/g,"src=\"/OPO/tools/MichelinRoutingAPI/img/iti");var winH=getInsideWindowHeight();var height=winH-15-80;var widthTitle=800;if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){widthTitle=816;}
var content="<div class='title' style='background:rgb(102,115,175); color:white;font-family:arial; position:relative;width:"+widthTitle+"px'><span style='margin-left:5px'>"+tra['routing_itineraire']+"</span><a href='javascript:myKaMap.getRawObject(\"mainContainer\").style.display=\"block\"; myKaMap.kaMapPopUp.destroyKaMapPopUp()'><img style='border:none; position:absolute; right:3px; top:2px; width:14px; height:14px;' src='/OPO/images/popUpSchliessen.gif'></a></div>";content+="<div id='VMItinerary' style='height:"+height+"px;'>";content+="<div id='mapContainer'>";content+="<img id='dynCarte' src='"+imgUrl+"'>";if(typeof this.infoPOI.NOM!="undefined"||typeof this.infoPOI.LOCALITE_18!="undefined"){content+="<div id='detailsPOI'>";content+="<ins>"+tra['routing_summary_destination']+"</ins><br>";if(typeof this.infoPOI.NOM!=undefined)
content+="<strong>"+this.infoPOI.NOM+"</strong><br>";if(typeof this.infoPOI.NOM_RUE!="undefined"&&typeof this.infoPOI.NO_MAISON!="undefined")
content+=this.infoPOI.NOM_RUE+" "+this.infoPOI.NO_MAISON+"<br>";if(typeof this.infoPOI.NPA!="undefined"&&typeof this.infoPOI.LOCALITE_18!="undefined")
content+=this.infoPOI.NPA+" "+this.infoPOI.LOCALITE_18;content+="</div>";}
content+="<a id='r_print' href='javascript:myKaMap.routingFuncs.print()'>"+tra['general_imprimer']+"&nbsp;";content+="<img style='border:none' src='/OPO/images/printit.png'></a><br>";content+="</div>";content+="<div id='itiContainer'>"+descrIti+"</div>";content+="</div>";VMPopUp.setText(content);};routingFuncs.prototype.print=function(){this.kaMap.getRawObject("mainContainer").style.display="none";window.print();}
var isCSS,isW3C,isIE4,isNN4;function initDHTMLAPI(){if(document.images){isCSS=(document.body&&document.body.style)?true:false;isW3C=(isCSS&&document.getElementById)?true:false;isIE4=(isCSS&&document.all)?true:false;isNN4=(document.layers)?true:false;isIE6CSS=(document.compatMode&&document.compatMode.indexOf("CSS1")>=0)?true:false;}}
function seekLayer(doc,name){var theObj;for(var i=0;i<doc.layers.length;i++){if(doc.layers[i].name==name){theObj=doc.layers[i];break;}
if(doc.layers[i].document.layers.length>0){theObj=seekLayer(document.layers[i].document,name);}}
return theObj;}
function getRawObject(obj){var theObj;if(typeof obj=="string"){if(isW3C){theObj=document.getElementById(obj);}else if(isIE4){theObj=document.all(obj);}else if(isNN4){theObj=seekLayer(document,obj);}}else{theObj=obj;}
return theObj;}
function getObject(obj){var theObj=getRawObject(obj);if(theObj&&isCSS){theObj=theObj.style;}
return theObj;}
function shiftTo(obj,x,y){var theObj=getObject(obj);if(theObj){if(isCSS){var units=(typeof theObj.left=="string")?"px":0;theObj.left=x+units;theObj.top=y+units;}else if(isNN4){theObj.moveTo(x,y);}}}
function shiftBy(obj,deltaX,deltaY){var theObj=getObject(obj);if(theObj){if(isCSS){var units=(typeof theObj.left=="string")?"px":0;theObj.left=getObjectLeft(obj)+deltaX+units;theObj.top=getObjectTop(obj)+deltaY+units;}else if(isNN4){theObj.moveBy(deltaX,deltaY);}}}
function setZIndex(obj,zOrder){var theObj=getObject(obj);if(theObj){theObj.zIndex=zOrder;}}
function setBGColor(obj,color){var theObj=getObject(obj);if(theObj){if(isNN4){theObj.bgColor=color;}else if(isCSS){theObj.backgroundColor=color;}}}
function show(obj){var theObj=getObject(obj);if(theObj){theObj.visibility="visible";}}
function hide(obj){var theObj=getObject(obj);if(theObj){theObj.visibility="hidden";}}
function getObjectLeft(obj){var elem=getRawObject(obj);var result=0;if(document.defaultView){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("left");}else if(elem.currentStyle){result=elem.currentStyle.left;}else if(elem.style){result=elem.style.left;}else if(isNN4){result=elem.left;}
return parseInt(result);}
function getObjectTop(obj){var elem=getRawObject(obj);var result=0;if(document.defaultView){var style=document.defaultView;var cssDecl=style.getComputedStyle(elem,"");result=cssDecl.getPropertyValue("top");}else if(elem.currentStyle){result=elem.currentStyle.top;}else if(elem.style){result=elem.style.top;}else if(isNN4){result=elem.top;}
return parseInt(result);}
function getObjectWidth(obj){var elem=getRawObject(obj);var result=0;if(elem.offsetWidth){result=elem.offsetWidth;}else if(elem.clip&&elem.clip.width){result=elem.clip.width;}else if(elem.style&&elem.style.pixelWidth){result=elem.style.pixelWidth;}
return parseInt(result);}
function getObjectHeight(obj){var elem=getRawObject(obj);var result=0;if(elem.offsetHeight){result=elem.offsetHeight;}else if(elem.clip&&elem.clip.height){result=elem.clip.height;}else if(elem.style&&elem.style.pixelHeight){result=elem.style.pixelHeight;}
return parseInt(result);}
function getInsideWindowWidth(){if(window.innerWidth){return window.innerWidth;}else if(isIE6CSS){return document.body.parentElement.clientWidth;}else if(document.body&&document.body.clientWidth){return document.body.clientWidth;}
return 0;}
function getInsideWindowHeight(){if(window.innerHeight){return window.innerHeight;}else if(isIE6CSS){return document.body.parentElement.clientHeight;}else if(document.body&&document.body.clientHeight){return document.body.clientHeight;}
return 0;}
function interact(oKaMap){this.kaMap=oKaMap;this.kaMap.interact=this;this.POIselectBox=this.kaMap.getRawObject("selectBoxPOI");this.firmSelectBox=this.kaMap.getRawObject("selectBoxFirms");this.gastroSelectBox=this.kaMap.getRawObject("selectBoxGastro");this.chaNameInput=this.kaMap.getRawObject("chaname");this.initInteraction();}
interact.prototype.callPHP=function(paramsString,callbackFunction){var url="/OPO/fetchdata.php?"+sessionName+"="+sessionId+"&commune="+dataOPO['NAME']+"&"+paramsString;call(url,this,callbackFunction);};interact.prototype.noaccent=function(chaine){temp=chaine.replace(/[���]/gi,"a");temp=temp.replace(/[����]/gi,"e");temp=temp.replace(/[��]/gi,"i");temp=temp.replace(/[��]/gi,"o");temp=temp.replace(/[���]/gi,"u");return temp;};interact.prototype.initInteraction=function(){var otherName="";if($d(dataOPO['CITIES'])&&dataOPO['CITIES'].length>10){var cityCommune=[];for(var i=0;i<dataOPO['CITIES'].length;i++){cityCommune.push(dataOPO['CITIES'][i]['ZIP']+" "+dataOPO['CITIES'][i]['CITY']);}
new Autocompleter.Local("adr_ville","cityName_list",cityCommune,{});}};interact.prototype.tipItem=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;if(this.oldselected){this.kaMap.getRawObject(this.oldselected).className=this.oldclassname;}
this.oldselected=src.identifier;this.oldclassname=this.kaMap.getRawObject(src.identifier).className;this.kaMap.getRawObject(src.identifier).className="rowselected";if(this.canvas){this.kaMap.removeDrawingCanvas(this.canvas);}
var x=parseInt(info.COORDX);var y=parseInt(info.COORDY);if(!x||!y){x=parseInt(info.objectidx);y=parseInt(info.objectidy);}
this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.admin,this.kaMap.admin.positionTarget);if($('centerView')!=null){$('centerView').remove();}
var objExtents=new Array;objExtents[0]=x-2000;objExtents[1]=y-2000;objExtents[2]=x+2000;objExtents[3]=y+2000;var maxExtentsNew=new Array;maxExtentsNew[0]=[objExtents[0],dataOPO['LEFT']].min();maxExtentsNew[1]=[objExtents[1],dataOPO['BOTTOM']].min();maxExtentsNew[2]=[objExtents[2],dataOPO['RIGHT']].max();maxExtentsNew[3]=[objExtents[3],dataOPO['TOP']].max();this.kaMap.getCurrentMap().setMaxExtents(maxExtentsNew[0],maxExtentsNew[1],maxExtentsNew[2],maxExtentsNew[3]);var scale=6000;if(info.scale){scale=info.scale;}
this.kaMap.zoomTo(x,y,scale);this.canvas=this.kaMap.createDrawingCanvas(30);var tip=document.createElement("div");tip.innerHTML="<img style='position : relative; top : -7px; left : -7px;' src='/OPO/images/tip.gif'/>";this.kaMap.addObjectGeo(this.canvas,x,y,tip);}
interact.prototype.showActions=function(typeObj,data){var t=this;this.hideActions();var smallinfo=new Object();smallinfo.objclass=typeObj;smallinfo.cattitle=data.TYP;if(typeObj=='adr')
smallinfo.ID_POINT_INTERET=data.id_objet;else
smallinfo.ID_POINT_INTERET=data.ID_POINT_INTERET;smallinfo.PLACE=dataOPO['NAME'];var printItImage=this.kaMap.getRawObject("printItAction");printItImage.onclick=function(){myPrint(smallinfo)};printItImage.style.display="block";if(dataOPO['ROUTING']=="1"){var routeItImage=this.kaMap.getRawObject("routeItAction");routeItImage.innerInfo=data;routeItImage.onclick=function(e){t.showRouting(e)};routeItImage.style.display="block";}
var hasadr=false;var trainItImage=this.kaMap.getRawObject("trainItAction");var sbbContainer=this.kaMap.getRawObject("sbbContainer");trainItImage.style.display="none";if(typeObj=="adr"){if(typeof(data.localite)!="undefined"&&data.localite!="")hasadr=true;}
else{if(typeof(data.LOCALITE_18)!="undefined"&&data.LOCALITE_18!="")hasadr=true;}
if(hasadr){trainItImage.innerInfo=data;trainItImage.onclick=function(e){t.showSBBPopUp(e)};trainItImage.style.display="block";}
sbbContainer.style.display='none';$('SMLayer').style.display='none';};interact.prototype.hideActions=function(){this.kaMap.getRawObject("routeItAction").style.display="none";var printItImage=this.kaMap.getRawObject("printItAction");printItImage.onclick=function(){myPrint(null)};this.kaMap.getRawObject("trainItAction").style.display="none";$('SMLayer').style.display='';}
interact.prototype.showKMLDownloadPopUp=function(){var KMLPopUp=new kaMapPopUp(this.kaMap,"KMLPopUp");var KMLurl='/OPO/tools/googleearth/kml.php?name='+dataOPO['NAME'];KMLContent="<div style='text-align:left; font-size:11px;position:relative; height:18px; padding-top:3px;width:100%; background:rgb(102,115,175); color:white'><span style='margin-left:3px;'>"+tra['kml_title']+"</span><a href='javascript:myKaMap.kaMapPopUp.destroyKaMapPopUp()' style='border:none'><img style='border:none; position:absolute; right:3px; top:4px;' src='/OPO/images/popUpSchliessen.gif'></a></div>";KMLContent+="<div align='center'><table width='350' style='font-size:11px'><tr>";KMLContent+="<td align='center' height='70' valign='middle'><img src='/OPO/images/googleEarth.gif'></td></tr>";KMLContent+="<tr><td align='center'>"+tra['ge_install'];KMLContent+="<div align='center'><a href='http://earth.google.com/download-earth.html' target='_new'>"+tra['ge_dwl']+"</a></div></td></tr>";KMLContent+="<tr><td align=center><br><a href='"+KMLurl+"'>";KMLContent+=tra['gf_dwl']+"</a></td></tr><tr><td align='center'></td></tr></table></div>";KMLPopUp.setText(KMLContent);KMLPopUp.onclick=function(){KMLPopUp.destroyKaMapPopUp();};};interact.prototype.showRouting=function(e){e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var infoPOI=src.innerInfo;var rDiv=$("routingDiv");var ambDiv=$("ambiguousLocationsDiv");var SBBDiv=$("sbbContainer");SBBDiv.style.display="none";SBBDiv.innerHTML="";if(rDiv.style.display=="block"||ambDiv.style.display=="block"){ambDiv.style.display="none";rDiv.style.display="none";$("keymap").style.display='';return;}
rDiv.style.display="block";$("r_table1").style.display="block";$("r_table2").style.display="block";ambDiv.style.display="none";$("r_goRouting").innerInfo=infoPOI;if($("firmLogo")&&$("firmLogo").style.display!="none")
this.hideFirmLogo($("firmLogo").toggler);$("keymap").style.display='none';};interact.prototype.openHikingPopUp=function(){var hikePopUp=new kaMapPopUp(this.kaMap,"hikePopUp",15);var widthTitle=650;var winH=getInsideWindowHeight();var height=winH-15-80;var content="<div style='background:rgb(102,115,175); color:white;font-family:arial; position:relative;width:"+widthTitle+"px'><span style='margin-left:5px'>"+tra['hiking_title']+"</span><a href='javascript:myKaMap.kaMapPopUp.destroyKaMapPopUp()'><img style='border:none; position:absolute; right:3px; top:2px; width:14px; height:14px;' src='/OPO/images/popUpSchliessen.gif'></a></div>";content+="<iframe src="+dataOPO['WANDERUNG_LINK']+" width='650' height="+height+" scrolling='auto' frameborder='0'></iframe>";hikePopUp.setText(content);};interact.prototype.removeAllResults=function(){this.POIremoveResults();this.firmRemoveResults();this.gastroRemoveResults();this.chaletRemoveResults();this.addressRemoveResults();};interact.prototype.POIselected=function(){var selectedOption=this.POIselectBox.options[this.POIselectBox.options.selectedIndex].value;if(selectedOption!=-1){var params="action=getPOI&type="+selectedOption;$("POIsablier").style.display="block";this.callPHP(params,this.POIselectedCallback);}}
interact.prototype.POIselectedCallback=function(query){var directShow=null;$("POIsablier").style.display="none";var t=this;try{eval(query);}
catch(e){alert("eval failed");}
this.oldselected=null;this.POIremoveResults();if(data==null)
return;this.firmRemoveResults();this.firmResetFields();this.gastroRemoveResults();this.gastroResetFields();this.chaletRemoveResults();this.chaletResetFields();this.addressRemoveResults();this.addressResetFields();var nbPages=Math.ceil(data.length/10);this.poiNbPages=nbPages;for(var k=0;k<nbPages;k++){var container=document.createElement("div");$("poiSearchDiv").appendChild(container);container.id="poiSearchContainer"+k;container.style.display="none";var table=document.createElement("table");container.appendChild(table);table.className="poiSearchDiv_ResultTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var upperBound=((k+1)*10>data.length)?data.length:(k+1)*10;for(var i=k*10;i<upperBound;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");td.className="row"+(i%2);td.id="poirow"+i;tr.appendChild(td);var a=document.createElement("a");td.appendChild(a);a.innerHTML=data[i].NOM;if(dataOPO['MULTICITY']){a.innerHTML+='<br>'+data[i].NPA+' '+data[i].LOCALITE_18;}
a.innerInfo=data[i];a.dataType="POI";a.identifier="poirow"+i;a.onclick=function(e){t.tipItem(e);t.displayPOIinfosOnTabRight(e);return false;};a.href="#";a.page=k;if(data[i].showme==1){directShow=a;}}}
if(data.length==1&&!directShow){this.tipItem(a);this.displayPOIinfosOnTabRight(a);}
if(nbPages>1){var index=document.createElement("div");$("poiSearchDiv").appendChild(index);index.id="poiIndex";}
if(directShow){this.activePoiPage=directShow.page;this.activatePoiPage(directShow.page);this.tipItem(directShow);this.displayPOIinfosOnTabRight(directShow);}
else{this.activePoiPage=0;this.activatePoiPage(0);}}
interact.prototype.activatePoiPage=function(no){$("poiSearchContainer"+this.activePoiPage).style.display="none";this.drawPages('poiIndex','activatePoiPage',this.poiNbPages,no);$("poiSearchContainer"+no).style.display="block";this.activePoiPage=no;}
interact.prototype.POIremoveResults=function(){var i=0;while($("poiSearchContainer"+i)){$("poiSearchDiv").removeChild($("poiSearchContainer"+i));i++;}
if($("poiIndex")){$("poiSearchDiv").removeChild($("poiIndex"));}}
interact.prototype.POIresetFields=function(){this.POIselectBox.options[0].selected=true;}
interact.prototype.displayPOIinfosOnTabRight=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;var dataType=src.dataType;var infoContainer=$("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var selectedOptionLabel=this.POIselectBox.options[this.POIselectBox.options.selectedIndex].innerHTML;info.TYP=selectedOptionLabel;this.showActions('poi',info);var infoContainerContent="<table cellspacing='0' class='subtitle'><tr><td style='vertical-align:middle;width:100%'>&nbsp;&nbsp;"+selectedOptionLabel+"</td>";if(this.kaMap.admin.modulesRights!=null&&typeof(this.kaMap.admin.modulesRights[3])!="undefined"){if(this.kaMap.admin.modulesRights[3].mod>=1){var infoTXT='';infoTXT=tra['demandeDeCorrection'];if(this.kaMap.admin.modulesRights[3].mod==2){infoTXT=tra['admin_correction'];}
infoContainerContent+="<td style='text-align:right'><img alt='"+infoTXT+"' title='"+infoTXT+"' src='/OPO/images/modifyPOI.png' hspace='2' style='cursor:pointer' onclick='myKaMap.admin.modifyPOI("+info.ID_POINT_INTERET+")'></td>";}
if(this.kaMap.admin.modulesRights[3].del>=1){var infoTXT='';infoTXT=tra['admin_demandeDeSuppression'];if(this.kaMap.admin.modulesRights[3].del==2){infoTXT=tra['admin_suppression'];}
infoContainerContent+="<td style='text-align:right'><img alt='"+infoTXT+"' title='"+infoTXT+"' src='/OPO/images/deletePOI.png' hspace='2' style='cursor:pointer' onclick='myKaMap.admin.deletePOI("+info.ID_POINT_INTERET+")'></td>";}}
infoContainerContent+="</tr></table>";infoContainer.innerHTML=infoContainerContent;var table=document.createElement("table");infoContainer.appendChild(table);table.className="table_detailsPOI";var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<strong>"+info.NOM+"</strong>";if(info.CATEGORY==41){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=this.SBBPopUpContent(info.NOM);$('cff_dest').searchType=1;$('cff_dep').searchType=7;}
else{var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NOM_RUE+" "+info.NO_MAISON;var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NPA+" "+info.LOCALITE_18;if(info.NO_TEL!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NO_TEL;}
if(info.E_MAIL!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.E_MAIL;}
if(info.URL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="'+info.URL+'" target="_blank">'+tra['general_website']+'</a>';}
if((dataOPO['MAP_IT']||this.kaMap.admin.authenticated==true)&&dataLink['isdirect']!=1){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="javascript:void(0)" onclick="$(\'poiDirectLink\').toggle()">'+tra['lien_direct']+'</a>';td.innerHTML+='<div id="poiDirectLink" style="display:none">http://'+top.location.host+'/'+dataOPO['NAME']+'/p/'+info.ID_POINT_INTERET+'</div>';}}}
interact.prototype.SBBPopUpContent=function(name){var HTMLContent='<table border="0" cellspacing="3" cellpadding="0"><tbody>';HTMLContent+='<tr><td colspan="3" style=""><img src="/OPO/images/logo-sbb.gif" style="padding:2px 0px 3px 0px;"></td></tr>';HTMLContent+='<tr>';HTMLContent+='<td>'+tra['routing_summary_departure']+'</td>';HTMLContent+='<td><input id="cff_dep" type="text" value="" style="width:120px; font-family:arial,helvetica; font-size:11px"></td>';HTMLContent+='<td rowspan="2"><img src="/OPO/images/reverse.gif" style="z-index:12" onClick="myKaMap.interact.switchStations(\'cff_dep\',\'cff_dest\')"></td>';HTMLContent+='</tr>';HTMLContent+='<tr>';HTMLContent+='<td>'+tra['routing_summary_destination']+'</td>';HTMLContent+='<td><input id="cff_dest" type="text" value="'+name+'" disabled=true style="width:120px; font-family:arial,helvetica; font-size:11px"></td>';HTMLContent+='</tr>';HTMLContent+='<tr>';HTMLContent+='<td></td>';HTMLContent+='<td><input type="button" value="'+tra['general_rechercher']+'" style="background:rgb(102,115,175); color:white; font-family:Arial,helvetica; font-size:75%;" onClick="myKaMap.interact.showCFFTimeTable(\'cff_dep\',\'cff_dest\');"></td>';HTMLContent+='</tr>';HTMLContent+='</tbody></table>';return HTMLContent;};interact.prototype.showSBBPopUp=function(e){e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var infoPOI=src.innerInfo;var sbbDIV=$("sbbContainer");var rDiv=$("routingDiv");var ambDiv=$("ambiguousLocationsDiv");rDiv.style.display='none';ambDiv.style.display='none';if(sbbDIV.style.display=='block'){sbbDIV.style.display='none';}
else{if(infoPOI.TYP=='Adresse'){sbbsearch=infoPOI['npa']+' '+infoPOI['localite'];if(infoPOI['rue']!=''){sbbsearch+=','+infoPOI['rue'];if(infoPOI['numero']!=""){sbbsearch+=','+infoPOI['numero'];}}}
else{var sbbsearch=infoPOI['NPA']+' '+infoPOI['LOCALITE_18'];if(infoPOI['NOM_RUE']!=''){sbbsearch+=','+infoPOI['NOM_RUE'];if(infoPOI['NO_MAISON']!=""){sbbsearch+=','+infoPOI['NO_MAISON'];}}}
sbbDIV.innerHTML=this.SBBPopUpContent(sbbsearch);sbbDIV.style.display='block';$('cff_dest').searchType=2;$('cff_dep').searchType=7;if($("firmLogo")&&$("firmLogo").style.display!="none")
this.hideFirmLogo($("firmLogo").toggler);}};interact.prototype.switchStations=function(a,b){var tmp=document.getElementById(a).value;document.getElementById(a).value=document.getElementById(b).value;document.getElementById(b).value=tmp;tmp=document.getElementById(a).searchType;document.getElementById(a).searchType=document.getElementById(b).searchType;document.getElementById(b).searchType=tmp;if(document.getElementById(a).disabled){document.getElementById(a).disabled=false;document.getElementById(b).disabled=true;}
else{document.getElementById(a).disabled=true;document.getElementById(b).disabled=false;}};interact.prototype.showCFFTimeTable=function(a,b){var dep=document.getElementById(a).value;var dest=document.getElementById(b).value;var depSearchType=document.getElementById(a).searchType;var destSearchType=document.getElementById(b).searchType;if(appLanguage=='fr')var CFFlang='f';else if(appLanguage=='de')var CFFlang='d';else if(appLanguage=='it')var CFFlang='i';else var CFFlang='d';var url='http://fahrplan.sbb.ch/bin/query.exe/'+CFFlang+'n?REQ0JourneyStopsS0G='+dep+'&REQ0JourneyStopsS0A='+depSearchType+'&REQ0JourneyStopsZ0G=';url+=dest+'&REQ0JourneyStopsZ0A='+destSearchType+'&queryPageDisplayed=yes&REQ0JourneyStops1.0A=1&REQ0HafasSkipLongChanges=0';url+='&REQ0HafasMaxChangeTime=120&start=1';window.open(url,'pop');};interact.prototype.firmSelected=function(){var selectedOption=this.firmSelectBox.options[this.firmSelectBox.options.selectedIndex].value;if(selectedOption!=-1){var params="action=getFirm&type="+selectedOption;$("firmSablier").style.display="block";this.callPHP(params,this.firmSelectedCallback);}}
interact.prototype.firmSelectedCallback=function(query){var directShow=null;$("firmSablier").style.display="none";var t=this;try{eval(query);}
catch(e){alert("eval failed");}
this.oldselected=null;this.firmRemoveResults();if(data==null)
return;this.POIremoveResults();this.POIresetFields();this.chaletRemoveResults();this.chaletResetFields();this.addressRemoveResults();this.addressResetFields();this.gastroRemoveResults();this.gastroResetFields();var nbPages=Math.ceil(data.length/10);this.firmNbPages=nbPages;for(var k=0;k<nbPages;k++){var container=document.createElement("div");$("firmSearchDiv").appendChild(container);container.id="firmSearchContainer"+k;container.style.display="none";var table=document.createElement("table");container.appendChild(table);table.className="firmSearchDiv_ResultTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var upperBound=((k+1)*10>data.length)?data.length:(k+1)*10;for(var i=k*10;i<upperBound;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="row"+(i%2);td.id="firmrow"+i;var a=document.createElement("a");td.appendChild(a);a.innerHTML=data[i].NOM;a.innerInfo=data[i];a.identifier="firmrow"+i;a.dataType="firm";a.onclick=function(e){t.tipItem(e);t.displayFirmInfosOnTabRight(e);t.displayFirmLogo(e);return false;};a.href="#";a.page=k;if(data[i].showme==1){directShow=a;}}}
if(data.length==1&&!directShow){this.tipItem(a);this.displayFirmInfosOnTabRight(a);this.displayFirmLogo(data[0]);}
if(nbPages>1){var index=document.createElement("div");$("firmSearchDiv").appendChild(index);index.id="firmIndex";for(var i=0;i<nbPages;i++){index.innerHTML+="<a href='#' onclick='myKaMap.interact.activateFirmPage("+i+"); return false;'>"+(i+1)+"</a>&nbsp;";}}
if(directShow){this.activeFirmPage=directShow.page;this.activateFirmPage(directShow.page);this.displayFirmInfosOnTabRight(directShow);this.displayFirmLogo(directShow);this.tipItem(directShow);}
else{this.activeFirmPage=0;this.activateFirmPage(0);}}
interact.prototype.activateFirmPage=function(no){$("firmSearchContainer"+this.activeFirmPage).style.display="none";this.drawPages('firmIndex','activateFirmPage',this.addressNbPages,no);$("firmSearchContainer"+no).style.display="block";this.activeFirmPage=no;}
interact.prototype.firmRemoveResults=function(){var i=0;this.removeFirmPopUp();while($("firmSearchContainer"+i)){$("firmSearchDiv").removeChild($("firmSearchContainer"+i));i++;}
if($("firmIndex")){$("firmSearchDiv").removeChild($("firmIndex"));}}
interact.prototype.firmResetFields=function(){try{this.firmSelectBox.options[0].selected=true;}
catch(e){}}
interact.prototype.displayFirmInfosOnTabRight=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;var infoContainer=$("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var selectedOptionLabel=this.firmSelectBox.options[this.firmSelectBox.options.selectedIndex].innerHTML;info.TYP=selectedOptionLabel;this.showActions('firm',info);infoContainer.innerHTML="<table cellspacing='0' class='subtitle'><tr><td style='vertical-align:middle'>&nbsp;&nbsp;"+selectedOptionLabel+"</td></tr></table>";var table=document.createElement("table");infoContainer.appendChild(table);var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<strong>"+info.NOM+"</strong>";var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NOM_RUE+" "+info.NO_MAISON;var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NPA+" "+info.LOCALITE_18;var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NO_TEL;if(info.E_MAIL!=null&&info.EMAIL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<a href='mailto:"+info.E_MAIL+"'>"+info.E_MAIL+"</a>";}
if(info.URL!=null&&info.URL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<a href='"+info.URL+"' target='_blank'>"+tra['general_website']+"</a>";}
if(dataLink['isdirect']!=1){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="javascript:void(0)" onclick="$(\'firmsDirectLink\').toggle()">'+tra['lien_direct']+'</a>';td.innerHTML+='<div id="firmsDirectLink" style="display:none">http://'+top.location.host+'/'+dataOPO['NAME']+'/f/'+info.ID_POINT_INTERET+'</div>';}};interact.prototype.displayFirmLogo=function(e){e=(e)?e:((event)?event:null);if(typeof(e.NOM)!="undefined"){var info=e;}
else{var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;}
if(info.LOGO.length==0)
return;var container=document.createElement("div");container.style.position="relative";container.style.marginTop="10px";container.style.marginBottom="10px";container.style.background="white";container.style.textAlign="right";container.style.zIndex="5";container.style.cursor="pointer";var img=document.createElement("img");if(info.URL!=null&&info.URL!=""){var link=document.createElement("a");link.href=info.URL;link.target="_blank";container.appendChild(link);link.appendChild(img);}
else{container.appendChild(img);}
img.style.position="absolute";img.style.right="0px";img.style.top="15px";img.style.border="0px";img.src=info.LOGO;img.id="firmLogo";var toggler=document.createElement("a");container.appendChild(toggler);toggler.src="#";toggler.style.cursor="pointer";toggler.alt=tra['general_cacherLogo'];toggler.title=tra['general_cacherLogo'];toggler.className='logoToggler';toggler.style.background='url(/OPO/tools/progZoomer/images/MINUS.gif)';toggler.action="hide";toggler.image=$(img);var that=this;toggler.onclick=function(e){e=(e)?e:((event)?event:null);var elem=Event.element(e);if(elem.action=="hide")
that.hideFirmLogo(e);else
that.showFirmLogo(e);return false;};img.toggler=toggler;$("poiInfoContainer").appendChild(container);}
interact.prototype.hideFirmLogo=function(e){elem=(e)?e:((event)?event:null);if(!elem.action)
elem=Event.element(e);elem.action="show";elem.title=tra['general_montrerLogo'];elem.alt=tra['general_montrerLogo'];elem.style.background='url(/OPO/tools/progZoomer/images/PLUS.gif)';elem.image.hide();}
interact.prototype.showFirmLogo=function(e){elem=(e)?e:((event)?event:null);if(!elem.action)
elem=Event.element(e);elem.action="hide";elem.alt=tra['general_cacherLogo'];elem.title=tra['general_cacherLogo'];elem.className='logoToggler';elem.style.background='url(/OPO/tools/progZoomer/images/MINUS.gif)';elem.image.show();}
interact.prototype.displayFirmInfosInPopUp=function(e){e=(e)?e:((event)?event:null);if(typeof(e.NOM)!="undefined"){var info=e;}
else{var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;}
var viewportContainer=$("viewportContainer");var selectedOptionLabel=this.firmSelectBox.options[this.firmSelectBox.options.selectedIndex].innerHTML;var olddiv=$("firmPopUp");if(olddiv){viewportContainer.removeChild($("firmPopUp"));}
var div=document.createElement("div");viewportContainer.appendChild(div);div.id="firmPopUp";var title=document.createElement("div");div.appendChild(title);title.className="subtitle";title.style.cursor="move";title.innerHTML="<span style='padding-left:5px;position:relative; top:2px;'>"+selectedOptionLabel+"</span><span class='popUpCloser'><a href=\"#\" onClick=\"myKaMap.interact.removeFirmPopUp(); return false;\"><img style='border:none; position:absolute; right:0px; top:2px;' src='/OPO/images/popUpSchliessen.gif'></a></span>";var firmInfo=document.createElement("div");div.appendChild(firmInfo);var firmInfoHTML='<table id="firmPopUp_table" border="0" cellspacing="0" cellpadding="0">';firmInfoHTML+='<tr><td align="left" valign="top" style="padding : 10px; width : 200px">';firmInfoHTML+="<strong>"+info.NOM+"</strong><br/>";firmInfoHTML+=info.NOM_RUE+' '+info.NO_MAISON+'<br/>';firmInfoHTML+=info.NPA+' '+info.LOCALITE_18+'<br/>';if(info.NO_TEL!='')
firmInfoHTML+=info.NO_TEL+'<br/>';if(info.E_MAIL!='')
firmInfoHTML+="<a href='mailto:"+info.E_MAIL+"'>"+info.E_MAIL+"</a><br>";if(info.URL!='')
firmInfoHTML+='<a href="'+info.URL+'" target="_blank">'+tra['general_website']+'</a><br/>';firmInfoHTML+='</td><td valign="top" align="center">';if(info.LOGO!=''){if(info.URL!='')
firmInfoHTML+='<a href="'+info.URL+'" target="_blank"><img src="'+info.LOGO+'" border="0" onload="myKaMap.interact.adjustFirmPopUpWidth()"></a>';else
firmInfoHTML+='<img src="'+info.LOGO+'" onload="myKaMap.interact.adjustFirmPopUpWidth()" />';}
firmInfoHTML+='</td></tr></table>';firmInfo.innerHTML+=firmInfoHTML;firmInfo.className="content";Drag.init(title,div,null,null,null,null);div.style.top="55px";div.style.left="15px";};interact.prototype.adjustFirmPopUpWidth=function(){$("firmPopUp").style.width=this.kaMap.getObjectWidth("firmPopUp_table")+75+"px";}
interact.prototype.removeFirmPopUp=function(){var viewportContainer=$("viewportContainer");var olddiv=$("firmPopUp");if(olddiv){viewportContainer.removeChild(olddiv);}};interact.prototype.gastroSelected=function(){var selectedOption=this.gastroSelectBox.options[this.gastroSelectBox.options.selectedIndex].value;if(selectedOption!=-1){var params="action=getGastro&type="+selectedOption;$("gastroSablier").style.display="block";this.callPHP(params,this.gastroSelectedCallback);}}
interact.prototype.gastroSelectedCallback=function(query){$("gastroSablier").style.display="none";var t=this;try{eval(query);}
catch(e){alert("eval failed");}
this.oldselected=null;this.gastroRemoveResults();if(data==null)
return;this.POIremoveResults();this.POIresetFields();this.chaletRemoveResults();this.chaletResetFields();this.addressRemoveResults();this.addressResetFields();this.firmRemoveResults();this.firmResetFields();var nbPages=Math.ceil(data.length/10);this.gastroNbPages=nbPages;for(var k=0;k<nbPages;k++){var container=document.createElement("div");$("gastroSearchDiv").appendChild(container);container.id="gastroSearchContainer"+k;container.style.display="none";var table=document.createElement("table");container.appendChild(table);table.className="gastroSearchDiv_ResultTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var upperBound=((k+1)*10>data.length)?data.length:(k+1)*10;for(var i=k*10;i<upperBound;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="row"+(i%2);td.id="gastrorow"+i;var a=document.createElement("a");td.appendChild(a);a.innerHTML=data[i].NAME+' '+data[i].ZUSATZ;a.innerInfo=data[i];a.identifier="gastrorow"+i;a.dataType="gastro";a.onclick=function(e){t.tipItem(e);t.displayGastroInfosOnTabRight(e);t.displayGastroLogo(e);return false;};a.href="#";}}
if(data.length==1){this.tipItem(a);this.displayGastroInfosOnTabRight(a);this.displayGastroLogo(data[0]);}
if(nbPages>1){var index=document.createElement("div");$("gastroSearchDiv").appendChild(index);index.id="gastroIndex";for(var i=0;i<nbPages;i++){index.innerHTML+="<a href='#' onclick='myKaMap.interact.activateGastroPage("+i+"); return false;'>"+(i+1)+"</a>&nbsp;";}}
this.activeGastroPage=0;this.activateGastroPage(0);}
interact.prototype.activateGastroPage=function(no){$("gastroSearchContainer"+this.activeGastroPage).style.display="none";this.drawPages('gastroIndex','activateGastroPage',this.addressNbPages,no);$("gastroSearchContainer"+no).style.display="block";this.activeGastroPage=no;}
interact.prototype.gastroRemoveResults=function(){var i=0;this.removeGastroPopUp();while($("gastroSearchContainer"+i)){$("gastroSearchDiv").removeChild($("gastroSearchContainer"+i));i++;}
if($("gastroIndex")){$("gastroSearchDiv").removeChild($("gastroIndex"));}}
interact.prototype.gastroResetFields=function(){try{this.gastroSelectBox.options[0].selected=true;}
catch(e){}}
interact.prototype.displayGastroInfosOnTabRight=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;var infoContainer=$("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
var selectedOptionLabel=this.gastroSelectBox.options[this.gastroSelectBox.options.selectedIndex].innerHTML;info.TYP=selectedOptionLabel;this.showActions('gastro',info);infoContainer.innerHTML="<table cellspacing='0' class='subtitle'><tr><td style='vertical-align:middle'>&nbsp;&nbsp;"+selectedOptionLabel+"</td><td style='text-align:right'><img alt='"+tra['demandeDeCorrection']+"' title='"+tra['demandeDeCorrection']+"' src='/OPO/images/modifyResto.png' hspace='2' style='cursor:pointer' onclick='myKaMap.admin.modifyGastro("+info.ID_POINT_INTERET+")'></td></tr></table>";var table=document.createElement("table");infoContainer.appendChild(table);var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<strong>"+info.NAME+"</strong>";var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.ZUSATZ;var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NOM_RUE+" "+info.NO_MAISON;var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NPA+" "+info.LOCALITE_18;if(info.TEL!=null&&info.TEL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.TEL;}
if(info.EMAIL!=null&&info.EMAIL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<a href='mailto:"+info.EMAIL+"'>"+info.EMAIL+"</a>";}
if(info.cuisine.length>0){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<ul>";for(i=0;i<info.cuisine.length;i++){td.innerHTML+="<li>"+info.cuisine[i]+"</li>";}
td.innerHTML+="</ul>";}
if(info.URL!=null&&info.URL!=""){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<a href='"+info.URL+"' target='_blank'><img src=\"/OPO/images/button_gate24.gif\" border=\"0\" width=\"115\" height=\"31\"></a>";}};interact.prototype.displayGastroLogo=function(e){e=(e)?e:((event)?event:null);if(typeof(e.NAME)!="undefined"){var info=e;}
else{var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;}
if(info.LOGOA.length==0)
return;var container=document.createElement("div");container.style.position="relative";container.style.marginTop="10px";container.style.marginBottom="10px";container.style.background="white";container.style.textAlign="right";container.style.zIndex="5";var img=document.createElement("img");container.appendChild(img);img.style.position="absolute";img.style.right="0px";img.style.top="15px";img.src='http://www.gate24.ch/logos/'+info.LOGOA;img.id="firmLogo";var toggler=document.createElement("a");container.appendChild(toggler);toggler.src="#";toggler.style.cursor="pointer";toggler.alt=tra['general_cacherLogo'];toggler.title=tra['general_cacherLogo'];toggler.className='logoToggler';toggler.style.background='url(/OPO/tools/progZoomer/images/MINUS.gif)';toggler.action="hide";toggler.image=$(img);var that=this;toggler.onclick=function(e){e=(e)?e:((event)?event:null);var elem=Event.element(e);if(elem.action=="hide")
that.hideGastroLogo(e);else
that.showGastroLogo(e);return false;};img.toggler=toggler;$("poiInfoContainer").appendChild(container);}
interact.prototype.hideGastroLogo=function(e){elem=(e)?e:((event)?event:null);if(!elem.action)
elem=Event.element(e);elem.action="show";elem.title=tra['general_montrerLogo'];elem.alt=tra['general_montrerLogo'];elem.style.background='url(/OPO/tools/progZoomer/images/PLUS.gif)';elem.image.hide();}
interact.prototype.showGastroLogo=function(e){elem=(e)?e:((event)?event:null);if(!elem.action)
elem=Event.element(e);elem.action="hide";elem.alt=tra['general_cacherLogo'];elem.title=tra['general_cacherLogo'];elem.className='logoToggler';elem.style.background='url(/OPO/tools/progZoomer/images/MINUS.gif)';elem.image.show();}
interact.prototype.displayGastroInfosInPopUp=function(e){e=(e)?e:((event)?event:null);if(typeof(e.NOM)!="undefined"){var info=e;}
else{var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;}
var viewportContainer=$("viewportContainer");var selectedOptionLabel=this.gastroSelectBox.options[this.gastroSelectBox.options.selectedIndex].innerHTML;var olddiv=$("gastroPopUp");if(olddiv){viewportContainer.removeChild($("gastroPopUp"));}
var div=document.createElement("div");viewportContainer.appendChild(div);div.id="gastroPopUp";var title=document.createElement("div");div.appendChild(title);title.className="subtitle";title.style.cursor="move";title.innerHTML="<span style='padding-left:5px;position:relative; top:2px;'>"+selectedOptionLabel+"</span><span class='popUpCloser'><a href=\"#\" onClick=\"myKaMap.interact.removeGastroPopUp(); return false;\"><img style='border:none; position:absolute; right:0px; top:2px;' src='/OPO/images/popUpSchliessen.gif'></a></span>";var gastroInfo=document.createElement("div");div.appendChild(gastroInfo);var gastroInfoHTML='<table id="gastroPopUp_table" border="0" cellspacing="0" cellpadding="0">';gastroInfoHTML+='<tr><td align="left" valign="top" style="padding : 10px; width : 200px">';gastroInfoHTML+="<strong>"+info.NOM+"</strong><br/>";gastroInfoHTML+=info.NOM_RUE+' '+info.NO_MAISON+'<br/>';gastroInfoHTML+=info.NPA+' '+info.LOCALITE_18+'<br/>';if(info.NO_TEL!='')
gastroInfoHTML+=info.NO_TEL+'<br/>';if(info.E_MAIL!='')
gastroInfoHTML+="<a href='mailto:"+info.E_MAIL+"'>"+info.E_MAIL+"</a><br>";if(info.URL!='')
gastroInfoHTML+='<a href="'+info.URL+'" target="_blank">'+tra['general_website']+'</a><br/>';gastroInfoHTML+='</td><td valign="top" align="center">';if(info.LOGO!=''){if(info.URL!='')
gastroInfoHTML+='<a href="'+info.URL+'" target="_blank"><img src="'+info.LOGO+'" border="0" onload="myKaMap.interact.adjustGastroPopUpWidth()"></a>';else
gastroInfoHTML+='<img src="'+info.LOGO+'" onload="myKaMap.interact.adjustGastroPopUpWidth()" />';}
gastroInfoHTML+='</td></tr></table>';gastroInfo.innerHTML+=gastroInfoHTML;gastroInfo.className="content";Drag.init(title,div,null,null,null,null);div.style.top="55px";div.style.left="15px";};interact.prototype.adjustGastroPopUpWidth=function(){$("gastroPopUp").style.width=this.kaMap.getObjectWidth("gastroPopUp_table")+75+"px";}
interact.prototype.removeGastroPopUp=function(){var viewportContainer=$("viewportContainer");var olddiv=$("gastroPopUp");if(olddiv){viewportContainer.removeChild(olddiv);}};interact.prototype.chaletSearch=function(val){if(val!=""){var params="action=getChalet&name="+escape(val);$("chaletSablier").style.display="block";this.callPHP(params,this.chaletSearchCallback);}}
interact.prototype.chaletSearchCallback=function(query){var directShow=null;$("chaletSablier").style.display="none";var t=this;try{eval(query);}
catch(e){alert("eval failed");return;}
this.oldselected=null;this.chaletRemoveResults();if(data==null)
return;this.POIremoveResults();this.POIresetFields();this.firmRemoveResults();this.firmResetFields();this.gastroRemoveResults();this.gastroResetFields();this.addressRemoveResults();this.addressResetFields();var parPage=10;var nbPages=Math.ceil(data.length/parPage);this.chaletNbPages=nbPages;for(var k=0;k<nbPages;k++){var container=document.createElement("div");$("chaletSearchDiv").appendChild(container);container.id="chaletSearchContainer"+k;container.style.display="none";var table=document.createElement("table");container.appendChild(table);table.className="chaletSearchDiv_ResultTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var upperBound=((k+1)*parPage>data.length)?data.length:(k+1)*parPage;for(var i=k*10;i<upperBound;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="row"+(i%2);td.id="charow"+i;var a=document.createElement("a");td.appendChild(a);a.innerHTML=data[i].NAME;a.innerInfo=data[i];a.dataType="chalet";a.identifier="charow"+i;a.onclick=function(e){t.tipItem(e);t.displayChaletInfosOnTabRight(e);return false;};a.href="#";a.page=k;if(data[i].showme==1){directShow=a;}}}
if(data.length==1&&!directShow){this.tipItem(a);this.displayChaletInfosOnTabRight(a);}
if(nbPages>1){var index=document.createElement("div");$("chaletSearchDiv").appendChild(index);index.id="chaletIndex";}
if(directShow){this.activeChaletPage=directShow.page;this.activateChaletPage(directShow.page);this.displayChaletInfosOnTabRight(directShow);this.tipItem(directShow);}
else{this.activeChaletPage=0;this.activateChaletPage(0);}}
interact.prototype.activateChaletPage=function(no){$("chaletSearchContainer"+this.activeChaletPage).style.display="none";this.drawPages('chaletIndex','activateChaletPage',this.chaletNbPages,no);$("chaletSearchContainer"+no).style.display="block";this.activeChaletPage=no;};interact.prototype.drawPages=function(element,actFunct,nbPages,page){if(nbPages>1){var nbGroupesPagesBefor=4;var nbGroupesPagesAfter=6;var pageMin=0;var pageMax=nbPages;pageMin=page-nbGroupesPagesBefor;pageMax=page+nbGroupesPagesAfter;var delta=0;if(pageMin<0){delta=0-pageMin;pageMin=0;pageMax+=delta;if(pageMax>nbPages){pageMax=nbPages;}}
if(pageMax>nbPages){delta=pageMax-nbPages;pageMax=nbPages;pageMin-=delta;if(pageMin<0){pageMin=0;}}
var index=$(element);index.innerHTML='';for(var i=pageMin;i<pageMax;i++){if(i==page)index.innerHTML+="<strong>"+(i+1)+"</strong>&nbsp;";else index.innerHTML+="<a href='#' onclick='myKaMap.interact."+actFunct+"("+i+"); return false;'>"+(i+1)+"</a>&nbsp;";}}};interact.prototype.chaletRemoveResults=function(){var i=0;while($("chaletSearchContainer"+i)){$("chaletSearchDiv").removeChild($("chaletSearchContainer"+i));i++;}
if($("chaletIndex")){$("chaletSearchDiv").removeChild($("chaletIndex"));}};interact.prototype.chaletResetFields=function(){try{$("chaname").value="";}
catch(e){}};interact.prototype.displayChaletInfosOnTabRight=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;var infoContainer=$("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
info.TYP=tra['chalet'];this.showActions('chalet',info);infoContainer.innerHTML="<table cellspacing='0' class='subtitle'><tr><td style='vertical-align:middle'>&nbsp;&nbsp;"+tra['chalet']+"</td></tr></table>";var table=document.createElement("table");infoContainer.appendChild(table);var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML="<strong>"+info.NAME+"</strong>";if(info.LOCALITE_18!=''||info.NPA!=''||info.NO_MAISON!=''||info.NOM_RUE!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NOM_RUE+' '+info.NO_MAISON+'<br>'+info.NPA+' '+info.LOCALITE_18;}
if(info.NO_TEL!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.NO_TEL;}
if(info.E_MAIL!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="mailto:'+info.E_MAIL+'">'+info.E_MAIL+'</a>';}
if(info.URL!=''){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="'+info.URL+' target="_blank"">'+tra['general_details']+'</a>';}
if((dataOPO['MAP_IT']||this.kaMap.admin.authenticated==true)&&dataLink['isdirect']!=1){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="javascript:void(0)" onclick="$(\'chaletDirectLink\').toggle()">'+tra['lien_direct']+'</a>';td.innerHTML+='<div id="chaletDirectLink" style="display:none">http://'+top.location.host+'/'+dataOPO['NAME']+'/c/'+info.ID_POINT_INTERET+'</div>';}};interact.prototype.addressSearch=function(adr_r1,adr_r2,adr_rue,adr_no,adr_ville){var r1=$(adr_r1);var r2=$(adr_r2);var type=1;if(r1.checked)
type=1;else if(r2.checked)
type=2;var rue=$(adr_rue).value;var no=$(adr_no).value;var cityValue=($(adr_ville))?$(adr_ville).value:-1;var zip=-1;var city=-1;if(cityValue!=-1){var sep=cityValue.indexOf("#");zip=cityValue.substring(0,sep);city=cityValue.substring(sep+1,cityValue.length);}
this.addressRemoveResults();if(rue!=""||type==2){if(dataOPO['MULTICITY']&&dataOPO['CITIES'].length>=20&&city.length==0){this.blink([adr_ville],["fieldEnabled","fieldRed"],150,2);}
else{var params="action=addressSearch&type="+type+"&street="+escape(rue)+"&houseNb="+no+"&zip="+zip+"&city="+escape(city);$("adresseSablier").style.display="block";this.callPHP(params,this.addressSearchCallback);}}
else{if(dataOPO['MULTICITY']&&dataOPO['CITIES'].length>=20&&city.length==0){this.blink([adr_ville],["fieldEnabled","fieldRed"],150,2);}
else{var params="action=citySearch&type="+type+"&zip="+zip+"&city="+escape(city);$("adresseSablier").style.display="block";this.callPHP(params,this.addressSearchCallback);}}};interact.prototype.blink=function(targets,classNames,delay,blinkCounter){var t=this;if(blinkCounter==0)
return;for(var i=0;i<targets.length;i++){$(targets[i]).className=classNames[1];}
window.setTimeout(function(){for(var i=0;i<targets.length;i++){t.kaMap.getRawObject(targets[i]).className=classNames[0];};window.setTimeout(function(){t.blink(targets,classNames,delay,--blinkCounter)},delay)},delay);};interact.prototype.addressSearchCallback=function(query){var directShow=null;$("adresseSablier").style.display="none";var t=this;try{eval(query);}
catch(e){var data=null;}
this.oldselected=null;this.addressRemoveResults();if(data==null){var container=document.createElement("div");$("addressSearchDiv").appendChild(container);container.id="adrSearchContainer0";container.className='addressSearchDiv_ResultTable';container.innerHTML=tra['no_address'];return;}
this.POIremoveResults();this.POIresetFields();this.firmRemoveResults();this.firmResetFields();this.gastroRemoveResults();this.gastroResetFields();this.chaletRemoveResults();this.chaletResetFields();if($("adr_radio2").checked){$("adr_no").value='';}
var nbPages=Math.ceil(data.length/10);this.adrNbPages=nbPages;for(var k=0;k<nbPages;k++){var container=document.createElement("div");$("addressSearchDiv").appendChild(container);container.id="adrSearchContainer"+k;container.style.display="none";var table=document.createElement("table");container.appendChild(table);table.className="addressSearchDiv_ResultTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var upperBound=((k+1)*10>data.length)?data.length:(k+1)*10;for(var i=k*10;i<upperBound;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="row"+(i%2);td.id="adrrow"+i;var a=document.createElement("a");td.appendChild(a);a.innerHTML=data[i].rue+((data[i].numero)?(" "+data[i].numero):(""));if(dataOPO['MULTICITY']){a.innerHTML+="<br>"+data[i].npa+" "+data[i].localite;}
a.innerInfo=data[i];a.dataType="address";a.identifier="adrrow"+i;if(data[i].objectidx)
a.onclick=function(e){t.emptyPlaceId();t.tipItem(e);t.displayAddressInfosOnTabRight(e);return false;};else
a.onclick=function(e){t.newAddressSearch(e);return false;};a.href="#";a.page=k;if(data[i].showme==1){directShow=a;}}}
if(data.length==1&&data[0].objectidx&&!directShow){this.emptyPlaceId(a);this.tipItem(a);this.displayAddressInfosOnTabRight(a);}
if(nbPages>1){var index=document.createElement("div");$("addressSearchDiv").appendChild(index);index.id="adrIndex";}
if(directShow){this.activeAdrPage=directShow.page;this.activateAdrPage(directShow.page);this.tipItem(directShow);this.displayAddressInfosOnTabRight(directShow);}
else{this.activeAdrPage=0;this.activateAdrPage(0);}};interact.prototype.emptyPlaceId=function(){var url="/OPO/fetchdata.php?"+sessionName+"="+sessionId+"&commune="+dataOPO['NAME']+"&action=emptyPlaceID";new Ajax.Request(url,{asynchronous:false});};interact.prototype.activateAdrPage=function(no){$("adrSearchContainer"+this.activeAdrPage).style.display="none";this.drawPages('adrIndex','activateAdrPage',this.adrNbPages,no);$("adrSearchContainer"+no).style.display="block";this.activeAdrPage=no;};interact.prototype.newAddressSearch=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:null);var info=src.innerInfo;var type=1;var rue=$("adr_rue").value;var no=$("adr_no").value;var params="action=addressSearch&type="+type+"&street="+escape(rue)+"&houseNb="+no+"&id_rue="+info.id_objet;this.callPHP(params,this.addressSearchCallback);};interact.prototype.addressRemoveResults=function(){var i=0;while($("adrSearchContainer"+i)){$("addressSearchDiv").removeChild($("adrSearchContainer"+i));i++;}
if($("adrIndex")){$("addressSearchDiv").removeChild($("adrIndex"));}};interact.prototype.addressResetFields=function(){try{$("adr_rue").value="";$("adr_no").value="";$("adr_radio1").checked=true;$("adr_radio2").checked=false;}
catch(e){}};interact.prototype.displayAddressInfosOnTabRight=function(e){var t=this;e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:e);var info=src.innerInfo;var infoContainer=$("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
info.TYP=tra['address'];this.showActions('adr',info);infoContainer.innerHTML="<table cellspacing='0' class='subtitle'><tr><td style='vertical-align:middle'>&nbsp;&nbsp;"+tra['address']+"</td></tr></table>";var table=document.createElement("table");infoContainer.appendChild(table);var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML=info.rue+" "+info.numero+"<br>"+info.npa+" "+info.localite;if((dataOPO['MAP_IT']||this.kaMap.admin.authenticated==true)&&dataLink['isdirect']!=1){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.innerHTML='<a href="javascript:void(0)" onclick="$(\'addressDirectLink\').toggle()">'+tra['lien_direct']+'</a>';td.innerHTML+='<div id="addressDirectLink" style="display:none">http://'+top.location.host+'/'+dataOPO['NAME']+'/a/'+info.id_objet+'</div>';}};interact.prototype.updateBoxes=function(){var scale=myKaMap.getCurrentScale();if(scale>300000){$('keymap').style.display='none';}
else{$('keymap').style.display='';}
if(scale<=30000){var extents=myKaMap.getGeoExtents();var left=extents[0];var right=extents[2];var top=extents[3];var bottom=extents[1];var t=this;this.callPHP('action=findPlaces&extents='+left+','+bottom+','+right+','+top,t.updateBoxesCallback);}
else{$('poiSearchDiv').style.display='none';$('firmSearchDiv').style.display='none';}};interact.prototype.updateBoxesCallback=function(query){try{eval(query);}
catch(e){return;}
var poiDisplay='';var firmDisplay='';var gastroDisplay='';var selectBoxPOI=$('selectBoxPOI');var selectBoxFirms=$('selectBoxFirms');if(data!='nochange'){var battyp=data['bat'];var firmtyp=data['firm'];battyp_keys=Object.keys(battyp);firmtyp_keys=Object.keys(firmtyp);var oldPOISelected=selectBoxPOI.value;if(dataLink['isdirect']==1&&oldPOISelected<0&&dataLink['objclass']=="poi"){oldPOISelected=dataLink['cat'];}
while(selectBoxPOI.childNodes.length>1){selectBoxPOI.removeChild(selectBoxPOI.childNodes[1]);}
var oldFirmsSelected=selectBoxFirms.value;if(dataLink['isdirect']==1&&oldFirmsSelected<0&&dataLink['objclass']=="firm"){oldFirmsSelected=dataLink['cat'];}
while(selectBoxFirms.childNodes.length>1){selectBoxFirms.removeChild(selectBoxFirms.childNodes[1]);}
var oldparent='';for(var i=0,length=battyp_keys.length;i<length;i++){var id=battyp_keys[i];var item=battyp[id];if(item['parent']!=oldparent){var optionel=document.createElement('optgroup');optionel.label=item['parent'];selectBoxPOI.appendChild(optionel);oldparent=item['parent'];}
var optionel=document.createElement('option');optionel.innerHTML=item['libelle'];optionel.value=item['id'];if(optionel.value==oldPOISelected&&oldPOISelected>0){optionel.selected=true;}
selectBoxPOI.appendChild(optionel);};for(var i=0,length=firmtyp_keys.length;i<length;i++){var id=firmtyp_keys[i];var item=firmtyp[id];var optionel=document.createElement('option');optionel.innerHTML=item;optionel.value=id;if(optionel.value==oldFirmsSelected&&oldFirmsSelected>0){optionel.selected=true;}
selectBoxFirms.appendChild(optionel);};}
if(selectBoxPOI.childNodes.length<=1){poiDisplay='none';}
if(selectBoxFirms.childNodes.length<=1){firmDisplay='none';}
$('poiSearchDiv').style.display=poiDisplay;$('firmSearchDiv').style.display=firmDisplay;};interact.prototype.mapClicked=function(eventID,p){var scale=this.kaMap.getCurrentScale();var currentScale=myKaMap.getCurrentScale();if(currentScale>=600000){var t=this;this.callPHP('action=cityProximitySearch&x='+p[0]+'&y='+p[1],t.mapClickedCallback);}
else{this.kaMap.zoomIn();this.kaMap.zoomTo(p[0],p[1]);}};interact.prototype.mapClickedCallback=function(query){try{eval(query);}
catch(e){return;}
if(data!=''){$('adr_ville').value=data;$('adr_radio1').checked=true;this.addressSearch('adr_radio1','adr_radio2','adr_rue','adr_no','adr_ville');}};interact.prototype.showHideSMLayer=function(){if($('SMLayer').style.display!='none'){$('SMLayer').style.display='none';}
else{$('SMLayer').style.display='';$('poiInfoContainer').innerHTML='';$("sbbContainer").style.display='none';$("routingDiv").style.display='none';$("ambiguousLocationsDiv").style.display='none';$("keymap").style.display='';this.kaMap.deregisterForEvent(KAMAP_EXTENTS_CHANGED,this.kaMap.admin,this.kaMap.admin.positionTarget);if($('centerView')!=null){$('centerView').remove();}
this.hideActions();}};interact.prototype.setSMLayerVisibility=function(obj,name){if(name=='Wanderland'){this.kaMap.setLayerVisibility('Wanderland',$('chkWanderland').checked);}
else if(name=='Wanderland-Local'){this.kaMap.setLayerVisibility('Wanderland-Local',$('chkWanderlandLocal').checked);}
else{if(obj.checked){obj.checked=false;obj.src=obj.src.replace('_on.png','_off.png');var labelObj=obj.id.replace('Btn','Txt');$(labelObj).style.color=null;}
else{obj.checked=true;obj.src=obj.src.replace('_off.png','_on.png');var labelObj=obj.id.replace('Btn','Txt');$(labelObj).style.color='#000000';}
if(name=='Wanderland-Choice'){if(obj.checked){$('smWanderlandChoice').style.display='block';if($('chkWanderlandLocal').checked){this.kaMap.setLayerVisibility('Wanderland-Local',true);}
if($('chkWanderland').checked){this.kaMap.setLayerVisibility('Wanderland',true);}}
else{$('smWanderlandChoice').style.display='none';this.kaMap.setLayerVisibility('Wanderland',false);this.kaMap.setLayerVisibility('Wanderland-Local',false);}}
else{var checked=obj.checked;this.kaMap.setLayerVisibility(name,checked);}}
this.checkSMLayers();};interact.prototype.checkSMLayers=function(){var SMLayers=Array('Wanderland','Wanderland-Local','Veloland','Mountainbikeland','Skatingland','Kanuland');var checkedSMLayers=0;for(var n=0;n<SMLayers.length;n=n+1){if(this.kaMap.getCurrentMap().getLayer(SMLayers[n]).visible){checkedSMLayers=checkedSMLayers+1;}}
if(checkedSMLayers>0){this.kaMap.setLayerOpacity("basemap",60);}
else{this.kaMap.setLayerOpacity("basemap",100);}};var aXmlHttp=new Array();var aXmlResponse=new Array();function xmlResult()
{for(var i=0;i<aXmlHttp.length;i++)
{if(aXmlHttp[i]&&aXmlHttp[i][0]&&aXmlHttp[i][0].readyState==4&&aXmlHttp[i][0].responseText)
{var f=aXmlHttp[i][2];var o=aXmlHttp[i][1];var s=aXmlHttp[i][0].responseText;aXmlHttp[i][0]=null;aXmlHttp[i][1]=null;aXmlHttp[i]=null;f.apply(o,new Array(s));}}}
function call(u,o,f)
{var method="GET";var dat;if(arguments.length==4){method="POST";tmp=u.split(/\?/);u=tmp[0];dat=tmp[1];}
var idx=aXmlHttp.length;for(var i=0;i<idx;i++)
if(aXmlHttp[i]==null)
{idx=i;break;}
aXmlHttp[idx]=new Array(2);aXmlHttp[idx][0]=getXMLHTTP();aXmlHttp[idx][1]=o;aXmlHttp[idx][2]=f;if(aXmlHttp[idx])
{aXmlHttp[idx][0].open(method,u,true);if(method=="POST"){aXmlHttp[idx][0].setRequestHeader("Content-Type","application/x-www-form-urlencoded");aXmlHttp[idx][0].send(dat);}
aXmlHttp[idx][0].onreadystatechange=xmlResult;if(method=="GET"){aXmlHttp[idx][0].send(null);}}}
function getXMLHTTP()
{var A=null;if(!A&&typeof XMLHttpRequest!="undefined")
{A=new XMLHttpRequest();}
if(!A)
{try
{A=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{A=new ActiveXObject("Microsoft.XMLHTTP");}
catch(oc)
{A=null}}}
return A;}
if(Object.isUndefined(Effect))
throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(element){this.drops=this.drops.reject(function(d){return d.element==$(element)});},add:function(element){element=$(element);var options=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(options.containment){options._containers=[];var containment=options.containment;if(Object.isArray(containment)){containment.each(function(c){options._containers.push($(c))});}else{options._containers.push($(containment));}}
if(options.accept)options.accept=[options.accept].flatten();Element.makePositioned(element);options.element=element;this.drops.push(options);},findDeepestChild:function(drops){deepest=drops[0];for(i=1;i<drops.length;++i)
if(Element.isParent(drops[i].element,deepest.element))
deepest=drops[i];return deepest;},isContained:function(element,drop){var containmentNode;if(drop.tree){containmentNode=element.treeNode;}else{containmentNode=element.parentNode;}
return drop._containers.detect(function(c){return containmentNode==c});},isAffected:function(point,element,drop){return((drop.element!=element)&&((!drop._containers)||this.isContained(element,drop))&&((!drop.accept)||(Element.classNames(element).detect(function(v){return drop.accept.include(v)})))&&Position.within(drop.element,point[0],point[1]));},deactivate:function(drop){if(drop.hoverclass)
Element.removeClassName(drop.element,drop.hoverclass);this.last_active=null;},activate:function(drop){if(drop.hoverclass)
Element.addClassName(drop.element,drop.hoverclass);this.last_active=drop;},show:function(point,element){if(!this.drops.length)return;var drop,affected=[];this.drops.each(function(drop){if(Droppables.isAffected(point,element,drop))
affected.push(drop);});if(affected.length>0)
drop=Droppables.findDeepestChild(affected);if(this.last_active&&this.last_active!=drop)this.deactivate(this.last_active);if(drop){Position.within(drop.element,point[0],point[1]);if(drop.onHover)
drop.onHover(element,drop.element,Position.overlap(drop.overlap,drop.element));if(drop!=this.last_active)Droppables.activate(drop);}},fire:function(event,element){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(event),Event.pointerY(event)],element,this.last_active))
if(this.last_active.onDrop){this.last_active.onDrop(element,this.last_active.element,event);return true;}},reset:function(){if(this.last_active)
this.deactivate(this.last_active);}}
var Draggables={drags:[],observers:[],register:function(draggable){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress);}
this.drags.push(draggable);},unregister:function(draggable){this.drags=this.drags.reject(function(d){return d==draggable});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress);}},activate:function(draggable){if(draggable.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=draggable;}.bind(this),draggable.options.delay);}else{window.focus();this.activeDraggable=draggable;}},deactivate:function(){this.activeDraggable=null;},updateDrag:function(event){if(!this.activeDraggable)return;var pointer=[Event.pointerX(event),Event.pointerY(event)];if(this._lastPointer&&(this._lastPointer.inspect()==pointer.inspect()))return;this._lastPointer=pointer;this.activeDraggable.updateDrag(event,pointer);},endDrag:function(event){if(this._timeout){clearTimeout(this._timeout);this._timeout=null;}
if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(event);this.activeDraggable=null;},keyPress:function(event){if(this.activeDraggable)
this.activeDraggable.keyPress(event);},addObserver:function(observer){this.observers.push(observer);this._cacheObserverCallbacks();},removeObserver:function(element){this.observers=this.observers.reject(function(o){return o.element==element});this._cacheObserverCallbacks();},notify:function(eventName,draggable,event){if(this[eventName+'Count']>0)
this.observers.each(function(o){if(o[eventName])o[eventName](eventName,draggable,event);});if(draggable.options[eventName])draggable.options[eventName](draggable,event);},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(eventName){Draggables[eventName+'Count']=Draggables.observers.select(function(o){return o[eventName];}).length;});}}
var Draggable=Class.create({initialize:function(element){var defaults={handle:false,reverteffect:function(element,top_offset,left_offset){var dur=Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;new Effect.Move(element,{x:-left_offset,y:-top_offset,duration:dur,queue:{scope:'_draggable',position:'end'}});},endeffect:function(element){var toOpacity=Object.isNumber(element._opacity)?element._opacity:1.0;new Effect.Opacity(element,{duration:0.2,from:0.7,to:toOpacity,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[element]=false}});},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect))
Object.extend(defaults,{starteffect:function(element){element._opacity=Element.getOpacity(element);Draggable._dragging[element]=true;new Effect.Opacity(element,{duration:0.2,from:element._opacity,to:0.7});}});var options=Object.extend(defaults,arguments[1]||{});this.element=$(element);if(options.handle&&Object.isString(options.handle))
this.handle=this.element.down('.'+options.handle,0);if(!this.handle)this.handle=$(options.handle);if(!this.handle)this.handle=this.element;if(options.scroll&&!options.scroll.scrollTo&&!options.scroll.outerHTML){options.scroll=$(options.scroll);this._isScrollChild=Element.childOf(this.element,options.scroll);}
Element.makePositioned(this.element);this.options=options;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this);},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this);},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')]);},initDrag:function(event){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element])return;if(Event.isLeftClick(event)){var src=Event.element(event);if((tag_name=src.tagName.toUpperCase())&&(tag_name=='INPUT'||tag_name=='SELECT'||tag_name=='OPTION'||tag_name=='BUTTON'||tag_name=='TEXTAREA'))return;var pointer=[Event.pointerX(event),Event.pointerY(event)];var pos=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(pointer[i]-pos[i])});Draggables.activate(this);Event.stop(event);}},startDrag:function(event){this.dragging=true;if(!this.delta)
this.delta=this.currentDelta();if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex;}
if(this.options.ghosting){this._clone=this.element.cloneNode(true);this.element._originallyAbsolute=(this.element.getStyle('position')=='absolute');if(!this.element._originallyAbsolute)
Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element);}
if(this.options.scroll){if(this.options.scroll==window){var where=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=where.left;this.originalScrollTop=where.top;}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop;}}
Draggables.notify('onStart',this,event);if(this.options.starteffect)this.options.starteffect(this.element);},updateDrag:function(event,pointer){if(!this.dragging)this.startDrag(event);if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element);}
Draggables.notify('onDrag',this,event);this.draw(pointer);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height];}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight);}
var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity))speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity);if(pointer[1]<(p[1]+this.options.scrollSensitivity))speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity);if(pointer[0]>(p[2]-this.options.scrollSensitivity))speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity);if(pointer[1]>(p[3]-this.options.scrollSensitivity))speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(speed);}
if(Prototype.Browser.WebKit)window.scrollBy(0,0);Event.stop(event);},finishDrag:function(event,success){this.dragging=false;if(this.options.quiet){Position.prepare();var pointer=[Event.pointerX(event),Event.pointerY(event)];Droppables.show(pointer,this.element);}
if(this.options.ghosting){if(!this.element._originallyAbsolute)
Position.relativize(this.element);delete this.element._originallyAbsolute;Element.remove(this._clone);this._clone=null;}
var dropped=false;if(success){dropped=Droppables.fire(event,this.element);if(!dropped)dropped=false;}
if(dropped&&this.options.onDropped)this.options.onDropped(this.element);Draggables.notify('onEnd',this,event);var revert=this.options.revert;if(revert&&Object.isFunction(revert))revert=revert(this.element);var d=this.currentDelta();if(revert&&this.options.reverteffect){if(dropped==0||revert!='failure')
this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]);}else{this.delta=d;}
if(this.options.zindex)
this.element.style.zIndex=this.originalZ;if(this.options.endeffect)
this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset();},keyPress:function(event){if(event.keyCode!=Event.KEY_ESC)return;this.finishDrag(event,false);Event.stop(event);},endDrag:function(event){if(!this.dragging)return;this.stopScrolling();this.finishDrag(event,true);Event.stop(event);},draw:function(point){var pos=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);pos[0]+=r[0]-Position.deltaX;pos[1]+=r[1]-Position.deltaY;}
var d=this.currentDelta();pos[0]-=d[0];pos[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){pos[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;pos[1]-=this.options.scroll.scrollTop-this.originalScrollTop;}
var p=[0,1].map(function(i){return(point[i]-pos[i]-this.offset[i])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){p=this.options.snap(p[0],p[1],this);}else{if(Object.isArray(this.options.snap)){p=p.map(function(v,i){return(v/this.options.snap[i]).round()*this.options.snap[i]}.bind(this))}else{p=p.map(function(v){return(v/this.options.snap).round()*this.options.snap}.bind(this))}}}
var style=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))
style.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))
style.top=p[1]+"px";if(style.visibility=="hidden")style.visibility="";},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null;}},startScrolling:function(speed){if(!(speed[0]||speed[1]))return;this.scrollSpeed=[speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10);},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1]);}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000;}
Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0)
Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)
Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer);}
if(this.options.change)this.options.change(this);},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft;}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft;}
if(w.innerWidth){W=w.innerWidth;H=w.innerHeight;}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight;}else{W=body.offsetWidth;H=body.offsetHeight}}
return{top:T,left:L,width:W,height:H};}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(element,observer){this.element=$(element);this.observer=observer;this.lastValue=Sortable.serialize(this.element);},onStart:function(){this.lastValue=Sortable.serialize(this.element);},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))
this.observer(this.element)}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(element){while(element.tagName.toUpperCase()!="BODY"){if(element.id&&Sortable.sortables[element.id])return element;element=element.parentNode;}},options:function(element){element=Sortable._findRootElement($(element));if(!element)return;return Sortable.sortables[element.id];},destroy:function(element){var s=Sortable.options(element);if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id];}},create:function(element){element=$(element);var options=Object.extend({element:element,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:element,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(element);var options_for_draggable={revert:true,quiet:options.quiet,scroll:options.scroll,scrollSpeed:options.scrollSpeed,scrollSensitivity:options.scrollSensitivity,delay:options.delay,ghosting:options.ghosting,constraint:options.constraint,handle:options.handle};if(options.starteffect)
options_for_draggable.starteffect=options.starteffect;if(options.reverteffect)
options_for_draggable.reverteffect=options.reverteffect;else
if(options.ghosting)options_for_draggable.reverteffect=function(element){element.style.top=0;element.style.left=0;};if(options.endeffect)
options_for_draggable.endeffect=options.endeffect;if(options.zindex)
options_for_draggable.zindex=options.zindex;var options_for_droppable={overlap:options.overlap,containment:options.containment,tree:options.tree,hoverclass:options.hoverclass,onHover:Sortable.onHover}
var options_for_tree={onHover:Sortable.onEmptyHover,overlap:options.overlap,containment:options.containment,hoverclass:options.hoverclass}
Element.cleanWhitespace(element);options.draggables=[];options.droppables=[];if(options.dropOnEmpty||options.tree){Droppables.add(element,options_for_tree);options.droppables.push(element);}
(options.elements||this.findElements(element,options)||[]).each(function(e,i){var handle=options.handles?$(options.handles[i]):(options.handle?$(e).select('.'+options.handle)[0]:e);options.draggables.push(new Draggable(e,Object.extend(options_for_draggable,{handle:handle})));Droppables.add(e,options_for_droppable);if(options.tree)e.treeNode=element;options.droppables.push(e);});if(options.tree){(Sortable.findTreeElements(element,options)||[]).each(function(e){Droppables.add(e,options_for_tree);e.treeNode=element;options.droppables.push(e);});}
this.sortables[element.id]=options;Draggables.addObserver(new SortableObserver(element,options.onUpdate));},findElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.tag);},findTreeElements:function(element,options){return Element.findChildren(element,options.only,options.tree?true:false,options.treeTag);},onHover:function(element,dropon,overlap){if(Element.isParent(dropon,element))return;if(overlap>.33&&overlap<.66&&Sortable.options(dropon).tree){return;}else if(overlap>0.5){Sortable.mark(dropon,'before');if(dropon.previousSibling!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,dropon);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}else{Sortable.mark(dropon,'after');var nextElement=dropon.nextSibling||null;if(nextElement!=element){var oldParentNode=element.parentNode;element.style.visibility="hidden";dropon.parentNode.insertBefore(element,nextElement);if(dropon.parentNode!=oldParentNode)
Sortable.options(oldParentNode).onChange(element);Sortable.options(dropon.parentNode).onChange(element);}}},onEmptyHover:function(element,dropon,overlap){var oldParentNode=element.parentNode;var droponOptions=Sortable.options(dropon);if(!Element.isParent(dropon,element)){var index;var children=Sortable.findElements(dropon,{tag:droponOptions.tag,only:droponOptions.only});var child=null;if(children){var offset=Element.offsetSize(dropon,droponOptions.overlap)*(1.0-overlap);for(index=0;index<children.length;index+=1){if(offset-Element.offsetSize(children[index],droponOptions.overlap)>=0){offset-=Element.offsetSize(children[index],droponOptions.overlap);}else if(offset-(Element.offsetSize(children[index],droponOptions.overlap)/2)>=0){child=index+1<children.length?children[index+1]:null;break;}else{child=children[index];break;}}}
dropon.insertBefore(element,child);Sortable.options(oldParentNode).onChange(element);droponOptions.onChange(element);}},unmark:function(){if(Sortable._marker)Sortable._marker.hide();},mark:function(dropon,position){var sortable=Sortable.options(dropon.parentNode);if(sortable&&!sortable.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);}
var offsets=Position.cumulativeOffset(dropon);Sortable._marker.setStyle({left:offsets[0]+'px',top:offsets[1]+'px'});if(position=='after')
if(sortable.overlap=='horizontal')
Sortable._marker.setStyle({left:(offsets[0]+dropon.clientWidth)+'px'});else
Sortable._marker.setStyle({top:(offsets[1]+dropon.clientHeight)+'px'});Sortable._marker.show();},_tree:function(element,options,parent){var children=Sortable.findElements(element,options)||[];for(var i=0;i<children.length;++i){var match=children[i].id.match(options.format);if(!match)continue;var child={id:encodeURIComponent(match?match[1]:null),element:element,parent:parent,children:[],position:parent.children.length,container:$(children[i]).down(options.treeTag)}
if(child.container)
this._tree(child.container,options,child)
parent.children.push(child);}
return parent;},tree:function(element){element=$(element);var sortableOptions=this.options(element);var options=Object.extend({tag:sortableOptions.tag,treeTag:sortableOptions.treeTag,only:sortableOptions.only,name:element.id,format:sortableOptions.format},arguments[1]||{});var root={id:null,parent:null,children:[],container:element,position:0}
return Sortable._tree(element,options,root);},_constructIndex:function(node){var index='';do{if(node.id)index='['+node.position+']'+index;}while((node=node.parent)!=null);return index;},sequence:function(element){element=$(element);var options=Object.extend(this.options(element),arguments[1]||{});return $(this.findElements(element,options)||[]).map(function(item){return item.id.match(options.format)?item.id.match(options.format)[1]:'';});},setSequence:function(element,new_sequence){element=$(element);var options=Object.extend(this.options(element),arguments[2]||{});var nodeMap={};this.findElements(element,options).each(function(n){if(n.id.match(options.format))
nodeMap[n.id.match(options.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n);});new_sequence.each(function(ident){var n=nodeMap[ident];if(n){n[1].appendChild(n[0]);delete nodeMap[ident];}});},serialize:function(element){element=$(element);var options=Object.extend(Sortable.options(element),arguments[1]||{});var name=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:element.id);if(options.tree){return Sortable.tree(element,arguments[1]).children.map(function(item){return[name+Sortable._constructIndex(item)+"[id]="+
encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));}).flatten().join('&');}else{return Sortable.sequence(element,arguments[1]).map(function(item){return name+"[]="+encodeURIComponent(item);}).join('&');}}}
Element.isParent=function(child,element){if(!child.parentNode||child==element)return false;if(child.parentNode==element)return true;return Element.isParent(child.parentNode,element);}
Element.findChildren=function(element,only,recursive,tagName){if(!element.hasChildNodes())return null;tagName=tagName.toUpperCase();if(only)only=[only].flatten();var elements=[];$A(element.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==tagName&&(!only||(Element.classNames(e).detect(function(v){return only.include(v)}))))
elements.push(e);if(recursive){var grandchildren=Element.findChildren(e,only,recursive,tagName);if(grandchildren)elements.push(grandchildren);}});return(elements.length>0?elements.flatten():[]);}
Element.offsetSize=function(element,type){return element['offset'+((type=='vertical'||type=='height')?'Height':'Width')];}
var Drag={obj:null,init:function(o,oRoot,minX,maxX,minY,maxY,bSwapHorzRef,bSwapVertRef,fXMapper,fYMapper)
{o.onmousedown=Drag.start;o.hmode=bSwapHorzRef?false:true;o.vmode=bSwapVertRef?false:true;o.root=oRoot&&oRoot!=null?oRoot:o;if(o.hmode&&isNaN(parseInt(o.root.style.left)))o.root.style.left="0px";if(o.vmode&&isNaN(parseInt(o.root.style.top)))o.root.style.top="0px";if(!o.hmode&&isNaN(parseInt(o.root.style.right)))o.root.style.right="0px";if(!o.vmode&&isNaN(parseInt(o.root.style.bottom)))o.root.style.bottom="0px";o.minX=typeof minX!='undefined'?minX:null;o.minY=typeof minY!='undefined'?minY:null;o.maxX=typeof maxX!='undefined'?maxX:null;o.maxY=typeof maxY!='undefined'?maxY:null;o.xMapper=fXMapper?fXMapper:null;o.yMapper=fYMapper?fYMapper:null;o.root.onDragStart=new Function();o.root.onDragEnd=new Function();o.root.onDrag=new Function();},start:function(e)
{var o=Drag.obj=this;e=Drag.fixE(e);var y=parseInt(o.vmode?o.root.style.top:o.root.style.bottom);var x=parseInt(o.hmode?o.root.style.left:o.root.style.right);o.root.onDragStart(x,y);o.lastMouseX=e.clientX;o.lastMouseY=e.clientY;if(o.hmode){if(o.minX!=null)o.minMouseX=e.clientX-x+o.minX;if(o.maxX!=null)o.maxMouseX=o.minMouseX+o.maxX-o.minX;}else{if(o.minX!=null)o.maxMouseX=-o.minX+e.clientX+x;if(o.maxX!=null)o.minMouseX=-o.maxX+e.clientX+x;}
if(o.vmode){if(o.minY!=null)o.minMouseY=e.clientY-y+o.minY;if(o.maxY!=null)o.maxMouseY=o.minMouseY+o.maxY-o.minY;}else{if(o.minY!=null)o.maxMouseY=-o.minY+e.clientY+y;if(o.maxY!=null)o.minMouseY=-o.maxY+e.clientY+y;}
document.onmousemove=Drag.drag;document.onmouseup=Drag.end;return false;},drag:function(e)
{e=Drag.fixE(e);var o=Drag.obj;var ey=e.clientY;var ex=e.clientX;var y=parseInt(o.vmode?o.root.style.top:o.root.style.bottom);var x=parseInt(o.hmode?o.root.style.left:o.root.style.right);var nx,ny;if(o.minX!=null)ex=o.hmode?Math.max(ex,o.minMouseX):Math.min(ex,o.maxMouseX);if(o.maxX!=null)ex=o.hmode?Math.min(ex,o.maxMouseX):Math.max(ex,o.minMouseX);if(o.minY!=null)ey=o.vmode?Math.max(ey,o.minMouseY):Math.min(ey,o.maxMouseY);if(o.maxY!=null)ey=o.vmode?Math.min(ey,o.maxMouseY):Math.max(ey,o.minMouseY);nx=x+((ex-o.lastMouseX)*(o.hmode?1:-1));ny=y+((ey-o.lastMouseY)*(o.vmode?1:-1));if(o.xMapper)nx=o.xMapper(y)
else if(o.yMapper)ny=o.yMapper(x)
Drag.obj.root.style[o.hmode?"left":"right"]=nx+"px";Drag.obj.root.style[o.vmode?"top":"bottom"]=ny+"px";Drag.obj.lastMouseX=ex;Drag.obj.lastMouseY=ey;Drag.obj.root.onDrag(nx,ny);return false;},end:function()
{document.onmousemove=null;document.onmouseup=null;Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style[Drag.obj.hmode?"left":"right"]),parseInt(Drag.obj.root.style[Drag.obj.vmode?"top":"bottom"]));Drag.obj=null;},fixE:function(e)
{if(typeof e=='undefined')e=window.event;if(typeof e.layerX=='undefined')e.layerX=e.offsetX;if(typeof e.layerY=='undefined')e.layerY=e.offsetY;return e;}};var KAMAP_MOUSE_TRACKER=gnLastEventId++;function kaMouseTracker(oKaMap){kaTool.apply(this,[oKaMap]);this.name='kaMouseTracker';this.bInfoTool=true;for(var p in kaTool.prototype){if(!kaMouseTracker.prototype[p])
kaMouseTracker.prototype[p]=kaTool.prototype[p];}};kaMouseTracker.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));var a=this.adjustPixPosition(x,y);var p=this.kaMap.pixToGeo(a[0],a[1]);this.kaMap.triggerEvent(KAMAP_MOUSE_TRACKER,{x:p[0],y:p[1]});return false;};function kaKeymap(oKaMap,szID){this.kaMap=oKaMap;this.domObj=this.kaMap.getRawObject(szID);this.domObj.kaKeymap=this;this.width=getObjectWidth(szID)+"px";this.height=getObjectHeight(szID)+"px";this.pxExtent=null;this.domExtents=null;this.aExtents=null;this.domImg=null;this.imgSrc=null;this.imgWidth=null;this.imgHeight=null;this.cellWidth=null;this.cellHeight=null;this.initialExtents=null;this.lastSearchDate=null;this.chronoUpdate=null;this.domObj.ondblclick=this.onclick;if(this.domObj.captureEvents){this.domObj.captureEvents(Event.DBLCLICK);}
this.kaMap.registerForEvent(KAMAP_INITIALIZED,this,this.initialize);};kaKeymap.prototype.initialize=function(){this.firstCall=true;this.pxExtent=null;this.initialExtents=this.kaMap.getGeoExtents();var szURL="map="+this.kaMap.currentMap;szURL+="&extents="+dataOPO['LEFT']+','+dataOPO['BOTTOM']+','+dataOPO['RIGHT']+','+dataOPO['TOP'];this.kaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,this,this.update);if(this.kaMap.getCurrentScale()<=300000){call("/OPO/customKeymap.php?"+szURL,this,this.draw);}};kaKeymap.prototype.draw=function(szResult){try{eval(szResult);}
catch(e){return;}
this.cellWidth=(this.aExtents[2]-this.aExtents[0])/this.imgWidth;this.cellHeight=(this.aExtents[3]-this.aExtents[1])/this.imgHeight;for(var i=this.domObj.childNodes.length-1;i>=0;i--)
this.domObj.removeChild(this.domObj.childNodes[i]);this.domObj.style.width=this.imgWidth+"px";this.domObj.style.height=this.imgHeight+"px";this.domImg=document.createElement('img');this.domImg.src=this.imgSrc;this.domImg.width=this.imgWidth;this.domImg.height=this.imgHeight;this.domObj.appendChild(this.domImg);this.domExtents=document.createElement('div');this.domExtents.kaKeymap=this;this.domExtents.id="keymapDomExtents";this.domExtents.style.position='absolute';this.domExtents.style.border='2px solid red';this.domExtents.style.top="1px";this.domExtents.style.left="1px";this.domExtents.style.width="1px";this.domExtents.style.height="1px";this.domExtents.style.backgroundColor='transparent';this.domExtents.style.visibility='visible';this.domObj.appendChild(this.domExtents);this.domEvent=document.createElement('div');this.domEvent.kaKeymap=this;this.domEvent.onmousedown=this.mousedown;this.domEvent.onmouseup=this.mouseup;this.domEvent.onmousemove=this.mousemove;this.domEvent.onmouseout=this.mouseup;if(this.domEvent.captureEvents){this.domEvent.captureEvents(Event.MOUSEDOWN);this.domEvent.captureEvents(Event.MOUSEUP);this.domEvent.captureEvents(Event.MOUSEMOVE);this.domEvent.captureEvents(Event.MOUSEOUT);}
this.domEvent.style.position='absolute';this.domEvent.id='keymapDomEvent';this.domEvent.style.border='2px solid red';this.domEvent.style.top="1px";this.domEvent.style.left="1px";this.domEvent.style.width="1px";this.domEvent.style.height="1px";this.domEvent.style.backgroundColor='white';this.domEvent.style.visibility='visible';this.domEvent.style.opacity=0.01;this.domEvent.style.mozOpacity=0.01;this.domEvent.style.filter="Alpha(opacity=0.01)";this.domObj.appendChild(this.domEvent);var d=document.createElement('img');d.id="keymapCrossImage";d.src="/images/cross.png";d.style.position='absolute';d.style.top='0px';d.style.left='0px';d.style.width="19px";d.style.height="19px";d.style.visibility='hidden';this.domExtents.appendChild(d);this.domCross=d;this.updateRedViewer(this.initialExtents);};kaKeymap.prototype.update=function(eventID,extents){if(this.kaMap.getCurrentScale()>300000){return true;}
var t=this;if(!this.aExtents||!this.domExtents){this.initialExtents=extents;if(this.firstCall){this.firstCall=false;var left=extents[0];var right=extents[2];var top=extents[3];var bottom=extents[1];var szURL="map="+this.kaMap.currentMap;szURL+="&extents="+left+','+bottom+','+right+','+top;call("/OPO/customKeymap.php?"+szURL,this,this.draw);}
return;}
var goOn=true;if(this.lastSearchDate){var now=(new Date()).getTime();if(now-this.lastSearchDate>1200){goOn=true;}
else{goOn=false;clearTimeout(this.chronoUpdate);this.chronoUpdate=setTimeout(function(){t.update("fake_eventID",t.kaMap.getGeoExtents())},1000);}}
if(eventID&&goOn&&this.kaMap.getCurrentScale()<=300000){var width=extents[2]-extents[0];var height=extents[3]-extents[1];var left=extents[0];var right=extents[2];var top=extents[3];var bottom=extents[1];this.initialExtents=extents;var szURL="map="+this.kaMap.currentMap;szURL+="&extents="+left+','+bottom+','+right+','+top;this.lastSearchDate=(new Date()).getTime();call("/OPO/customKeymap.php?"+szURL,this,this.draw);}
else{this.updateRedViewer(extents);}}
kaKeymap.prototype.updateRedViewer=function(extents){var left=(extents[0]-this.aExtents[0])/this.cellWidth;var width=(extents[2]-extents[0])/this.cellWidth;var top=-1*(extents[3]-this.aExtents[3])/this.cellHeight;var height=(extents[3]-extents[1])/this.cellHeight;this.pxExtent=new Array(left,top,width,height);this.domExtents.style.top=parseInt(top+0.5)+"px";this.domExtents.style.left=parseInt(left+0.5)+"px";this.domEvent.style.top=parseInt(top+0.5)+"px";this.domEvent.style.left=parseInt(left+0.5)+"px";if(parseInt(width+0.5)<parseInt(this.domCross.style.width)||parseInt(height+0.5)<parseInt(this.domCross.style.height)){var ix=parseInt(this.domCross.style.width)/2;var iy=parseInt(this.domCross.style.height)/2;var ox=width/2;var oy=height/2;this.domExtents.style.width=this.domCross.style.width;this.domExtents.style.height=this.domCross.style.height;this.domEvent.style.width=this.domCross.style.width;this.domEvent.style.height=this.domCross.style.height;this.domExtents.style.top=(parseInt(this.domExtents.style.top)-iy+oy)+'px';this.domExtents.style.left=(parseInt(this.domExtents.style.left)-ix+ox)+'px';this.domEvent.style.top=(parseInt(this.domEvent.style.top)-iy+oy)+'px';this.domEvent.style.left=(parseInt(this.domEvent.style.left)-ix+ox)+'px';this.domCross.style.visibility='visible';this.domExtents.style.border='1px solid white';this.domEvent.style.border='none';}
else{this.domExtents.style.width=parseInt(width+0.5)+"px";this.domExtents.style.height=parseInt(height+0.5)+"px";this.domEvent.style.width=parseInt(width+0.5)+"px";this.domEvent.style.height=parseInt(height+0.5)+"px";this.domCross.style.visibility='hidden';this.domExtents.style.border='2px solid red';this.domEvent.style.border='2px solid red';this.domEvent.style.visibility='visible';this.domExtents.style.visibility='visible';}};kaKeymap.prototype.onclick=function(e){e=(e)?e:((event)?event:null);this.kaKeymap.centerMap(e);};kaKeymap.prototype.centerMap=function(e){var pos=this.aPixPos(e.clientX,e.clientY);this.kaMap.zoomTo(pos[0],pos[1]);};kaKeymap.prototype.aPixPos=function(x,y){var obj=this.domObj;var offsetLeft=0;var offsetTop=0;while(obj){offsetLeft+=parseFloat(obj.offsetLeft);offsetTop+=parseFloat(obj.offsetTop);obj=obj.offsetParent;}
var pX=x-offsetLeft;var pY=y-offsetTop;pX=parseFloat(this.aExtents[0]+(this.cellWidth*pX));pY=parseFloat(this.aExtents[3]-(this.cellHeight*pY));return[pX,pY];};kaKeymap.prototype.mousedown=function(e){e=(e)?e:((event)?event:null);this.kaKeymap.domEvent.style.top="0px";this.kaKeymap.domEvent.style.left="0px";this.kaKeymap.domEvent.style.width=this.kaKeymap.domObj.style.width;this.kaKeymap.domEvent.style.height=this.kaKeymap.domObj.style.height;this.kaKeymap.domExtents.init=1;this.kaKeymap.domExtents.oX=e.clientX;this.kaKeymap.domExtents.oY=e.clientY;var amount=50;this.kaKeymap.domExtents.style.backgroundColor='pink';this.kaKeymap.domExtents.style.opacity=amount/100;if(this.kaKeymap.kaMap.isIE4){this.kaKeymap.domExtents.style.filter="Alpha(opacity="+amount+")";}
e=null;};kaKeymap.prototype.mouseup=function(e){if(this.kaKeymap.domExtents.init){e=(e)?e:((event)?event:null);this.kaKeymap.domExtents.style.backgroundColor='transparent';this.kaKeymap.domExtents.style.opacity=1;if(this.kaKeymap.kaMap.isIE4){this.kaKeymap.domExtents.style.filter="Alpha(opacity=100)";}
this.kaKeymap.domExtents.init=0;var cG=this.kaKeymap.geoCentCoord();this.kaKeymap.kaMap.zoomTo(cG[0],cG[1]);}};kaKeymap.prototype.mousemove=function(e){e=(e)?e:((event)?event:null);if(this.kaKeymap.domExtents.init){var xMov=(this.kaKeymap.domExtents.oX-e.clientX);var yMov=(this.kaKeymap.domExtents.oY-e.clientY);var oX=this.kaKeymap.pxExtent[0];var oY=this.kaKeymap.pxExtent[1];var nX=oX-xMov;var nY=oY-yMov;this.kaKeymap.domExtents.oX=e.clientX;this.kaKeymap.domExtents.oY=e.clientY;this.kaKeymap.pxExtent[0]=nX;this.kaKeymap.pxExtent[1]=nY;if(this.kaKeymap.domCross.style.visibility=='visible'){var ix=parseInt(this.kaKeymap.domCross.style.width)/2;var iy=parseInt(this.kaKeymap.domCross.style.height)/2;var ox=this.kaKeymap.pxExtent[2]/2;var oy=this.kaKeymap.pxExtent[3]/2;this.kaKeymap.domExtents.style.top=parseInt((nY+0.5)-iy+oy)+"px";this.kaKeymap.domExtents.style.left=parseInt((nX+0.5)-ix+ox)+"px";}else{this.kaKeymap.domExtents.style.top=parseInt(nY+0.5)+"px";this.kaKeymap.domExtents.style.left=parseInt(nX+0.5)+"px";}}};kaKeymap.prototype.geoCentCoord=function(){var cpX=this.pxExtent[0]+this.pxExtent[2]/2;var cpY=this.pxExtent[1]+this.pxExtent[3]/2;var cX=this.aExtents[0]+(this.cellWidth*cpX);var cY=this.aExtents[3]-(this.cellHeight*cpY);return[cX,cY];};var lib_folder="/OPO/tools/MichelinRoutingAPI/lib/";var img_folder="/OPO/tools/MichelinRoutingAPI/img/";function extraLayers(oKaMap){this.kaMap=oKaMap;this.kaMap.extraLayers=this;this.aLayers=new Array();this.layersBlocDef=new Array();this.resultLayer=null;this.getCustomLayers();};extraLayers.prototype.getCustomLayers=function(){call("/OPO/tools/extraLayers/prepareCustomLayers.php?map="+projectMapName+"&commune="+dataOPO['NAME'].toLowerCase(),this,this.getCustomLayerCallback);}
extraLayers.prototype.getCustomLayerCallback=function(result){try{eval(result);}
catch(e){alert("eval failed");return;}
for(var i=0;i<this.aLayers.length;i++){this.kaMap.removeMapLayer(this.aLayers[i].name);}
this.aLayers.splice(0,this.aLayers.length);if(newScales){this.modifyMapScales(newScales);}
if($d(newLayers)&&Object.keys(newLayers).length>0){for(var i in newLayers){var newLayer=new customLayer(newLayers[i].layerProperties);this.kaMap.addMapLayer(newLayer);newLayer.inputs=newLayers[i].inputs;newLayer.legendImage=newLayers[i].legendImage;this.aLayers.push(newLayer);}
if(this.aLayers.length>0){this.createExtraLayersLegend();if(this.kaMap.getCurrentMap().getQueryableLayers().length>0){this.createSearchBloc();}}}
this.kaMap.triggerEvent(OPO_EXTRALAYERS_READY);}
extraLayers.prototype.createSearchBloc=function(){var t=this;var opt=document.createElement("option");$("searchChooser").appendChild(opt);opt.value="extraLayersDiv";opt.innerHTML="Couches suppl.";var extraLayersDiv=document.createElement("div");extraLayersDiv.id="extraLayersDiv";extraLayersDiv.className="searchBloc";$(extraLayersDiv).hide();var sel=document.createElement("select");extraLayersDiv.appendChild(sel);sel.id="extraLayersDiv_selectLayer";Event.observe($(sel),"change",function(){var newVal=$F($(sel));for(var i=0;i<t.aLayers.length;i++){if($(t.aLayers[i].searchDiv))
$(t.aLayers[i].searchDiv).hide();}
if(newVal!=-1)
$(t.kaMap.getCurrentMap().getLayer(newVal).searchDiv).show();});var opt1=document.createElement("option");sel.appendChild(opt1);opt1.value=-1;opt1.innerHTML="Veuillez choisir";for(var i=0;i<this.aLayers.length;i++){if(this.aLayers[i].isQueryable()&&this.aLayers[i].inputs!=null){var opt=document.createElement("option");sel.appendChild(opt);opt.value=this.aLayers[i].name;opt.innerHTML=this.aLayers[i].name;this.aLayers[i].searchDiv=document.createElement("div");extraLayersDiv.appendChild(this.aLayers[i].searchDiv);$(this.aLayers[i].searchDiv).hide();this.aLayers[i].searchDiv.id="extraLayersDiv_"+(this.aLayers[i].name).replace(/\s/,"");var geoSearchDiv=document.createElement("div");this.aLayers[i].searchDiv.appendChild(geoSearchDiv);geoSearchDiv.className="geoSearchDiv";var table=this.kaMap.utils.createTable(null,1,2);geoSearchDiv.appendChild(table[0]);var content=table[1];var b=document.createElement("b");content[0][0].appendChild(b);var txt=document.createTextNode("Recherche g�ographique :");b.appendChild(txt);var img=document.createElement("img");content[0][1].appendChild(img);img.activated=false;img.style.cursor="pointer";img.src="/OPO/images/icon_query_normal";img.tool=new queryByPointTool(this.kaMap,this.aLayers[i],{name:this.aLayers[i].name+"_queryByPoint",image:img,imagesSource:["/OPO/images/icon_query_normal","/OPO/images/icon_query_clicked"]});img.toolInfos={name:this.aLayers[i].name+"_queryByPoint",image:img,imagesSource:["/OPO/images/icon_query_normal","/OPO/images/icon_query_clicked"]};Event.observe($(img),"click",this.kaMap.interact.toggleTool.bind(this.kaMap.interact,img.toolInfos));var paramSearchDiv=this.getHTMLInputsForLayer(this.aLayers[i]);this.aLayers[i].searchDiv.appendChild(paramSearchDiv);paramSearchDiv.className="paramSearchDiv";var b=document.createElement("b");paramSearchDiv.insertBefore(b,paramSearchDiv.childNodes[0]);var txt=document.createTextNode("Recherche par crit�res");b.appendChild(txt);extraLayersDiv.appendChild(this.aLayers[i].searchDiv);}}
this.kaMap.utils.insertAfter($("tabLeft"),extraLayersDiv,$("poiSearchDiv"));}
extraLayers.prototype.getHTMLInputsForLayer=function(oLayer){var t=this;var divInputs=document.createElement("div");oLayer.DOMinputs=new Array();for(var i=0;i<oLayer.inputs.length;i++){var elem=null;switch(oLayer.inputs[i].type.toUpperCase()){case"TEXTFIELD":elem=createTextField(oLayer,oLayer.inputs[i]);break;case"SELECT":elem=createSelect(oLayer,oLayer.inputs[i]);break;case"RADIO":elem=createRadio(oLayer,oLayer.inputs[i]);break;case"CHECKBOX":elem=createCheckBox(oLayer,oLayer.inputs[i]);break;case"TEXTNODE":elem=createTextNode(oLayer,oLayer.inputs[i]);break;default:alert("type of input unknown (found : "+oLayer.inputs[i].type+")");}
if(elem!=null){divInputs.appendChild(elem);}}
var but=this.kaMap.utils.createButton();divInputs.appendChild(but);but.value="Recherche";but.className="OPObut";but.style.margin="7px 0px 0px 0px";but.oLayer=oLayer;but.onclick=function(e){t.searchMyExtraLayer(e)}
return divInputs;function createTextField(oLayer,inputs){var container=document.createElement("div");container.appendChild(document.createTextNode(inputs.label));container.className="critere";var input=document.createElement("input");container.appendChild(input);input.type="text";input.name=inputs.name;input.queryOperator=inputs.queryOperator;oLayer.DOMinputs.push({type:"textfield",obj:input});return container;}
function createSelect(oLayer,inputs){var container=document.createElement("div");container.appendChild(document.createTextNode(inputs.label));container.className="critere";var sel=document.createElement("select");container.appendChild(sel);sel.name=inputs.name;sel.style.margin="auto";sel.queryOperator=inputs.queryOperator;for(var i=0;i<inputs.options.length;i++){var opt=document.createElement("option");sel.appendChild(opt);opt.value=inputs.options[i].value;opt.innerHTML=inputs.options[i].label;}
oLayer.DOMinputs.push({type:"select",obj:sel});return container;}
function createRadio(oLayer,inputs){var container=document.createElement("div");container.className="critere";var labelObj=document.createElement("label");container.appendChild(labelObj);try{var rad=document.createElement("<input type='radio'>");}
catch(e){var rad=document.createElement("input");rad.type="radio";}
labelObj.appendChild(rad);rad.name=inputs.name;rad.queryOperator=inputs.queryOperator;rad.queryValue=inputs.queryValue;var labTitle=document.createTextNode(inputs.label);labelObj.appendChild(labTitle);oLayer.DOMinputs.push({type:"radio",obj:rad});return container;}
function createCheckBox(oLayer,inputs){var container=document.createElement("div");container.className="critere";var labelObj=document.createElement("label");container.appendChild(labelObj);try{var check=document.createElement("<input type='checkbox'>");}
catch(e){var check=document.createElement("input");check.type="checkbox";}
labelObj.appendChild(check);check.name=inputs.name;check.checked=check.defaultChecked=inputs.defaultChecked;check.queryOperator=inputs.queryOperator;check.queryValue=inputs.queryValue;var labTitle=document.createTextNode(inputs.label);labelObj.appendChild(labTitle);oLayer.DOMinputs.push({type:"checkbox",obj:check});return container;}
function createTextNode(oLayer,inputs){var container=document.createElement("div");container.className="critere";var text=document.createTextNode(inputs.label);container.appendChild(text);return container;}}
extraLayers.prototype.searchMyExtraLayer=function(e){var layerName=$F("extraLayersDiv_selectLayer");if(layerName.toString()=="-1")
return;var oLayer=this.kaMap.getCurrentMap().getLayer(layerName);var params="";if($d(oLayer.DOMinputs)){for(var i=0;i<oLayer.DOMinputs.length;i++){var curObj=oLayer.DOMinputs[i].obj;switch(oLayer.DOMinputs[i].type){case"textfield":if(!(/^\s*$/g).test(curObj.value))
params+=((params=="")?"":"|||")+curObj.name+"#"+curObj.queryOperator+"#"+curObj.value;break;case"select":var selected=curObj.options[curObj.selectedIndex].value;if(selected!=-1)
params+=((params=="")?"":"|||")+curObj.name+"#"+curObj.queryOperator+"#"+selected;break;case"radio":if(curObj.checked)
params+=((params=="")?"":"|||")+curObj.name+"#"+curObj.queryOperator+"#"+curObj.queryValue;break;case"checkbox":if(curObj.checked)
params+=((params=="")?"":"|||")+curObj.name+"#"+curObj.queryOperator+"#"+curObj.queryValue;break;default:alert("not recognized : "+oLayer.DOMinputs[i].type);}}}
if(params!=""){var url="/OPO/proxy.php?page=/OPO/searchByString2.php&commune="+dataOPO['NAME'].toLowerCase()+"&layer="+oLayer.name+"&params="+escape(params);if(this.resultLayer!=null&&$d(this.resultLayer.sessionId))
url+="&sessionid="+this.resultLayer.sessionId;this.kaMap.interact.lastSearchDiv=$("extraLayersDiv_"+(oLayer.name).replace(/\s/,""));this.kaMap.interact.bDisplayLabels=true;$("searchDiv_sablier").show();call(url,this,this.queryCallback);}}
extraLayers.prototype.queryCallback=function(query){$("searchDiv_sablier").hide();try{eval(query);}
catch(e){console.log("eval failed");console.log(query);}
if($d(this.resultLayer)&&this.resultLayer!=null){this.kaMap.removeMapLayer(this.resultLayer.name);}
if($d(newLayer)&&newLayer!=null){this.resultLayer=new resultLayer(newLayer.layerProperties);this.resultLayer.sessionId=sessionId;this.kaMap.addMapLayer(this.resultLayer);this.kaMap.setLayerOpacity(this.resultLayer.name,50);}
if($d(data)&&data!=null&&data.length>0){data.bDisplayLabels=true;this.kaMap.interact.displayData(data);}
else
this.kaMap.interact.displayNoResults();if($d(data)&&data!=null&&data.length==1){data.bDisplayLabels=true;new POIdetails(this.kaMap,data);}}
extraLayers.prototype.createExtraLayersLegend=function(){var t=this;this.domObj=document.createElement("div");this.kaMap.domObj.appendChild(this.domObj);this.domObj.style.position="absolute";this.domObj.style.top="40px";this.domObj.style.left="-1000px";this.domObj.style.zIndex="6";this.toggler=document.createElement("img");this.domObj.appendChild(this.toggler);this.toggler.src="/OPO/images/toolBar_toggler_left_open.png";this.toggler.style.cssFloat="right";this.toggler.style.styleFloat="right";this.toggler.style.cursor="pointer";this.toggler.onclick=function(){if(t.visible)t.closeLegend();else t.openLegend()}
this.kaMap.utils.setOpacity(this.toggler,90);this.container=document.createElement("div");this.domObj.appendChild(this.container);this.container.id="extraLayersContainer";this.mainTable=document.createElement("table");this.mainTable.className="mainTable";this.container.appendChild(this.mainTable);var tbody=document.createElement("tbody");this.mainTable.appendChild(tbody);for(var i=0;i<this.aLayers.length;i++){var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.appendChild(this.createLayerLegend(this.aLayers[i]));}
for(var i=0;i<this.aLayers.length;i++){this.aLayers[i].mixer.initDrag();}
if(this.toggler.complete==true)
this.setStylesAndPositions();else
this.toggler.onload=function(){t.setStylesAndPositions()};}
extraLayers.prototype.setStylesAndPositions=function(){if(typeof this.styleAndPositionIsSet!="undefined"&&this.styleAndPositionIsSet)
return;this.toggler.width=this.kaMap.getObjectWidth(this.toggler);this.toggler.height=this.kaMap.getObjectHeight(this.toggler);this.mainTable.width=this.kaMap.getObjectWidth(this.mainTable);var domObjWidth=parseInt(this.mainTable.width)+parseInt(this.toggler.width);this.container.style.marginRight=this.toggler.width+"px";this.container.style.width=this.mainTable.width+"px";this.domObj.style.width=domObjWidth+1+"px";this.domObj.style.left=-this.mainTable.width+"px";if(this.kaMap.getObjectHeight(this.container)<this.toggler.height)
this.container.style.height=this.toggler.height+"px";else
this.container.style.height="auto";this.styleAndPositionIsSet=true;}
extraLayers.prototype.createLayerLegend=function(oLayer){var t=this;var table=document.createElement("table");this.container.appendChild(table);table.className="layerTable";var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);try{var checkBox=document.createElement("<input type='checkbox'>");}
catch(e){var checkBox=document.createElement("input");checkBox.type="checkbox";}
td.appendChild(checkBox);checkBox.checked=true;checkBox.defaultChecked=true;checkBox.oLayer=oLayer;checkBox.onclick=function(e){t.toggleLayerVisibility(e)};var td=document.createElement("td");tr.appendChild(td);var text=document.createTextNode(oLayer.name);td.appendChild(text);td.className="label";var td=document.createElement("td");tr.appendChild(td);oLayer.mixer=new smallMixer(this.kaMap,oLayer);td.appendChild(oLayer.mixer.draw());if(oLayer.legendImage!=null){var td=document.createElement("td");tr.appendChild(td);td.className="infoLegend";var img=document.createElement("img");td.appendChild(img);img.src="/OPO/images/icon_infoLegende.png";img.alt=img.title="voir la l�gende";img.style.cursor="pointer";img.popUpImgSrc=oLayer.legendImage;img.onclick=function(e){t.createPopUpLegend(e)};}
return table;}
extraLayers.prototype.createPopUpLegend=function(e){e=(e)?e:((event)?event:null);var src=this.kaMap.utils.getEventSrc(e);var x=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var pop=new flyingPopUp(this.kaMap,"Legende",x+30,y);pop.domObj.style.width="300px";pop.setContent("<img src='"+src.popUpImgSrc+"' width=300>");}
extraLayers.prototype.openLegend=function(){var t=this;new Effect.Morph(this.domObj,{style:"left : 0px",afterFinish:function(){t.visible=true;t.toggler.src="/OPO/images/toolBar_toggler_left_close.png"}});}
extraLayers.prototype.closeLegend=function(){var t=this;var dist=this.kaMap.getObjectWidth(this.container);new Effect.Morph(this.domObj,{style:"left : "+(-dist)+"px",afterFinish:function(){t.visible=false;t.toggler.src="/OPO/images/toolBar_toggler_left_open.png"}});}
extraLayers.prototype.toggleLayerVisibility=function(e){e=(e)?e:((event)?event:null);var src=Event.element(e);var oLayer=src.oLayer;this.kaMap.setLayerVisibility(oLayer.name,src.checked);}
extraLayers.prototype.modifyMapScales=function(newScales){var oMap=this.kaMap.getCurrentMap();oMap.aScales=oMap.aScales.concat(newScales);oMap.aScales.sort(function(x,y){return parseFloat(y)-parseFloat(x)});for(var i=0;i<oMap.aScales.length;i++){oMap.aScales[i]=oMap.aScales[i].toString();}
this.kaMap.progZoomer.update();}
function queryByPointTool(oKaMap,oLayer,oInfosTool){kaTool.apply(this,[oKaMap]);this.layer=oLayer;this.name=oLayer.name+"_queryByPoint";this.bInfoTool=false;this.cursor=["help"];for(var p in kaTool.prototype){if(!queryByPointTool.prototype[p])
queryByPointTool.prototype[p]=kaTool.prototype[p];}
this.kaMap.interact.aTools.push(oInfosTool);this.domObj=document.createElement('div');this.domObj.style.position='absolute';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';this.domObj.style.zIndex=100;this.domObj.style.visibility='hidden';this.domObj.style.border='1px solid blue';this.domObj.style.backgroundColor='white';this.domObj.style.opacity=0.50;this.domObj.style.mozOpacity=0.50;this.domObj.style.filter='Alpha(opacity=50)';this.kaMap.theInsideLayer.appendChild(this.domObj);this.startx=null;this.starty=null;this.endx=null;this.endy=null;this.bMouseDown=false;}
queryByPointTool.prototype.onmousedown=function(e){e=(e)?e:((event)?event:null);if(e.button==2){Event.stop(e);return false;}
else{if(this.kaMap.isIE4)
document.onkeydown=kaTool_redirect_onkeypress;document.onkeypress=kaTool_redirect_onkeypress;this.bMouseDown=true;var x=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var aPixPos=this.adjustPixPosition(x,y);this.startx=this.endx=-aPixPos[0];this.starty=this.endy=-aPixPos[1];this.drawQueryBox();Event.stop(e);return false;}}
queryByPointTool.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);if(!this.bMouseDown)
return false;var x=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var aPixPos=this.adjustPixPosition(x,y);this.endx=-aPixPos[0];this.endy=-aPixPos[1];this.drawQueryBox();return false;}
queryByPointTool.prototype.onmouseup=function(e){var start=this.kaMap.pixToGeo(-this.startx,-this.starty);var coords=[];coords=start.concat(this.kaMap.pixToGeo(-this.endx,-this.endy));if(coords[2]<coords[0]){var minx=coords[2];var maxx=coords[0];coords[0]=minx;coords[2]=maxx;}
if(coords[1]<coords[3]){var miny=coords[1];var maxy=coords[3];coords[3]=miny;coords[1]=maxy;}
this.startx=this.endx=this.starty=this.endy=null;this.drawQueryBox();var params="page=/OPO/searchByPosition2.php";params+="&commune="+dataOPO['NAME'].toLowerCase();params+="&qtype=byPoint";params+="&group="+this.layer.name;params+="&a="+Math.round(coords[0]*100)/100+","+Math.round(coords[1]*100)/100;params+="&b="+Math.round(coords[2]*100)/100+","+Math.round(coords[1]*100)/100;params+="&c="+Math.round(coords[2]*100)/100+","+Math.round(coords[3]*100)/100;params+="&d="+Math.round(coords[0]*100)/100+","+Math.round(coords[3]*100)/100;if(this.kaMap.extraLayers.resultLayer!=null&&$d(this.kaMap.extraLayers.resultLayer.sessionId))
params+="&sessionid="+this.kaMap.extraLayers.resultLayer.sessionId;var url="OPO/proxy.php?"+encodeURI(params);call(url,this,this.queryCallback);}
queryByPointTool.prototype.onmouseout=function(e){e=(e)?e:((event)?event:null);if(!e.target)e.target=e.srcElement;if(e.target.id==this.kaMap.domObj.id){this.bMouseDown=false;this.startx=this.endx=this.starty=this.endy=null;this.drawQueryBox();return kaTool.prototype.onmouseout.apply(this,[e]);}}
queryByPointTool.prototype.drawQueryBox=function(){if(this.startx==null||this.starty==null||this.endx==null||this.endy==null){this.domObj.style.visibility='hidden';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';return;}
this.domObj.style.visibility='visible';if(this.endx<this.startx){this.domObj.style.left=(this.endx-this.kaMap.xOrigin)+'px';this.domObj.style.width=(this.startx-this.endx)+"px";}else{this.domObj.style.left=(this.startx-this.kaMap.xOrigin)+'px';this.domObj.style.width=(this.endx-this.startx)+"px";}
if(this.endy<this.starty){this.domObj.style.top=(this.endy-this.kaMap.yOrigin)+'px';this.domObj.style.height=(this.starty-this.endy)+"px";}else{this.domObj.style.top=(this.starty-this.kaMap.yOrigin)+'px';this.domObj.style.height=(this.endy-this.starty)+"px";}};queryByPointTool.prototype.queryCallback=function(query){try{eval(query);}
catch(e){console.log("eval failed");console.log(query);return;}
if(this.kaMap.extraLayers.resultLayer!=null){this.kaMap.removeMapLayer(this.kaMap.extraLayers.resultLayer.name);}
if(newLayer!=null){this.kaMap.extraLayers.resultLayer=new resultLayer(newLayer.layerProperties);this.kaMap.extraLayers.resultLayer.sessionId=sessionId;this.kaMap.addMapLayer(this.kaMap.extraLayers.resultLayer);this.kaMap.setLayerOpacity(this.kaMap.extraLayers.resultLayer.name,50);}
if($d(data)&&data!=null&&data.length>0){data.bDisplayLabels=true;new POIdetails(this.kaMap,data);}
else{new POIdetails(this.kaMap,{TO_SHOW_DETAIL:{"":"Pas de donn�e"}});}}
var ViaM_ns=false;var ViaM_moz=false;var ViaM_ie=false;var ViaM_saf=false;if(navigator.userAgent.indexOf("Firefox")!=-1){ViaM_moz=true;}else if(navigator.userAgent.indexOf("MSIE")!=-1){ViaM_ie=true;}else if(navigator.userAgent.indexOf("Netscape")!=-1){ViaM_ns=true;}else if(navigator.userAgent.indexOf("Safari")!=-1){ViaM_saf=true;}
function IsNumeric(sText){var ValidChars="-0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1){IsNumber=false;}}
return IsNumber;};function setElementOpacity(id,opacity){if((opacity==100)&&(ViaM_ie))
document.getElementById(id).style.filter="none";else if(ViaM_ie)
document.getElementById(id).style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+")";else if(ViaM_moz)
document.getElementById(id).style.MozOpacity=opacity/100;else
document.getElementById(id).style.opacity=opacity/100;};function disableFormElements(f){for(cpt=0;cpt<f.elements.length;cpt++){f.elements[cpt].disabled=true;}};function enableFormElements(f){for(cpt=0;cpt<f.elements.length;cpt++){f.elements[cpt].disabled=false;}};function showDocElement(id){if(document.getElementById(id)){document.getElementById(id).style.visibility='visible';}else{}};function hideDocElement(id){if(document.getElementById(id)){document.getElementById(id).style.visibility='hidden';}else{}};function displayDocElement(id){if(document.getElementById(id)){document.getElementById(id).style.display='';}else{}};function unDisplayDocElement(id){if(document.getElementById(id)){document.getElementById(id).style.display='none';}else{}};function showGeneratedMap(oGeneratedMap){if(document.getElementById('mapDiv')){var img=document.getElementById('carteDyn');img.style.height=oGeneratedMap.mapDefinitions.byId.MapHeight+"px";img.style.width=oGeneratedMap.mapDefinitions.byId.MapWidth+"px";img.src=oGeneratedMap.mapURL;}};function showItineraryMap(mapId,mapWidth,mapHeight,oititraceList){ititraceList=oititraceList;mapManagement_getMapByID(mapId,mapWidth,mapHeight,null,0,true,null,null,oititraceList);};function showItineraryDetailMap(mapId,mapWidth,mapHeight,oititraceList,mapdiv,carteDyn){ititraceList=oititraceList;var mainMap=generatedMap;var genMap=mapManagement_getMapByID_sync(mapId,mapWidth,mapHeight,null,currImgFormat,true,null,null,oititraceList);if(document.getElementById(mapdiv)){var mapDiv=document.getElementById(mapdiv);mapDiv.style.height=genMap.mapDefinitions.byId.MapHeight+"px";mapDiv.style.width=genMap.mapDefinitions.byId.MapWidth+"px";var img=document.getElementById(carteDyn);img.style.height=genMap.mapDefinitions.byId.MapHeight+"px";img.style.width=genMap.mapDefinitions.byId.MapWidth+"px";img.src=genMap.mapURL;displayDocElement(mapdiv);showDocElement(mapdiv);showDocElement(carteDyn);}
generatedMap=mainMap;};function showItineraryRoadmap(htmlCode){if(document.getElementById('ItineraryRoadMap')){showDocElement('ItineraryRoadMap');document.getElementById('ItineraryRoadMap').innerHTML=htmlCode;}};function hideMap(){unDisplayDocElement('mapDiv');hideDocElement('mapDiv');hideDocElement('carteDyn');hideDocElement('mapScaleBar');if(get("mlNorth")){get("mlNorth").style.visibility="hidden";}
if(get("mlWest")){get("mlWest").style.visibility="hidden";}
if(get("mlSouth")){get("mlSouth").style.visibility="hidden";}
if(get("mlEast")){get("mlEast").style.visibility="hidden";}
if(get("mlNWVert")){get("mlNWVert").style.visibility="hidden";get("mlNWHor").style.visibility="hidden";}
if(get("mlSWVert")){get("mlSWVert").style.visibility="hidden";get("mlSWHor").style.visibility="hidden";}
if(get("mlSEVert")){get("mlSEVert").style.visibility="hidden";get("mlSEHor").style.visibility="hidden";}
if(get("mlNEVert")){get("mlNEVert").style.visibility="hidden";get("mlNEHor").style.visibility="hidden";}};function displayError(errorMsg,errorMsgDetail){var date=new Date();var msg='<b>['+date.toUTCString()+']</b><br/> ';if((errorMsg!=null)&&(typeof(errorMsg)!="undefined")){msg+=errorMsg+'<br/><br/>';}
alert("error : one of step was not found");};function clearErrorBlockMessage(){document.getElementById("DivErrorBlockMessage").innerHTML="";};function genMapByID(mapId,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,ititrace){mapManagement_getMapByID(mapId,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,ititrace);};function genMapByScale(psize,coord,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,ititrace){mapManagement_getMapByScale(psize,coord,width,height,mapActionList,imgFormat,withCopyright,pinLogoList,polylinesList,ititrace);};function opacityController(oKaMap){this.kaMap=oKaMap;this.currentOrthoOpacity=0;this.chrono=null;this.isRunning=false;this.isDragging=false;this.kaMap.registerForEvent(KAMAP_INITIALIZED,this,this.draw);}
opacityController.prototype.draw=function(){var t=this;this.domObj=document.createElement("div");this.kaMap.domObj.appendChild(this.domObj);this.domObj.id="opacityController";this.domObj.style.visibiliy="hidden";this.setOpacityOfController(0.7);this.domObj.onmouseover=function(){t.setOpacityOfController(1)};this.domObj.onmouseout=function(){t.setOpacityOfController(0.8)};var table=document.createElement("table");table.id="opacityController_tableText";this.domObj.appendChild(table);table.cellSpacing="0";table.style.borderSpacing="0px";var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);td.className="td1";td.innerHTML=tra['opController_map'];var td=document.createElement("td");tr.appendChild(td);td.className="td2";td.innerHTML=tra['opController_satellite'];var table=document.createElement("table");this.domObj.appendChild(table);table.cellSpacing="0";table.style.borderSpacing="0px";table.id="opacityController_table";var tbody=document.createElement("tbody");table.appendChild(tbody);var tr=document.createElement("tr");tbody.appendChild(tr);var td=document.createElement("td");tr.appendChild(td);var imageMINUS=document.createElement("img");td.appendChild(imageMINUS);imageMINUS.className="opacityController_imgPLUSMINUS";imageMINUS.src="/OPO/tools/opacityController/images/MINUS.gif";imageMINUS.onmousedown=function(){t.isRunning=true;t.opacityLoop(-4);};imageMINUS.onmouseup=function(){clearTimeout(this.chrono);t.isRunning=false;};var td=document.createElement("td");tr.appendChild(td);this.support=document.createElement("div");td.appendChild(this.support);this.support.id="opControl_support";this.support.style.position="relative";this.support.onclick=function(e){t.handleSupportClick(e)};this.dragger=document.createElement("div");this.support.appendChild(this.dragger);this.dragger.id="opControl_dragger";this.dragger.style.position="absolute";this.dragger.style.left="-1px";this.dragger.style.top=-(this.kaMap.getObjectHeight(this.dragger)-this.kaMap.getObjectHeight(this.support))/2-1+"px";var td=document.createElement("td");tr.appendChild(td);var imagePLUS=document.createElement("img");td.appendChild(imagePLUS);imagePLUS.src="/OPO/tools/opacityController/images/PLUS.gif";imagePLUS.className="opacityController_imgPLUSMINUS";imagePLUS.onmousedown=function(){t.isRunning=true;t.opacityLoop(4);};imagePLUS.onmouseup=function(){t.isRunning=false;};this.checkScale();this.kaMap.registerForEvent(KAMAP_SCALE_CHANGED,this,this.checkScale);this.supportWidth=this.kaMap.getObjectWidth(this.support);this.supportHeight=this.kaMap.getObjectHeight(this.support);this.draggerWidth=this.kaMap.getObjectWidth(this.dragger);this.draggerHeight=this.kaMap.getObjectHeight(this.dragger);Drag.init(this.dragger,null,-1,this.supportWidth-this.draggerWidth-1,this.dragger.offsetTop,this.dragger.offsetTop);this.dragger.onDragStart=function(){t.isDragging=true};this.dragger.onDragEnd=function(){t.isDragging=false;t.setOpacityOfController(0.8)};this.dragger.onDrag=function(){t.updateOpacity()};this.updateDraggerPosition();this.kaMap.registerForEvent(KAMAP_SCALE_CHANGED,this,this.updateDraggerPosition);};opacityController.prototype.checkScale=function(){if(this.kaMap.getCurrentMap().getLayer("orthophotos").isVisible()){this.domObj.style.visibility="visible";}
else{this.domObj.style.visibility="hidden";}};opacityController.prototype.setOpacityOfController=function(amount){if(!this.isDragging){this.domObj.style.opacity=amount;this.domObj.style.mozOpacity=amount;this.domObj.style.filter="Alpha(opacity="+(amount*100)+")";}};opacityController.prototype.updateOpacity=function(){var range=this.supportWidth-this.draggerWidth;this.currentOrthoOpacity=Math.round((this.dragger.offsetLeft*100)/range);if(this.currentOrthoOpacity<=5){this.mySetLayerVisibility('orthophotos',false);}
else{this.mySetLayerVisibility('orthophotos',true);this.kaMap.setLayerOpacity('orthophotos',this.currentOrthoOpacity);}
if(this.currentOrthoOpacity>=95){this.mySetLayerVisibility('basemap',false);}
else{this.mySetLayerVisibility('basemap',true);}};opacityController.prototype.mySetLayerVisibility=function(name,bVisible){var layer=this.kaMap.getCurrentMap().getLayer(name);if(layer.visible!=bVisible){if(!this.kaMap.loadUnchecked&&bVisible){layer.visible=true;this.kaMap.setMapLayers();if(layer.domObj){layer.domObj.style.visibility=bVisible?'visible':'hidden';layer.domObj.style.display=bVisible?'block':'none';for(var i=0;i<layer.domObj.childNodes.length;i++){layer.setTile(layer.domObj.childNodes[i]);}}
this.kaMap.paintLayer(layer);}
else{if(layer.domObj){layer.visible=false;layer.domObj.style.visibility=bVisible?'visible':'hidden';layer.domObj.style.display=bVisible?'block':'none';for(var i=0;i<layer.domObj.childNodes.length;i++){layer.setTile(layer.domObj.childNodes[i]);}}}}};opacityController.prototype.handleSupportClick=function(e){e=(e)?e:((event)?event:null);var src=(e.target)?e.target:((e.srcElement)?e.srcElement:null);if(src.id=="opControl_support"){var relPos=(typeof(e.offsetX)!="undefined")?(e.offsetX):((typeof(e.layerX)!="undefined")?(e.layerX):null);relPos=Math.round(relPos-this.draggerWidth/2);if(relPos>this.supportWidth-this.draggerWidth){relPos=this.supportWidth-this.draggerWidth;}
if(relPos<=0)
relPos=-1;this.dragger.style.left=relPos+"px";this.updateOpacity();}};opacityController.prototype.updateDraggerPosition=function(){var range=this.supportWidth-this.draggerWidth;var amount=Math.round((range/100)*this.currentOrthoOpacity);if(amount<=0)amount=-1;this.dragger.style.left=amount+"px";this.updateOpacity();};opacityController.prototype.cancelEvent=function(e){e=(e)?e:((event)?event:null);e.cancelBubble=true;e.returnValue=false;if(e.preventDefault){e.preventDefault();}
if(e.stopPropogation){e.stopPropogation();}}
opacityController.prototype.opacityLoop=function(amount){this.setOpacityOfLayers(amount);var t=this;if(this.isRunning){this.chrono=setTimeout(function(){t.opacityLoop(amount)},50);}
else{clearTimeout(this.chrono);}};opacityController.prototype.setOpacityOfLayers=function(amount){if(amount>0&&this.currentOrthoOpacity<100){this.currentOrthoOpacity=(this.currentOrthoOpacity+amount>100)?100:(this.currentOrthoOpacity+amount);this.kaMap.setLayerOpacity("orthophotos",this.currentOrthoOpacity);}
if(amount<0&&this.currentOrthoOpacity>0){this.currentOrthoOpacity=(this.currentOrthoOpacity+amount<0)?0:(this.currentOrthoOpacity+amount);this.kaMap.setLayerOpacity("orthophotos",this.currentOrthoOpacity);}
this.updateDraggerPosition();};function customLayer(layerParameters){_layer.apply(this,[layerParameters]);for(var p in _layer.prototype){if(!customLayer.prototype[p])
customLayer.prototype[p]=_layer.prototype[p];}};customLayer.prototype.setTile=function(img){var l=safeParseInt(img.style.left)+this._map.kaMap.xOrigin;var t=safeParseInt(img.style.top)+this._map.kaMap.yOrigin;var szImageformat='';if(this.imageformat&&this.imageformat!=''){szImageformat='&i='+this.imageformat;}
var szScale="&s="+this._map.aScales[this._map.currentScale];var groupName="&g="+this.name;var src="http://"+subDomain+".kamap.swissgeo.ch/OPO/tile_customLayer.php"+'t='+t+'&l='+l+groupName+szScale+szImageformat;if(arguments[1]){src+='&force=true';}
if(img.src!=src){img.style.visibility='hidden';img.src=src;}};function kaMapPopUp(oKaMap,id){this.kaMap=oKaMap;this.kaMap.kaMapPopUp=this;var topPosition=null;if(arguments.length>2){topPosition=arguments[2];}
return this.createKaMapPopUp(id,topPosition);};kaMapPopUp.prototype.createKaMapPopUp=function(id,topPosition){this.disableBody();var navigator=this.kaMap.getRawObject("mainContainer");var navigatorWidth=this.kaMap.getObjectWidth(navigator);var navigatorHeight=this.kaMap.getObjectHeight(navigator);var a=this.kaMap.findObjectPos(navigator);var navigatorLeft=a[0];var navigatorTop=a[1];this.popUp=document.createElement("div");document.body.appendChild(this.popUp);this.popUp.id=id;this.popUp.style.position="absolute";this.popUp.style.zIndex="10";var popUpWidth=this.kaMap.getObjectWidth(this.popUp);var popUpHeight=this.kaMap.getObjectWidth(this.popUp);this.popUp.style.left=navigatorLeft+(navigatorWidth/2)-(popUpWidth/2)+"px";if(topPosition)
this.popUp.style.top=topPosition+"px";else
this.popUp.style.top=navigatorTop+(navigatorHeight/2)-(popUpHeight/2)+"px";return this;};kaMapPopUp.prototype.setText=function(content){this.popUp.innerHTML=content;};kaMapPopUp.prototype.disableBody=function(){this.disabler=document.createElement("div");document.body.appendChild(this.disabler);this.disabler.id="PopUpDisabler";this.disabler.style.position="absolute";this.disabler.style.top="0px";this.disabler.style.left="0px";this.disabler.style.width="100%";this.disabler.style.height="100%";if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){var aSelects=document.getElementsByTagName("select");for(var i=0;i<aSelects.length;i++){aSelects[i].style.visibility="hidden";}}};kaMapPopUp.prototype.destroyKaMapPopUp=function(){var t=this;document.body.removeChild(this.kaMap.getRawObject(this.popUp));document.body.removeChild(this.kaMap.getRawObject("PopUpDisabler"));if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){var aSelects=document.getElementsByTagName("select");for(var i=0;i<aSelects.length;i++){aSelects[i].style.visibility="visible";}}};var KAMAP_QUERY=gnLastEventId++;var KAMAP_POINT_QUERY=0;var KAMAP_RECT_QUERY=1;var KAMAP_MOUSE_STOPPED=2;function kaQuery(oKaMap,type){kaTool.apply(this,[oKaMap]);this.type=type;if(this.type==KAMAP_MOUSE_STOPPED){this.bInfoTool=true;if(arguments.length==3){this.delay=arguments[2];}else{alert("Incorrect nb of arguments for instance kaQuery. Delay will be set by default to 500ms");this.delay=500;}}
this.name='kaQuery';this.cursor='help';this.startx=null;this.starty=null;this.endx=null;this.endy=null;this.bMouseDown=false;this.coords=new Array();this.mouseStopped=false;this.chrono=null;this.domObj=document.createElement('div');this.domObj.style.position='absolute';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';this.domObj.style.zIndex=50;this.domObj.style.visibility='hidden';this.domObj.style.border='1px solid red';this.domObj.style.backgroundColor='white';this.domObj.style.opacity=0.50;this.domObj.style.mozOpacity=0.50;this.domObj.style.filter='Alpha(opacity=50)';this.kaMap.theInsideLayer.appendChild(this.domObj);for(var p in kaTool.prototype){if(!kaQuery.prototype[p])
kaQuery.prototype[p]=kaTool.prototype[p];}};kaQuery.prototype.drawZoomBox=function(){if(this.startx==null||this.starty==null||this.endx==null||this.endy==null){this.domObj.style.visibility='hidden';this.domObj.style.top='0px';this.domObj.style.left='0px';this.domObj.style.width='1px';this.domObj.style.height='1px';return;}
this.domObj.style.visibility='visible';if(this.endx<this.startx){this.domObj.style.left=(this.endx-this.kaMap.xOrigin)+'px';this.domObj.style.width=(this.startx-this.endx)+"px";}
else{this.domObj.style.left=(this.startx-this.kaMap.xOrigin)+'px';this.domObj.style.width=(this.endx-this.startx)+"px";}
if(this.endy<this.starty){this.domObj.style.top=(this.endy-this.kaMap.yOrigin)+'px';this.domObj.style.height=(this.starty-this.endy)+"px";}else{this.domObj.style.top=(this.starty-this.kaMap.yOrigin)+'px';this.domObj.style.height=(this.endy-this.starty)+"px";}};kaQuery.prototype.onmousemove=function(e){e=(e)?e:((event)?event:null);if(this.type!=KAMAP_MOUSE_STOPPED){if(!this.bMouseDown){return false;}}
var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));var adjCoords=this.adjustPixPosition(x,y);if(this.type==KAMAP_MOUSE_STOPPED){var p=this.kaMap.pixToGeo(adjCoords[0],adjCoords[1]);this.coords[0]=p[0];this.coords[1]=p[1];if(this.chrono!=null)
clearTimeout(this.chrono);var t=this;if(this.mouseStopped==false){this.chrono=setTimeout(function(){t.onmousestop(x,y)},this.delay);}}
if(this.type==KAMAP_RECT_QUERY){this.endx=-adjCoords[0];this.endy=-adjCoords[1];this.drawZoomBox();}
return false;};kaQuery.prototype.onmousestop=function(mouseX,mouseY){clearTimeout(this.chrono);var mouseCoords=new Array(mouseX,mouseY);this.mouseStopped=true;this.kaMap.triggerEvent(KAMAP_MOUSE_STOPPED,this.type,this.coords,mouseCoords);this.mouseStopped=false;return;};kaQuery.prototype.onmouseout=function(e){e=(e)?e:((event)?event:null);clearTimeout(this.chrono);if(!e.target)e.target=e.srcElement;if(e.target.id==this.kaMap.domObj.id){this.bMouseDown=false;this.startx=this.endx=this.starty=this.endy=null;this.drawZoomBox();return kaTool.prototype.onmouseout.apply(this,[e]);}};kaQuery.prototype.onmousedown=function(e){e=(e)?e:((event)?event:null);if(this.type!=KAMAP_MOUSE_STOPPED){if(e.button==2){return this.cancelEvent(e);}
else{if(this.kaMap.isIE4)
document.onkeydown=kaTool_redirect_onkeypress;document.onkeypress=kaTool_redirect_onkeypress;this.bMouseDown=true;var x=e.pageX||(e.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));var y=e.pageY||(e.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));var aPixPos=this.adjustPixPosition(x,y);this.startx=this.endx=-aPixPos[0];this.starty=this.endy=-aPixPos[1];this.drawZoomBox();e.cancelBubble=true;e.returnValue=false;if(e.stopPropagation)e.stopPropagation();if(e.preventDefault)e.preventDefault();return false;}}};kaQuery.prototype.onmouseup=function(e){e=(e)?e:((event)?event:null);if(this.type!=KAMAP_MOUSE_STOPPED){var type=KAMAP_POINT_QUERY;var start=this.kaMap.pixToGeo(-this.startx,-this.starty);var coords=start;if(this.startx!=this.endx&&this.starty!=this.endy){type=KAMAP_RECT_QUERY;coords=start.concat(this.kaMap.pixToGeo(-this.endx,-this.endy));if(coords[2]<coords[0]){var minx=coords[2];var maxx=coords[0];coords[0]=minx;coords[2]=maxx;}
if(coords[1]<coords[3]){var miny=coords[1];var maxy=coords[3];coords[3]=miny;coords[1]=maxy;}}
this.kaMap.triggerEvent(KAMAP_QUERY,type,coords);this.startx=this.endx=this.starty=this.endy=null;this.drawZoomBox();}
return false;};function setItineraryOptions(){var vehicleType=document.forms["GetRouteForm"].GetRoute_vehicleType;if((vehicleType.value=="2")||(vehicleType.value=="3")){unDisplayDocElement("TR_ItiType");unDisplayDocElement("TR_ItiPreferences");unDisplayDocElement("TR_ItiConsumption1");unDisplayDocElement("TR_ItiConsumption2");unDisplayDocElement("TR_tollCategory");}else{displayDocElement("TR_ItiType");displayDocElement("TR_ItiPreferences");displayDocElement("TR_ItiConsumption1");displayDocElement("TR_ItiConsumption2");displayDocElement("TR_tollCategory");}};function getRoute(f){var itiDate=f.elements["GetRoute_itiDate"].value;var vehicleType=f.elements["GetRoute_vehicleType"].value;var itiType=f.elements["GetRoute_itiType"].value;var favourMotorways=f.elements["GetRoute_favourMotorways"].checked;var avoidCrossingBorders=f.elements["GetRoute_avoidCrossingBorders"].checked;var avoidTolls=f.elements["GetRoute_avoidTolls"].checked;var avoidRoadTaxAreas=f.elements["GetRoute_avoidRoadTaxAreas"].checked;var avoidOffroadConnections=f.elements["GetRoute_avoidOffroadConnections"].checked;var avoidMountainPass=f.elements["GetRoute_avoidMountainPass"].checked;var itiPref=new ItineraryPreferences(favourMotorways,avoidCrossingBorders,avoidTolls,avoidRoadTaxAreas,avoidOffroadConnections,avoidMountainPass);var fuelCost=new Cost(f.elements["GetRoute_fuelPrice"].value,f.elements["GetRoute_fuelCurr"].value);var fuelConsumption=new Array();fuelConsumption[fuelConsumption.length]=f.elements["GetRoute_urbanConsumption"].value;fuelConsumption[fuelConsumption.length]=f.elements["GetRoute_roadConsumption"].value;fuelConsumption[fuelConsumption.length]=f.elements["GetRoute_highwayConsumption"].value;var itiOptions=new ItineraryOptions(itiDate,vehicleType,itiType,itiPref,fuelCost,fuelConsumption);var detailLevel=f.elements["GetRoute_detailLevel"].value;var language=f.elements["GetRoute_language"].value;var instructionsFormat=f.elements["GetRoute_format"].value;var tollCategory=f.elements["GetRoute_tollCategory"].value;var presentationOptions=new ExtendedPresentationOptions(detailLevel,language,instructionsFormat,tollCategory);var responseElts=f.elements["GetRoute_responseElements"].value;var mapDefCalc=f.elements["GetRoute_MapdefExpected"].value;var mainMapWidth=f.elements["GetRoute_MainMapWidth"].value;var mainMapHeight=f.elements["GetRoute_MainMapHeight"].value;var blocMapWidth=f.elements["GetRoute_DetailMapWidth"].value;var blocMapHeight=f.elements["GetRoute_DetailMapHeight"].value;var responseOptions=new ResponseOptions(responseElts,mapDefCalc,mainMapWidth,mainMapHeight,blocMapWidth,blocMapHeight);var itiRequest=new ItineraryRequest(locDefinitionList,itiOptions,presentationOptions,responseOptions);var vehicleType=document.forms["GetRouteForm"].GetRoute_vehicleType;if((vehicleType.value=="2")||(vehicleType.value=="3")){routeCalculation_getRouteNonMotorized(itiRequest);}else{routeCalculation_getRoute(itiRequest);}};var currentItiTrace=null;var locDefinitionList=new Array();function addLocDefinition(locId,tableName){var locDef=new LocDefinition(null,locId,null);insertLocDefinition(locDef,tableName);};function insertLocDefinition(locDef,tableName){locDefinitionList[locDefinitionList.length]=locDef;};function delLocDefinition(tableName){if(locDefinitionList.length>0){var tmpLocDefinitionList=new Array();for(cpt=0;cpt<locDefinitionList.length;cpt++){if(!document.getElementById('locDef'+cpt).checked){tmpLocDefinitionList[tmpLocDefinitionList.length]=locDefinitionList[cpt];}}
oTable=document.getElementById(tableName);nbitem=locDefinitionList.length;for(curr_row=nbitem;curr_row>0;curr_row--){oTable.deleteRow(curr_row);}
locDefinitionList=new Array();for(cpt=0;cpt<tmpLocDefinitionList.length;cpt++){insertLocDefinition(tmpLocDefinitionList[cpt],tableName);}}};function searchAddresse(inputAddress,mode,ambi){var oInputAddressList=new Array();oInputAddressList[oInputAddressList.length]=inputAddress;geocoding_getLocationList_sync(ambi,mode,oInputAddressList);if((foundLocationsListArray!=null)&&(foundLocationsListArray.length>0)){if(foundLocationsListArray[0].size==1){return true;}}
return false;};function showInputAddressFormLayer(){disableFormElements(document.forms["GetRouteForm"]);showDocElement('InputAddressFormLayer');var f=document.forms["InputAddressForm"];f.elements["InputAddressForm_add"].onclick=function(){var inputAddress=getInputAddress(f);closeInputAddressFormLayer(f);if(searchAddresse(inputAddress,0)){enableFormElements(document.forms["GetRouteForm"]);}};f.elements["InputAddressForm_cancel"].onclick=function(){closeInputAddressFormLayer(f);enableFormElements(document.forms["GetRouteForm"]);};};function showhideMapDefinifition(f){if(document.getElementById("GetRoute_MapdefExpected").value=="0"){unDisplayDocElement("TR_MapSize");unDisplayDocElement("TR_MainmapSize");unDisplayDocElement("TR_DetailmapSize");}else if(document.getElementById("GetRoute_MapdefExpected").value=="1"){displayDocElement("TR_MapSize");displayDocElement("TR_MainmapSize");unDisplayDocElement("TR_DetailmapSize");}else if(document.getElementById("GetRoute_MapdefExpected").value=="2"){displayDocElement("TR_MapSize");unDisplayDocElement("TR_MainmapSize");displayDocElement("TR_DetailmapSize");}else if(document.getElementById("GetRoute_MapdefExpected").value=="3"){displayDocElement("TR_MapSize");displayDocElement("TR_MainmapSize");displayDocElement("TR_DetailmapSize");}};function showItineraryTraceOptions(){var routeResponse=document.getElementById('GetRoute_responseElements');var selectedValue=routeResponse.options[routeResponse.selectedIndex].value;};var ViaM_ns=(document.layers?true:false);var ViaM_ie=(document.all?true:false);var ViaM_navig=navigator.userAgent;var ViaM_moz=(ViaM_navig.indexOf("Gecko")>=0?true:false);var ViaM_isClick=false;var ViaM_mouseStartX=-1;var ViaM_mouseStartY=-1;var ViaM_minX=0;var ViaM_maxX=0;var ViaM_minY=0;var ViaM_maxY=0;var isInit=false;var daDiv;var baseX;var baseY;var ViaM_SelectionDiv,ViaM_CrossDiv,map;var isMousedown=false;zOut0=new Image();zOut0.src="/OPO/tools/MichelinRoutingAPI/img/zoomNeg0.gif";zOut1=new Image();zOut1.src="/OPO/tools/MichelinRoutingAPI/img/zoomNeg1.gif";zIn0=new Image();zIn0.src="/OPO/tools/MichelinRoutingAPI/img/zoomPos0.gif";zIn1=new Image();zIn1.src="/OPO/tools/MichelinRoutingAPI/img/zoomPos1.gif";function get(obj)
{return document.getElementById(obj);};function repos(div,x,y,w,h)
{div.style.left=x;div.style.top=y;div.style.width=w;div.style.height=h;};isDrag=false;var daMap,mapHeight,mapTop,mapLeft,oImg,daDiv,bgOutDiv;function ViaM_init(o){if((o=="")||(o==null))
o="carteDyn";if(document.getElementById("carteDyn").style.left!=0)
document.getElementById("carteDyn").style.left=0;if(document.getElementById("carteDyn").style.top!=0)
document.getElementById("carteDyn").style.top=0;daMap=get("mapDiv");daMap.width=daMap.style.width;daMap.height=daMap.style.height;if(isDrag){daMap.style.cursor="move";}else{daMap.style.cursor="crosshair";}
mapLeft=0;mapTop=0;ratioMap=parseInt(daMap.width)/parseInt(daMap.height);navZoom=1;ViaM_SelectionDiv=document.createElement("DIV");ViaM_SelectionDiv.style.position="absolute";ViaM_SelectionDiv.id="ViaM_SelectionDiv";ViaM_SelectionDiv.style.height="1px";ViaM_SelectionDiv.style.width="1px";ViaM_SelectionDiv.style.visibility="hidden";ViaM_SelectionDiv.style.border="2px solid #FF0000";ViaM_SelectionDiv.style.zIndex=19;ViaM_SelectionDiv.innerHTML="<img src='img/s.gif' height=1 width=1>";daMap.appendChild(ViaM_SelectionDiv);if(get("mlNorth")){get("mlNorth").style.top=findPosition(daMap)[1]-parseInt(get("mlNorth").height)/2+1;get("mlNorth").style.left=findPosition(daMap)[0]+parseInt(daMap.width)/2-parseInt(get("mlNorth").width)/2;get("mlNorth").style.visibility="visible";}
if(get("mlWest")){get("mlWest").style.top=findPosition(daMap)[1]+parseInt(daMap.height)/2-parseInt(get("mlWest").height)/2;get("mlWest").style.left=findPosition(daMap)[0]-parseInt(get("mlWest").width)/2+1;get("mlWest").style.visibility="visible";}
if(get("mlSouth")){get("mlSouth").style.top=findPosition(daMap)[1]+parseInt(daMap.height)-parseInt(get("mlSouth").height)/2-1;get("mlSouth").style.left=findPosition(daMap)[0]+parseInt(daMap.width)/2-parseInt(get("mlSouth").width)/2;get("mlSouth").style.visibility="visible";}
if(get("mlEast")){get("mlEast").style.top=findPosition(daMap)[1]+parseInt(daMap.height)/2-parseInt(get("mlEast").height)/2;get("mlEast").style.left=findPosition(daMap)[0]+parseInt(daMap.width)-parseInt(get("mlEast").width)/2-1;get("mlEast").style.visibility="visible";}
if(get("mlNWVert")){get("mlNWVert").style.top=findPosition(daMap)[1]-parseInt(get("mlNWHor").height)/2;get("mlNWVert").style.left=findPosition(daMap)[0]-parseInt(get("mlNWVert").width)/2;get("mlNWVert").style.visibility="visible";get("mlNWHor").style.top=findPosition(daMap)[1]-parseInt(get("mlNWHor").height)/2;get("mlNWHor").style.left=findPosition(daMap)[0]+parseInt(get("mlNWVert").width)/2+1;get("mlNWHor").style.visibility="visible";}
if(get("mlSWVert")){get("mlSWVert").style.top=findPosition(daMap)[1]+parseInt(daMap.height)+parseInt(get("mlSWHor").height)/2-parseInt(get("mlSWVert").height);get("mlSWVert").style.left=findPosition(daMap)[0]-parseInt(get("mlSWVert").width)/2;get("mlSWVert").style.visibility="visible";get("mlSWHor").style.top=findPosition(daMap)[1]+parseInt(daMap.height)-parseInt(get("mlSWHor").height)/2;get("mlSWHor").style.left=findPosition(daMap)[0]+parseInt(get("mlNWVert").width)/2+1;get("mlSWHor").style.visibility="visible";}
if(get("mlSEVert")){get("mlSEVert").style.top=findPosition(daMap)[1]+parseInt(daMap.height)+parseInt(get("mlSEHor").height)/2-parseInt(get("mlSEVert").height);get("mlSEVert").style.left=findPosition(daMap)[0]+parseInt(daMap.width)-parseInt(get("mlSEVert").width)/2;get("mlSEVert").style.visibility="visible";get("mlSEHor").style.top=findPosition(daMap)[1]+parseInt(daMap.height)-parseInt(get("mlSEHor").height)/2;get("mlSEHor").style.left=findPosition(daMap)[0]+parseInt(daMap.width)-parseInt(get("mlSEHor").width)-parseInt(get("mlNWVert").width)/2;get("mlSEHor").style.visibility="visible";}
if(get("mlNEVert")){get("mlNEVert").style.top=findPosition(daMap)[1]-parseInt(get("mlNEHor").height)/2;get("mlNEVert").style.left=findPosition(daMap)[0]+parseInt(daMap.width)-parseInt(get("mlNWVert").width)/2;get("mlNEVert").style.visibility="visible";get("mlNEHor").style.top=findPosition(daMap)[1]-parseInt(get("mlNEHor").height)/2;get("mlNEHor").style.left=findPosition(daMap)[0]+parseInt(daMap.width)-parseInt(get("mlNWVert").width)/2-parseInt(get("mlNEHor").width);get("mlNEHor").style.visibility="visible";}
isInit=true;daMap=get(o);ViaM_minX=findPosition(daMap)[0];ViaM_maxX=ViaM_minX+parseInt(daMap.width);ViaM_minY=findPosition(daMap)[1];ViaM_maxY=ViaM_minY+parseInt(daMap.height);baseY=parseInt(daMap.style.top);baseX=parseInt(daMap.style.left);daMap.onmousedown=ViaM_mouseDown;daMap.onmousemove=ViaM_mouseMove;daMap.onmouseup=ViaM_mouseUp;ViaM_SelectionDiv.onmousemove=ViaM_mouseMove;ViaM_SelectionDiv.onmouseup=ViaM_mouseUp;};var mouseStartX;var mouseStartY;function ViaM_mouseDown(e){if(ViaM_moz)e.preventDefault();if((document.all)&&(get("skyFrame")))get("skyFrame").style.display="none";if((ViaM_ns&&e.which!=1)||(ViaM_ie&&event.button!=1)||(ViaM_moz&&e.which!=1)||isComputingMap){return true;}
if(isDrag){baseY=parseInt(daMap.style.top);baseX=parseInt(daMap.style.left);mouseStartX=(ViaM_moz?e.pageX:event.clientX+document.body.scrollLeft);mouseStartY=(ViaM_moz?e.pageY:event.clientY+document.body.scrollTop);isMousedown=true;}else{var ViaM_mouseX=(ViaM_moz?e.pageX:event.clientX+document.body.scrollLeft);var ViaM_mouseY=(ViaM_moz?e.pageY:event.clientY+document.body.scrollTop);ViaM_mouseStartX=ViaM_mouseX;ViaM_mouseStartY=ViaM_mouseY;ViaM_isClick=((ViaM_mouseStartX>=ViaM_minX)&&(ViaM_mouseStartX<=ViaM_maxX))&&((ViaM_mouseStartY>=ViaM_minY)&&(ViaM_mouseStartY<=ViaM_maxY)&&(!isComputingMap));isMousedown=true;if(ViaM_isClick){ViaM_showSelection(ViaM_mouseStartX,ViaM_mouseStartY);ViaM_SelectionDiv.style.visibility="visible";}}
return true;};var deltAxe;function ViaM_mouseMove(e){if((typeof(isMousedown)!="undefined")&&(isMousedown)){if(!isDrag){var ViaM_mouseX=(ViaM_moz?e.pageX:event.clientX+document.body.scrollLeft);var ViaM_mouseY=(ViaM_moz?e.pageY:event.clientY+document.body.scrollTop);if((ViaM_isClick)&&(!isComputingMap)){ViaM_showSelection(ViaM_mouseX,ViaM_mouseY);return false;}}else{daMap.style.left=parseInt(baseX)-mouseStartX+(ViaM_moz?e.pageX:event.clientX+document.body.scrollLeft);daMap.style.top=parseInt(baseY)-mouseStartY+(ViaM_moz?e.pageY:event.clientY+document.body.scrollTop);}}
return false;};function ViaM_mouseUp(e){if((ViaM_ns&&e.which!=1)||(ViaM_ie&&event.button!=1)||(ViaM_moz&&e.which!=1)||isComputingMap){return true;}
isMousedown=false;if(isDrag){ViaM_x0=-parseInt(daMap.style.left)+parseInt(daMap.width)/2;ViaM_y0=-parseInt(daMap.style.top)+parseInt(daMap.height)/2;if((generatedMap!=null)&&(typeof(generatedMap)!="undefined")){generatedMap.resize(ViaM_x0,ViaM_y0,ViaM_x0,ViaM_y0);}
return false;}
else{var ViaM_mouseX=(ViaM_ns||ViaM_moz?e.pageX:event.clientX+document.body.scrollLeft);var ViaM_mouseY=(ViaM_ns||ViaM_moz?e.pageY:event.clientY+document.body.scrollTop);if(ViaM_isClick){var ViaM_x1=ViaM_mouseStartX;var ViaM_x2=ViaM_mouseX;ViaM_x0=ViaM_mouseStartX-ViaM_minX;ViaM_y0=ViaM_mouseStartY-ViaM_minY;ViaM_x1=ViaM_mouseX-ViaM_minX;ViaM_y1=ViaM_mouseY-ViaM_minY;var ViaM_mouseMoved=(ViaM_x1!=ViaM_x0)||(ViaM_y1!=ViaM_y0);ViaM_urlact="";if(ViaM_mouseMoved){}
ViaM_SelectionDiv.style.visibility="hidden";if(((ViaM_x1>ViaM_x0)&&(ViaM_x1<ViaM_x0+5))||((ViaM_y1>ViaM_y0)&&(ViaM_y1<ViaM_y0+5))||((ViaM_x0>ViaM_x1)&&(ViaM_x0<ViaM_x1+5))||((ViaM_y0>ViaM_y1)&&(ViaM_y0<ViaM_y1+5))){ViaM_x1=ViaM_x0;ViaM_y1=ViaM_y0;}
if(ViaM_x1<0)ViaM_x1=0;if(ViaM_x1>daMap.width)ViaM_x1=daMap.width;if(ViaM_y1<0)ViaM_y1=0;if(ViaM_y1>daMap.height)ViaM_y1=daMap.height;if((generatedMap!=null)&&(typeof(generatedMap)!="undefined")){generatedMap.resize(ViaM_x0,ViaM_y0,ViaM_x1,ViaM_y1);}
ViaM_mouseStartX=-1;ViaM_mouseStartY=-1;}
ViaM_isClick=false;return false;}};function ViaM_showSelection(ViaM_mouseX,ViaM_mouseY){var ViaM_x1=ViaM_mouseStartX;var ViaM_x2=ViaM_mouseX;if(ViaM_x1>ViaM_x2){var ViaM_a=ViaM_x2;ViaM_x2=ViaM_x1;ViaM_x1=ViaM_a;}
if(ViaM_x1<ViaM_minX)ViaM_x1=ViaM_minX;if(ViaM_x2>ViaM_maxX)ViaM_x2=ViaM_maxX;var ViaM_y1=ViaM_mouseStartY;var ViaM_y2=ViaM_mouseY;if(ViaM_y1>ViaM_y2){ViaM_a=ViaM_y2;ViaM_y2=ViaM_y1;ViaM_y1=ViaM_a;}
if(ViaM_y1<ViaM_minY)ViaM_y1=ViaM_minY;if(ViaM_y2>ViaM_maxY)ViaM_y2=ViaM_maxY;ViaM_SelectionDiv.style.visibility="visible";ViaM_SelectionDiv.style.left=ViaM_x1-findPosition(daMap)[0];ViaM_SelectionDiv.style.top=ViaM_y1-findPosition(daMap)[1];ViaM_SelectionDiv.style.width=ViaM_x2-ViaM_x1;ViaM_SelectionDiv.style.height=ViaM_y2-ViaM_y1;};function roll(i,o){get(i).src="img/"+o+".gif";};function findPosition(oLink){if(oLink.offsetParent){for(var posX=0,posY=0;oLink.offsetParent;oLink=oLink.offsetParent){posX+=oLink.offsetLeft;posY+=oLink.offsetTop;}
return[posX,posY];}else{return[oLink.x,oLink.y];}};function flyingPopUp(oKaMap,name,x,y){this.kaMap=oKaMap;this.name=name;var t=this;if(typeof this.kaMap.flyingPopUps=="undefined"){this.kaMap.flyingPopUps=new Array();}
this.domObj=document.createElement("div");document.body.appendChild(this.domObj);this.kaMap.flyingPopUps.push(this);this.domObj.style.position="absolute";this.domObj.className="flyingPopUp";this.domObj.style.left=x+"px";this.domObj.style.top=y+"px";var flyTitle=document.createElement("div");this.domObj.appendChild(flyTitle);flyTitle.className="title";flyTitle.style.cursor="move";var text=document.createTextNode(name);flyTitle.appendChild(text);var img=document.createElement("img");flyTitle.appendChild(img);img.src="/OPO/images/popUpSchliessen.gif";img.style.position="absolute";img.style.right="2px";img.style.top="3px";img.style.cursor="pointer";img.onclick=function(){t.destroy()};Drag.init(flyTitle,this.domObj);this.container=document.createElement("div");this.domObj.appendChild(this.container);return this;}
flyingPopUp.prototype.setContent=function(content){this.container.innerHTML=content;}
flyingPopUp.prototype.destroy=function(){for(var i=0;i<this.kaMap.flyingPopUps.length;i++){if(this.kaMap.flyingPopUps[i]==this){document.body.removeChild(this.domObj);this.kaMap.flyingPopUps.splice(i,1);break;}}}
function kaLegend(oKaMap,options,alwaysShowInLegend,legendContainers,legendGroupNames,legendRadios,legendFunctionImages){this.kaMap=oKaMap;this.alwaysShowInLegend=alwaysShowInLegend;this.legendContainers=legendContainers;this.legendGroupNames=legendGroupNames;this.legendRadios=legendRadios;this.legendFunctionImages=legendFunctionImages;this.kaMap.kaLegend=this;if(arguments.length==8)
this.clickFunction=arguments[7];this.legendCBs=new Array();this.legendRDs=new Array();this.showVisibilityControl=options['showVisibilityControl'];this.showIcons=options['showIcons'];this.showOpacityControl=options['showOpacityControl'];this.showOrderControl=options['showOrderControl'];this.kaMap.registerForEvent(KAMAP_MAP_INITIALIZED,this,this.draw);this.kaMap.registerForEvent(KAMAP_SCALE_CHANGED,this,this.update);this.kaMap.registerForEvent(KAMAP_LAYER_STATUS_CHANGED,this,this.update);};kaLegend.prototype.update=function(eventID){if(eventID==KAMAP_SCALE_CHANGED){for(var i in this.legendRDs){var oLayer=this.kaMap.getCurrentMap().getLayer(this.legendRDs[i].value);if(oLayer.isVisible()){this.kaLegend_setLayerVisibility(oLayer.name,this.legendRDs[i].checked);}
this.checkLayerLegendVisibility(oLayer);}
for(var i in this.legendCBs){var oLayer=this.kaMap.getCurrentMap().getLayer(this.legendCBs[i].value);if(oLayer.isVisible())
this.kaLegend_setLayerVisibility(oLayer.name,this.legendCBs[i].checked);this.checkLayerLegendVisibility(oLayer);}}
else if(eventID==KAMAP_LAYER_STATUS_CHANGED){var oLayer=this.kaMap.getCurrentMap().getLayer(arguments[1]);var counter=0;if(oLayer){for(var i in this.legendCBs){currentLayer=this.kaMap.getCurrentMap().getLayer(this.legendCBs[i].value);if(currentLayer.isVisible()){this.kaLegend_setLayerVisibility(this.legendCBs[i].value,this.legendCBs[i].checked);}}
for(var i in this.legendRDs){var currentLayer=this.kaMap.getCurrentMap().getLayer(this.legendRDs[i].value);if(currentLayer.isVisible()){this.kaLegend_setLayerVisibility(this.legendRDs.value,this.legendRDs[i].checked);}}}}};kaLegend.prototype.draw=function(){var aLayers=this.kaMap.getCurrentMap().getAllLayers();for(var i=0;i<aLayers.length;i++){if(aLayers[i].kaLegendObj==null&&aLayers[i].name!="__base__"){this.createLayerHTML(aLayers[i]);}}
for(var i=0;i<aLayers.length;i++){for(var j in this.legendContainers){if(aLayers[i].name==j){aLayers[i].legendContainer=this.legendContainers[j];}}}
for(var i=aLayers.length-1;i>=0;i--){if(aLayers[i].legendContainer){try{this.kaMap.getRawObject(aLayers[i].legendContainer).appendChild(aLayers[i].kaLegendObj);}
catch(e){alert("kaLegend : object with id '"+aLayers[i].legendContainer+"' not found on page!");}}
else{alert("No container defined for layer "+aLayers[i].name+" (define it in startup.js in array legendContainer)");}}
return;};kaLegend.prototype.createLayerHTML=function(oLayer){var d,t,tb,tr,td,sel,img;var th=this;d=document.createElement("div");d.id='group_'+oLayer.name;d.className="kaLegendLayer";d.oLayer=oLayer;oLayer.kaLegendObj=d;t=document.createElement("table");tb=document.createElement("tbody");tr=document.createElement("tr");if(this.showVisibilityControl){td=document.createElement("td");td.className="kaLegendLayer_checkbox";for(var key in this.legendRadios){if(key==oLayer.name)
oLayer.radioGroupName=this.legendRadios[key];}
if(oLayer.radioGroupName!=undefined){try{var sel=document.createElement("<input type='radio' name='"+oLayer.radioGroupName+"'>");}
catch(e){var sel=document.createElement("input");sel.type="radio";sel.name=oLayer.radioGroupName;}
if(this.legendRadios['defaultChecked'][oLayer.radioGroupName]==oLayer.name){sel.checked=true;sel.defaultChecked=true;}
this.legendRDs.push(sel);}
else{var sel=document.createElement("input");sel.type="checkbox";sel.name="layerVisCB";sel.checked=oLayer.visible;sel.defaultChecked=oLayer.visible;this.legendCBs.push(sel);}
oLayer.input=sel;sel.value=oLayer.name;sel.onclick=function(e){th.toggleLayerVisibility(e)};td.appendChild(sel);tr.appendChild(td);}
if(this.showIcons){td=document.createElement("td");tr.appendChild(td);img=document.createElement("img");td.appendChild(img);img.src=(oLayer.iconPath==null)?("images/a_pixel.gif"):oLayer.iconPath;}
if(this.showOpacityControl){td=document.createElement("td");img=document.createElement("img");img.className="kaLegendLayer_opacity_imgDOWN";img.src=this.legendFunctionImages['opacityDown'];img.alt="Decrease layer opacity";img.title="Decrease layer opacity";img.kaLegend=this;img.oLayer=oLayer;img.onclick=function(e){th.opacityDown(e)};td.appendChild(img);img=document.createElement("img");img.className="kaLegendLayer_opacity_imgUP";img.src=this.legendFunctionImages['opacityUp'];img.alt="Increase layer opacity";img.title="Increase layer opacity";img.kaLegend=this;img.oLayer=oLayer;img.onclick=function(e){th.opacityUp(e)};td.appendChild(img);tr.appendChild(td);}
if(this.showOrderControl){td=document.createElement("td");td.className="kaLegendLayer_ZindexControl";img=document.createElement("img");img.className="kaLegendLayer_ZindexControl_imgUP";img.src=this.legendFunctionImages['orderUp'];img.alt="Shift Layer Up";img.title="Shift Layer Up";img.kaLegend=this;img.oLayer=oLayer;img.myDiv=d;img.onclick=function(e){th.moveLayerUp(e)};td.appendChild(img);img=document.createElement("img");img.className="kaLegendLayer_ZindexControl_imgDOWN";img.src=this.legendFunctionImages['orderDown'];img.alt="Shift Layer Down";img.title="Shift Layer Down";img.kaLegend=this;img.oLayer=oLayer;img.myDiv=d;img.onclick=function(e){th.moveLayerDown(e)};td.appendChild(img);tr.appendChild(td);}
td=document.createElement("td");td.innerHTML=tra[("layer_"+oLayer.name)];td.className="kaLegendLayer_legendLabel";tr.appendChild(td);tb.appendChild(tr);t.appendChild(tb);d.appendChild(t);this.checkLayerLegendVisibility(oLayer);};kaLegend.prototype.checkLayerLegendVisibility=function(oLayer){var setIt=true;for(var i in this.alwaysShowInLegend){if(setIt&&this.alwaysShowInLegend[i]==oLayer.name)
setIt=false;}
if(setIt&&oLayer.kaLegendObj){if(oLayer.isVisible()){oLayer.kaLegendObj.style.display='block';}
else{oLayer.kaLegendObj.style.display='none';}}
return;};kaLegend.prototype.toggleLayerVisibility=function(e){e=(e)?e:((event)?event:null);var srcEvent=(e.target)?e.target:(e.srcElement)?e.srcElement:null;if(this.clickFunction){this.clickFunction.apply(null,[srcEvent]);}
this.kaMap.triggerEvent(KAMAP_LAYER_STATUS_CHANGED,srcEvent.value,srcEvent.checked,e);};kaLegend.prototype.kaLegend_setLayerVisibility=function(name,bVisible){var layer=this.kaMap.getCurrentMap().getLayer(name);if(layer.visible!=bVisible){if(!this.kaMap.loadUnchecked&&bVisible){layer.visible=true;this.kaMap.setMapLayers();if(layer.domObj){layer.domObj.style.visibility=bVisible?'visible':'hidden';layer.domObj.style.display=bVisible?'block':'none';for(var i=0;i<layer.domObj.childNodes.length;i++){layer.setTile(layer.domObj.childNodes[i]);}}
this.kaMap.paintLayer(layer);}
else{if(layer.domObj){layer.visible=false;layer.domObj.style.visibility=bVisible?'visible':'hidden';layer.domObj.style.display=bVisible?'block':'none';for(var i=0;i<layer.domObj.childNodes.length;i++){layer.setTile(layer.domObj.childNodes[i]);}}}}};kaLegend.prototype.opacityDown=function(e){var srcEvent=this.getSrcEvent(e);var oLayer=srcEvent.oLayer;var opc=oLayer.opacity-10;this.kaMap.setLayerOpacity(oLayer.name,opc);};kaLegend.prototype.opacityUp=function(e){var srcEvent=this.getSrcEvent(e);var oLayer=srcEvent.oLayer;var opc=oLayer.opacity+10;this.kaMap.setLayerOpacity(oLayer.name,opc);};kaLegend.prototype.moveLayerDown=function(e){var srcEvent=this.getSrcEvent(e);var myLayer=srcEvent.oLayer;var leg=srcEvent.myDiv.parentNode;var myDiv=srcEvent.myDiv;var lowerDiv=this.findLowerDiv(myDiv);if(lowerDiv&&lowerDiv.className=='kaLegendLayer'){var aCheckbox=document.getElementsByTagName('input');var checkboxStatusUp=null;var checkboxStatusDown=null;var checkboxUp=null;var checkboxDown=null;for(var i=0;i<aCheckbox.length;i++){var inputTag=aCheckbox[i];if(inputTag.value==myDiv.id.replace(/\bgroup_/,'')){checkboxUp=inputTag;checkboxStatusUp=checkboxUp.checked;}
if(inputTag.value==lowerDiv.id.replace(/\bgroup_/,'')){checkboxDown=inputTag;checkboxStatusDown=inputTag.checked;}}
var proxyMy=myDiv.cloneNode(true);var proxyLower=lowerDiv.cloneNode(true);myDiv.parentNode.insertBefore(proxyMy,myDiv);myDiv.parentNode.insertBefore(proxyLower,lowerDiv);myDiv.parentNode.replaceChild(lowerDiv,proxyMy);myDiv.parentNode.replaceChild(myDiv,proxyLower);if(checkboxUp)
checkboxUp.checked=checkboxStatusUp;if(checkboxDown)
checkboxDown.checked=checkboxStatusDown;for(i=0,n=leg.childNodes.length;i<leg.childNodes.length;i++){var child=leg.childNodes[i];if(child&&child.className=='kaLegendLayer'){child.oLayer.zIndex=(n);n--;}}
this.kaMap.setMapLayers();}
else{alert('this layer can\'t go farther down');}};kaLegend.prototype.moveLayerUp=function(e){var srcEvent=this.getSrcEvent(e);var myLayer=srcEvent.oLayer;var leg=srcEvent.myDiv.parentNode;var myDiv=srcEvent.myDiv;var upperDiv=this.findUpperDiv(myDiv);if(upperDiv&&upperDiv.className=='kaLegendLayer'){var aCheckbox=document.getElementsByTagName('input');var checkboxStatusUp=null;var checkboxStatusDown=null;var checkboxUp=null;var checkboxDown=null;for(var i=0;i<aCheckbox.length;i++){var inputTag=aCheckbox[i];if(inputTag.value==upperDiv.id.replace(/\bgroup_/,'')){checkboxUp=inputTag;checkboxStatusUp=checkboxUp.checked;}
if(inputTag.value==myDiv.id.replace(/\bgroup_/,'')){checkboxDown=inputTag;checkboxStatusDown=inputTag.checked;}}
var proxyMy=myDiv.cloneNode(true);var proxyUpper=upperDiv.cloneNode(true);myDiv.parentNode.insertBefore(proxyMy,myDiv);myDiv.parentNode.insertBefore(proxyUpper,upperDiv);myDiv.parentNode.replaceChild(upperDiv,proxyMy);myDiv.parentNode.replaceChild(myDiv,proxyUpper);if(checkboxUp)checkboxUp.checked=checkboxStatusUp;if(checkboxDown)checkboxDown.checked=checkboxStatusDown;for(i=0,n=leg.childNodes.length;i<leg.childNodes.length;i++){var child=leg.childNodes[i];if(child&&child.className=='kaLegendLayer'){child.oLayer.zIndex=(n);n--;}}
this.kaMap.setMapLayers();}
else{alert('this layer can\'t go farther up');}};kaLegend.prototype.findLowerDiv=function(div){var lDiv=div.nextSibling;if(lDiv&&lDiv.className=='kaLegendLayer'&&lDiv.style.display=='none'){this.findLowerDiv(lDiv);}
return lDiv;};kaLegend.prototype.findUpperDiv=function(div){var uDiv=div.previousSibling;if(uDiv&&uDiv.className=='kaLegendLayer'&&uDiv.style.display=='none'){this.findUpperDiv(uDiv);}
return uDiv;};var myKaMap=myKaNavigator=myKaQuery=null;var queryParams=null;function myOnLoad(){var img1=new Image();img1.src="/OPO/tools/progZoomer/images/slider.gif";var img1=new Image();img1.src="/OPO/tools/progZoomer/images/support.gif";var img1=new Image();img1.src="/OPO/tools/opacityController/images/slider.gif";var img1=new Image();img1.src="/OPO/tools/opacityController/images/support.gif";initDHTMLAPI();myKaMap=new kaMap('viewport');var szMap=getQueryParam('map');if(szMap==""){szMap=projectMapName;}
var szExtents=getQueryParam('extents');var szCPS=getQueryParam('cps');myKaMap.tileLoadingImg=new Image(256,256);myKaMap.tileLoadingImg.src="/OPO/images/tileLoading.gif";myKaNavigator=new kaNavigator(myKaMap);myKaNavigator.activate();document.onmouseup=function(){myKaNavigator.bMouseDown=false;myKaNavigator.cursor=myKaNavigator.cursorNormal;myKaMap.setCursor(myKaNavigator.cursorNormal)};var myOpacityController=new opacityController(myKaMap);var myProgZoomer=new progZoomer(myKaMap);var interaction=new interact(myKaMap);new admin(myKaMap);new utils(myKaMap);var routingFunctions=new routingFuncs(myKaMap);var myKaKeymap=new kaKeymap(myKaMap,"keymap");myKaMap.registerForEvent(KAMAP_INITIALIZED,null,initOPOContext);myKaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,null,myExtentChanged);myKaMap.registerForEvent(KAMAP_SCALE_CHANGED,null,updateCopyright);if(projectMapName=='mapgate24'){myKaMap.registerForEvent(KAMAP_MAP_CLICKED,null,mapClicked);myKaMap.registerForEvent(KAMAP_EXTENTS_CHANGED,null,updateBoxes);}
if(navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1){window.onresize=triggerChronoDrawPage;}
else{window.onresize=drawPage;}
drawPage();if(projectMapName!='mapgate24'&&callMode!='rkey'){myKaMap.admin.checkLogin();}
myKaMap.initializeFromRemoteServer(szMap,szExtents,szCPS,"/OPO/proxy.php");};function initOPOContext(){if(dataLink['ismapit']==1){dataOPO['LOCATE_X']=dataLink['locateX'];dataOPO['LOCATE_Y']=dataLink['locateY'];dataOPO['BASESCALE']=dataLink['zoom'];dataOPO['ismapit']=1;}
if(dataLink['isdirect']==1){dataOPO['LOCATE_X']=dataLink['X'];dataOPO['LOCATE_Y']=dataLink['Y'];dataOPO['ismapit']=0;dataOPO['BASESCALE']=6000;}
if(dataOPO['LOCATE_X']!=""&&dataOPO['LOCATE_Y']!=""){myKaMap.zoomTo(parseInt(dataOPO['LOCATE_X']),parseInt(dataOPO['LOCATE_Y']),parseInt(dataOPO['BASESCALE']));if(dataOPO['ismapit']==1){var innerInfo=new Array;innerInfo.COORDX=dataOPO['LOCATE_X'];innerInfo.COORDY=dataOPO['LOCATE_Y'];var a=new Array;a.innerInfo=innerInfo;a.identifier=-1;myKaMap.interact.tipItem(a);$('SMLayer').style.display='none';var infoContainer=myKaMap.getRawObject("poiInfoContainer");while(infoContainer.childNodes.length>0){infoContainer.removeChild(infoContainer.childNodes[0]);}
new Ajax.Updater('poiInfoContainer','/OPO/fetchdata.php?action=drawMapItInfo&id='+dataLink['id']);data=new Object();data.COORDX=dataLink['locateX'];data.COORDY=dataLink['locateY'];data.NPA=dataLink['npa'];data.LOCALITE_18=dataLink['localite_18'];data.NOM_RUE=dataLink['nom_rue'];data.NO_MAISON=dataLink['no_maison'];myKaMap.interact.showActions('link',data);}
if(dataLink['isdirect']==1){var params=null;if(dataLink['objclass']=="poi"){params="isdirect="+dataLink['ID_POINT_INTERET']+"&action=getPOI&type="+dataLink['cat'];var selectBox=$('selectBoxPOI');var cb=myKaMap.interact.POIselectedCallback;var sab=$("POIsablier");}
if(dataLink['objclass']=="firm"){params="isdirect="+dataLink['ID_POINT_INTERET']+"&action=getFirm&type="+dataLink['cat'];var selectBox=$('selectBoxFirms');var cb=myKaMap.interact.firmSelectedCallback;var sab=$("firmSablier");}
if(dataLink['objclass']=="chalet"){params="isdirect="+dataLink['ID_POINT_INTERET']+"&action=getChalet&name="+escape(dataLink['name']);var cb=myKaMap.interact.chaletSearchCallback;var sab=$("chaletSablier");}
if(dataLink['objclass']=="adr"){params="isdirect="+dataLink['ID_POINT_INTERET']+"&action=addressSearch&type=1&id="+dataLink['ID_POINT_INTERET'];var cb=myKaMap.interact.addressSearchCallback;var sab=$("adresseSablier");}
if(typeof(selectBox)!="undefined"){for(var i=0;i<selectBox.options.length;i++){if(selectBox.options[i].value==dataLink['cat'])selectBox.selectedIndex=selectBox.options[i].index;}}
if(params){sab.style.display="block";myKaMap.interact.callPHP(params,cb);}}}
myKaMap.getCurrentMap().setMaxExtents(parseInt(dataOPO['LEFT']),parseInt(dataOPO['BOTTOM']),parseInt(dataOPO['RIGHT']),parseInt(dataOPO['TOP']));if(dataOPO['EXTRA_LAYERS']){}
if(callModeType!=''){if(callModeType=='w'){var obj=$('WanderBtn');var name='Wanderland-Choice';}
if(callModeType=='v'){var obj=$('VeloBtn');var name='Veloland';}
if(callModeType=='m'){var obj=$('BikeBtn');var name='Mountainbikeland';}
if(callModeType=='s'){var obj=$('SkatingBtn');var name='Skatingland';}
if(callModeType=='k'){var obj=$('KanuBtn');var name='Kanuland';}
myKaMap.interact.setSMLayerVisibility(obj,name);}};function updateCopyright(){myKaMap.getCurrentScale();};function updateBoxes(){myKaMap.interact.updateBoxes();};function mapClicked(eventID,p){myKaMap.interact.mapClicked(eventID,p);};var drawPageChronoIsRunning=false;drawPageChrono=null;function triggerChronoDrawPage(){if(drawPageChronoIsRunning==false){drawPageChronoIsRunning=true;drawPageChrono=window.setTimeout(function(){drawPage()},1500);}};function parseQueryString(){queryParams={};var s=window.location.search;if(s!=''){s=s.substring(1);var p=s.split('&');for(var i=0;i<p.length;i++){var q=p[i].split('=');queryParams[q[0]]=q[1];}}};function getQueryParam(p){if(!queryParams){parseQueryString();}
if(queryParams[p]){return queryParams[p];}else{return'';}};function myExtentChanged(eventID,extents){updateLinkToView();};function myLayersChanged(eventID,map){updateLinkToView();};function updateLinkToView(){var url=window.location.protocol+'/'+'/'+window.location.host+':'+window.location.port+'/'+window.location.pathname+'?';var extents=myKaMap.getGeoExtents();var cx=(extents[2]+extents[0])/2;var cy=(extents[3]+extents[1])/2;var cpsURL='cps='+cx+','+cy+','+myKaMap.getCurrentScale();var mapURL='map='+myKaMap.currentMap;var theMap=myKaMap.getCurrentMap();var aLayers=theMap.getLayers();var layersURL='layers=';var sep='';for(var i=0;i<aLayers.length;i++){layersURL+=sep+aLayers[i].name;sep=',';}
var link=document.getElementById('linkToView');if(link)
link.href=url+mapURL+'&'+cpsURL+'&'+layersURL;};function myScaleChanged(eventID,scale){var currentMap=myKaMap.getCurrentMap();var scales=currentMap.getScales();for(var i in scales){var imgString='img'+scales[i];var scaleString='img'+scale;if(getRawObject(imgString)){if(imgString==scaleString){getRawObject(scaleString).src='images/pixel-red.png';}else{getRawObject(imgString).src='images/pixel-blue.png';}}}
if(typeof(myScalebar)!="undefined"){myScalebar.update(scale);if(scale>=1000000){scale=scale/1000000;scale=scale+" Million";}
var outString='current scale 1:'+scale;try{getRawObject('scale').innerHTML=outString;}
catch(e){}}};function mySetScale(scale){myKaMap.zoomToScale(scale);};function mySetMap(name){myKaMap.selectMap(name);};function myQuery(eventID,queryType,coords){var szLayers='';var layers=myKaMap.getCurrentMap().getQueryableLayers();if(layers.length==0){alert("No queryable layers at this scale and extent");return;}
for(var i=0;i<layers.length;i++){szLayers=szLayers+","+layers[i].name;}
var extent=myKaMap.getGeoExtents();var scale=myKaMap.getCurrentScale();var cMap=myKaMap.getCurrentMap().name;var params='map='+cMap+'&q_type='+queryType+'&scale='+scale+'&groups='+szLayers+'&coords='+coords+'&extent='+extent[0]+'|'+extent[1]+'|'+extent[2]+'|'+extent[3];WOOpenWin('Query','map_query.php?'+params,'resizable=yes,scrollbars=yes,width=600,height=400');};function myZoomIn(){myKaMap.zoomIn();};function myZoomOut(){myKaMap.zoomOut();};function myPrint(info){var szLayers='';var szOpacitys='';if(info==null){var info=new Object();info['PLACE']=dataOPO['NAME'];}
var layers=myKaMap.getCurrentMap().getLayers();for(var i=0;i<layers.length;i++){szLayers=szLayers+","+layers[i].name;szOpacitys=szOpacitys+","+layers[i].opacity;}
var extent=myKaMap.getGeoExtents();var scale=myKaMap.getCurrentScale();var cMap=myKaMap.getCurrentMap().name;var img_width='600';var params='map='+cMap+'&scale='+scale+'&img_width='+img_width+'&groups='+szLayers+'&opacitys='+szOpacitys+'&extent='+extent[0]+'|'+extent[1]+'|'+extent[2]+'|'+extent[3];for(var i in info){params+="&info["+i+"]="+escape(info[i]);}
WOOpenWin('Print','/OPO/tools/print/print_map.php?'+params,'resizable=yes,scrollbars=yes,width=600,height=400');};function toggleToolbar(obj){if(obj.style.backgroundImage==''){obj.isOpen=true;}
if(obj.isOpen){obj.title='show toolbar';obj.style.backgroundImage='url(images/arrow_down.png)';var bValue=getObjectTop(obj);;var d=getObject('toolbar');d.display="none";obj.isOpen=false;obj.style.top="3px";}else{obj.title='hide toolbar';obj.style.backgroundImage='url(images/arrow_up.png)';var d=getObject('toolbar');d.display="block";obj.isOpen=true;var h=getObjectHeight('toolbar');obj.style.top=(h+3)+"px";}};function toggleKeymap(obj){if(obj.style.backgroundImage==''){obj.isOpen=true;}
if(obj.isOpen){obj.title='show keymap';obj.style.backgroundImage='url(images/arrow_left.png)';var bValue=getObjectTop(obj);;var d=getObject('keymap');d.display="none";obj.isOpen=false;}else{obj.title='hide keymap';obj.style.backgroundImage='url(images/arrow_right.png)';var d=getObject('keymap');d.display="block";obj.isOpen=true;}};function toggleReference(obj){if(obj.style.backgroundImage==''){obj.isOpen=true;}
if(obj.isOpen){obj.title='show reference';obj.style.backgroundImage='url(images/arrow_up.png)';var d=getObject('reference');d.display='none';obj.isOpen=false;obj.style.bottom='3px';}else{obj.title='hide reference';obj.style.backgroundImage='url(images/arrow_down.png)';var d=getObject('reference');d.display='block';obj.isOpen=true;obj.style.bottom=(getObjectHeight('reference')+3)+'px';}};function toggleSearch(obj){if(obj.style.backgroundImage==''){obj.isOpen=true;}
if(obj.isOpen){obj.title='show search results';obj.style.backgroundImage='url(images/arrow_up.png)';var d=getObject('searchOut');d.display='none';obj.isOpen=false;obj.style.bottom='3px';}else{obj.title='hide  search results';obj.style.backgroundImage='url(images/arrow_down.png)';var d=getObject('searchOut');d.display='block';obj.isOpen=true;obj.style.bottom=(getObjectHeight('searchOut')+3)+'px';}};function dialogToggle(href,szObj){var obj=getObject(szObj);if(obj.display=='none'){obj.display='block';href.childNodes[0].src='images/dialog_shut.png';}else{obj.display='none';href.childNodes[0].src='images/dialog_open.png';}};function drawPage(){var minWidth=400;var minHeight=600;var viewport=myKaMap.getRawObject('viewport');var viewportContainer=myKaMap.getRawObject('viewportContainer');var mainContainer=myKaMap.getRawObject("mainContainer");var tabLeft=myKaMap.getRawObject("tabLeft");var tabRight=myKaMap.getRawObject("tabRight");var tabCenter=myKaMap.getRawObject("tabCenter");var winH=getInsideWindowHeight();var winW=getInsideWindowWidth();var topMainContainer=mainContainer.offsetTop;var borderWidth=19;var availHeight=winH-topMainContainer-2*borderWidth;availHeight=Math.max(availHeight,minHeight);if(document.all){availHeight-=20;}
mainContainer.style.height=availHeight+"px";tabLeft.style.height=availHeight+"px";tabRight.style.height=availHeight+"px";tabCenter.style.height=availHeight+"px";var availMapHeight=availHeight;viewportContainer.style.height=availMapHeight+"px";var paddingViewport=10;viewport.style.top=paddingViewport+"px";viewport.style.height=availMapHeight-2*paddingViewport-2+"px";if(winW-tabLeft.offsetWidth-tabRight.offsetWidth-10<minWidth){viewportContainer.style.width=minWidth+"px";tabRight.style.left=tabLeft.offsetWidth+5+tabCenter.offsetWidth+5+"px";}
else{viewportContainer.style.width="auto";tabRight.style.right="0px";tabRight.style.left="auto";}
viewport.style.width=viewportContainer.offsetWidth-2*paddingViewport-2+"px";myKaMap.getRawObject("OPOactions").style.height=paddingViewport+"px";myKaMap.resize();drawPageChronoIsRunning=false;clearTimeout(drawPageChrono);return;};function getFullExtent(){var exStr=myKaMap.getCurrentMap().defaultExtents.toString();var ex=myKaMap.getCurrentMap().defaultExtents;myKaMap.zoomToExtents(ex[0],ex[1],ex[2],ex[3]);};function switchMode(id){if(id=='toolQuery'){myKaQuery.activate();if(getRawObject('toolQuery'))getRawObject('toolQuery').style.backgroundImage='url(images/icon_set_nomad/tool_query_2.png)';if(getRawObject('toolPan'))getRawObject('toolPan').style.backgroundImage='url(images/icon_set_nomad/tool_pan_1.png)';if(getRawObject('toolZoomRubber'))getRawObject('toolZoomRubber').style.backgroundImage='url(images/icon_set_nomad/tool_rubberzoom_1.png)';}else if(id=='toolPan'){myKaNavigator.activate();if(getRawObject('toolQuery'))getRawObject('toolQuery').style.backgroundImage='url(images/icon_set_nomad/tool_query_1.png)';if(getRawObject('toolPan'))getRawObject('toolPan').style.backgroundImage='url(images/icon_set_nomad/tool_pan_2.png)';if(getRawObject('toolZoomRubber'))getRawObject('toolZoomRubber').style.backgroundImage='url(images/icon_set_nomad/tool_rubberzoom_1.png)';}else if(id=='toolZoomRubber'){myKaRubberZoom.activate();if(getRawObject('toolQuery'))getRawObject('toolQuery').style.backgroundImage='url(images/icon_set_nomad/tool_query_1.png)';if(getRawObject('toolPan'))getRawObject('toolPan').style.backgroundImage='url(images/icon_set_nomad/tool_pan_1.png)';if(getRawObject('toolZoomRubber'))getRawObject('toolZoomRubber').style.backgroundImage='url(images/icon_set_nomad/tool_rubberzoom_2.png)';}else{myKaNavigator.activate();}};function applyPNGFilter(o){var t="/images/a_pixel.gif";if(o.src!=t){var s=o.src;o.src=t;o.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s+"',sizingMethod='scale')";}};function WOFocusWin(nn){eval("if( this."+name+") this."+name+".moveTo(50,50); this."+name+".focus();");};function WOOpenWin(name,url,ctrl){eval("this."+name+"=window.open('"+url+"','"+name+"','"+ctrl+"');");};function WinOpener(){this.openWin=WOOpenWin;this.focusWin=WOFocusWin;};
