
jQuery.viewPortSize=function(){var viewportWidth;var viewportHeight;if(typeof window.innerWidth!='undefined'){viewportWidth=window.innerWidth;viewportHeight=window.innerHeight;}else if(typeof document.documentElement!='undefined'&&typeof document.documentElement.clientWidth!='undefined'&&document.documentElement.clientWidth!=0){viewportWidth=document.documentElement.clientWidth;viewportHeight=document.documentElement.clientHeight;}else{viewportWidth=document.getElementsByTagName('body')[0].clientWidth;viewportHeight=document.getElementsByTagName('body')[0].clientHeight;}
return{width:viewportWidth,height:viewportHeight};};(function($){var _getJsonData=function(){var data=$j("#jsonData").remove().html();if(data!=null){eval("data = {"+data+"};");return data;}else{return null;}};var _performRequest=function(opts,url,data){var $loading_img;$.ajax({url:url,type:opts.method,data:data,cache:opts.cache,contentType:opts.contentType,beforeSend:function(){opts.onStart(opts);if(opts.loading_img){var spinnerHome=opts.loading_target?typeof opts.loading_target==='string'?$(opts.loading_target):opts.loading_target:opts.target;$loading_img=$('<div />').attr('id','AjaxifyLoading').append($('<img />').attr({'src':opts.loading_img,'alt':'Loading...'})).appendTo(spinnerHome);}},success:function(HTML){$loading_img&&$loading_img.remove();var content;if(opts.tagToLoad){content=$(HTML).find(opts.tagToLoad).clone();}else{content=$(HTML);}
$(opts.target).empty().append(content);opts.onSuccess(opts,_getJsonData());},complete:function(){opts.onComplete(opts);},error:function(){$loading_img&&$loading_img.remove();opts.onError(opts);}});};$.fn.ajaxify=function(options){if(!jQuery(this).size()){return false;}
return this.each(function(){var defaults=$.extend({},$.fn.ajaxify.defaults,options),$this=$(this),collectParams=function(){var paramString=defaults.params;if(defaults.forms){paramString+='&'+$(defaults.forms).serialize();}
return paramString;};var eventHandler=function(){_performRequest(defaults,defaults.link||($this.attr('action')||$this.attr('href')),collectParams());return false;};if($.browser.safari&&(defaults.event=='click'||defaults.event=='submit')){this['on'+defaults.event]=eventHandler;}else{$this.bind(defaults.event,eventHandler);}});};$.fn.ajaxify.defaults={event:'click',link:false,target:'#container',tagToLoad:false,method:'GET',loading_img:false,loading_target:false,forms:false,params:'ajax=true',cache:false,onStart:function(op){},onError:function(op){},onSuccess:function(op){},onComplete:function(op){}};})(jQuery);(function($){$.widget("ui.modalDialog",{_init:function(){this._overlayLayer=null;this._lockerLayer=null;this._closed=false;},update:function(){var wnd=$(window);var wndSize=jQuery.viewPortSize();var ww=wndSize.width,wh=wndSize.height,wl=wnd.scrollLeft(),ws=wnd.scrollTop();var dw=this.element.width(),dh=this.element.height();var top=(wh-dh)/2;if(top<0)top=0;top+=ws;var left=(ww-dw)/2;if(left<0)left=0;left+=wl;this.element.css({position:"absolute",zIndex:9999,top:top,left:left});},loadingOverlay:function(loading){if(this.options.overlay){this._showOverlay();if(loading){var overlayLoading=$("<img/>").attr("src",DDI.contextPath+"/img/overlay-loading.gif");$(this._overlayLayer).append(overlayLoading);}else{$("img",this._overlayLayer).remove();}}},_showOverlay:function(){if(this._overlayLayer){return;}
var _this=this;var overlayHeight=function(){var windowHeight=0;if(window.innerHeight&&window.scrollMaxY){windowHeight=window.innerHeight+window.scrollMaxY;}
else{if(document.documentElement&&document.documentElement.scrollHeight){windowHeight=document.documentElement.scrollHeight;}
else{if(document.body&&document.body.scrollHeight){windowHeight=document.body.scrollHeight;}}}
return windowHeight;};this._overlayLayer=$('<div/>').appendTo(document.body).addClass('overlay').css({borderWidth:0,margin:0,padding:0,position:'fixed',top:0,left:0,height:'100%',width:'100%',zIndex:7000});if(this.options.removable===true){this._overlayLayer.css({opacity:0.5,background:"black"}).click(function(){_this.close();});}else{this._overlayLayer.css({opacity:0,background:"black"});}
if($.browser.msie&&/6.0/.test(navigator.userAgent)){$('select').hide();}
var resizeCB=function(){_this.update();if($(document.body).height()>$(window).height()){return;}
var height=overlayHeight();_this._overlayLayer.height(height);_this._overlayLayer.height();};$(window).bind('resize.modaldialog',null,resizeCB);},_destroyOverlay:function(){this._overlayLayer!==null&&this._overlayLayer.remove();this._overlayLayer=null;$(window).unbind('resize.modaldialog');$.browser.msie&&/6.0/.test(navigator.userAgent)&&$('select').show();},open:function(){this._closed=false;this.update();if(this.options.overlay){this.loadingOverlay(false);this._showOverlay();}
this.element.show();this._overlayLayer.height();},closed:function(){return this._closed;},close:function(){this._destroyOverlay();this.element.hide();this.releaseResources();this._closed=true;},lock:function(){this._closed=false;this._lockerLayer=$("<div/>").appendTo(this.element).addClass('locker').css({width:this.element.width(),height:this.element.height()});},unlock:function(){this._lockerLayer!==null&&this._lockerLayer.remove();this._lockerLayer=null;},opened:function(){return this.element.css("display")!=="none";},locked:function(){return this._lockerLayer!==null;},closeHandler:function(fn){this.options.onDialogClose=fn;},removable:function(value){this.options.removable=value;},releaseResources:function(){this.options.onDialogClose();}});$.extend($.ui.modalDialog,{getter:"opened locked closed releaseResources",setter:"closeHandler",defaults:{overlay:true,removable:true,onDialogClose:function(){return false;}}});$(document).ready(function(){$("#modalDialog").modalDialog();});$.fn.extend({dialogAjaxify:function(params){var dialogSelector='#modalDialog';var dialogLayer=$(dialogSelector);var p=$.extend({update_position:true,target:dialogSelector,loading_target:dialogSelector+' .locker',loading_img:DDI.contextPath+'/img/loading.gif'},params);$.extend(p,{onStart:function(){if(params!==undefined&&params['onStart']!==undefined){params.onStart();}
dialogLayer.modalDialog("loadingOverlay",true);dialogLayer.modalDialog("releaseResources");dialogLayer.modalDialog("lock");},onSuccess:function(opts,jsonData){if(!dialogLayer.modalDialog("closed")){dialogLayer.modalDialog("unlock");dialogLayer.modalDialog("loadingOverlay",false);if(!dialogLayer.modalDialog("opened")){dialogLayer.modalDialog("open");}
if(p.update_position){dialogLayer.modalDialog("update");}}
if(params!==undefined&&params['onSuccess']!==undefined){params.onSuccess(jsonData);}}});this.ajaxify(p);},showOverlay:function(){var dialogSelector='#modalDialog';var dialogLayer=$(dialogSelector);dialogLayer.modalDialog("removable",false);dialogLayer.modalDialog("loadingOverlay",false);}});})(jQuery);
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))
return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))
fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)
$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)
this.elements.unbind(this.type,this.fn);else if(this.fn2)
this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
$.event.remove(el,query.type,query.fn);});}
else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)
$.each(oEls,function(i,el){if($.inArray(el,els)<0)
query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)
$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);}
else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)
$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)
$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)
r.context=a.context,r.selector=a.selector;if(typeof a=='string')
r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);;(function($){$.fn.extend({autocomplete:function(urlOrData,options){var isUrl=typeof urlOrData=="string";options=$.extend({},$.Autocompleter.defaults,{url:isUrl?urlOrData:null,data:isUrl?null:urlOrData,delay:isUrl?$.Autocompleter.defaults.delay:10,max:options&&!options.scroll?10:150},options);options.highlight=options.highlight||function(value){return value;};options.formatMatch=options.formatMatch||options.formatItem;return this.each(function(){new $.Autocompleter(this,options);});},result:function(handler){return this.bind("result",handler);},search:function(handler){return this.trigger("search",[handler]);},flushCache:function(){return this.trigger("flushCache");},setOptions:function(options){return this.trigger("setOptions",[options]);},unautocomplete:function(){return this.trigger("unautocomplete");}});$.Autocompleter=function(input,options){var KEY={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var $input=$(input).attr("autocomplete","off").addClass(options.inputClass);var timeout;var previousValue="";var cache=$.Autocompleter.Cache(options);var hasFocus=0;var lastKeyPressCode;var config={mouseDownOnSelect:false};var select=$.Autocompleter.Select(options,input,selectCurrent,config);var blockSubmit;$.browser.opera&&$(input.form).bind("submit.autocomplete",function(){if(blockSubmit){blockSubmit=false;return false;}});$input.bind(($.browser.opera?"keypress":"keydown")+".autocomplete",function(event){lastKeyPressCode=event.keyCode;switch(event.keyCode){case KEY.UP:event.preventDefault();if(select.visible()){select.prev();}else{onChange(0,true);}
break;case KEY.DOWN:event.preventDefault();if(select.visible()){select.next();}else{onChange(0,true);}
break;case KEY.PAGEUP:event.preventDefault();if(select.visible()){select.pageUp();}else{onChange(0,true);}
break;case KEY.PAGEDOWN:event.preventDefault();if(select.visible()){select.pageDown();}else{onChange(0,true);}
break;case options.multiple&&$.trim(options.multipleSeparator)==","&&KEY.COMMA:case KEY.TAB:case KEY.RETURN:if(selectCurrent()){event.preventDefault();blockSubmit=true;return false;}
break;case KEY.ESC:select.hide();break;default:clearTimeout(timeout);timeout=setTimeout(onChange,options.delay);break;}}).focus(function(){hasFocus++;}).blur(function(){hasFocus=0;if(!config.mouseDownOnSelect){hideResults();}}).click(function(){if(hasFocus++>1&&!select.visible()){onChange(0,true);}}).bind("search",function(){var fn=(arguments.length>1)?arguments[1]:null;function findValueCallback(q,data){var result;if(data&&data.length){for(var i=0;i<data.length;i++){if(data[i].result.toLowerCase()==q.toLowerCase()){result=data[i];break;}}}
if(typeof fn=="function")fn(result);else $input.trigger("result",result&&[result.data,result.value]);}
$.each(trimWords($input.val()),function(i,value){request(value,findValueCallback,findValueCallback);});}).bind("flushCache",function(){cache.flush();}).bind("setOptions",function(){$.extend(options,arguments[1]);if("data"in arguments[1])
cache.populate();}).bind("unautocomplete",function(){select.unbind();$input.unbind();$(input.form).unbind(".autocomplete");});function selectCurrent(){var selected=select.selected();if(!selected)
return false;var v=selected.result;previousValue=v;if(options.multiple){var words=trimWords($input.val());if(words.length>1){v=words.slice(0,words.length-1).join(options.multipleSeparator)+options.multipleSeparator+v;}
v+=options.multipleSeparator;}
$input.val(v);hideResultsNow();$input.trigger("result",[selected.data,selected.value]);return true;}
function onChange(crap,skipPrevCheck){if(lastKeyPressCode==KEY.DEL){select.hide();return;}
var currentValue=$input.val();if(!skipPrevCheck&&currentValue==previousValue)
return;previousValue=currentValue;currentValue=lastWord(currentValue);if(currentValue.length>=options.minChars){$input.addClass(options.loadingClass);if(!options.matchCase)
currentValue=currentValue.toLowerCase();request(currentValue,receiveData,hideResultsNow);}else{stopLoading();select.hide();}};function trimWords(value){if(!value){return[""];}
var words=value.split(options.multipleSeparator);var result=[];$.each(words,function(i,value){if($.trim(value))
result[i]=$.trim(value);});return result;}
function lastWord(value){if(!options.multiple)
return value;var words=trimWords(value);return words[words.length-1];}
function autoFill(q,sValue){if(options.autoFill&&(lastWord($input.val()).toLowerCase()==q.toLowerCase())&&lastKeyPressCode!=KEY.BACKSPACE){$input.val($input.val()+sValue.substring(lastWord(previousValue).length));$.Autocompleter.Selection(input,previousValue.length,previousValue.length+sValue.length);}};function hideResults(){clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){var wasVisible=select.visible();select.hide();clearTimeout(timeout);stopLoading();if(options.mustMatch){$input.search(function(result){if(!result){if(options.multiple){var words=trimWords($input.val()).slice(0,-1);$input.val(words.join(options.multipleSeparator)+(words.length?options.multipleSeparator:""));}
else
$input.val("");}});}
if(wasVisible)
$.Autocompleter.Selection(input,input.value.length,input.value.length);};function receiveData(q,data){if(data&&data.length&&hasFocus){stopLoading();select.display(data,q);autoFill(q,data[0].value);select.show();}else{hideResultsNow();}};function request(term,success,failure){if(!options.matchCase)
term=term.toLowerCase();var data=cache.load(term);if(data&&data.length){success(term,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var extraParams={timestamp:+new Date()};$.each(options.extraParams,function(key,param){extraParams[key]=typeof param=="function"?param():param;});$.ajax({mode:"abort",port:"autocomplete"+input.name,dataType:options.dataType,url:options.url,data:$.extend({q:lastWord(term),limit:options.max},extraParams),success:function(data){var parsed=options.parse&&options.parse(data)||parse(data);cache.add(term,parsed);success(term,parsed);}});}else{select.emptyList();failure(term);}};function parse(data){var parsed=[];var rows=data.split("\n");for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){row=row.split("|");parsed[parsed.length]={data:row,value:row[0],result:options.formatResult&&options.formatResult(row,row[0])||row[0]};}}
return parsed;};function stopLoading(){$input.removeClass(options.loadingClass);};};$.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(row){return row[0];},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(value,term){return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>");},scroll:true,scrollHeight:180};$.Autocompleter.Cache=function(options){var data={};var length=0;function matchSubset(s,sub){if(!options.matchCase)
s=s.toLowerCase();var i=s.indexOf(sub);if(options.matchContains=="word"){i=s.toLowerCase().search("\\b"+sub.toLowerCase());}
if(i==-1)return false;return i==0||options.matchContains;};function add(q,value){if(length>options.cacheLength){flush();}
if(!data[q]){length++;}
data[q]=value;}
function populate(){if(!options.data)return false;var stMatchSets={},nullData=0;if(!options.url)options.cacheLength=1;stMatchSets[""]=[];for(var i=0,ol=options.data.length;i<ol;i++){var rawValue=options.data[i];rawValue=(typeof rawValue=="string")?[rawValue]:rawValue;var value=options.formatMatch(rawValue,i+1,options.data.length);if(value===false)
continue;var firstChar=value.charAt(0).toLowerCase();if(!stMatchSets[firstChar])
stMatchSets[firstChar]=[];var row={value:value,data:rawValue,result:options.formatResult&&options.formatResult(rawValue)||value};stMatchSets[firstChar].push(row);if(nullData++<options.max){stMatchSets[""].push(row);}};$.each(stMatchSets,function(i,value){options.cacheLength++;add(i,value);});}
setTimeout(populate,25);function flush(){data={};length=0;}
return{flush:flush,add:add,populate:populate,load:function(q){if(!options.cacheLength||!length)
return null;if(!options.url&&options.matchContains){var csub=[];for(var k in data){if(k.length>0){var c=data[k];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub.push(x);}});}}
return csub;}else
if(data[q]){return data[q];}else
if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var c=data[q.substr(0,i)];if(c){var csub=[];$.each(c,function(i,x){if(matchSubset(x.value,q)){csub[csub.length]=x;}});return csub;}}}
return null;}};};$.Autocompleter.Select=function(options,input,select,config){var CLASSES={ACTIVE:"ac_over"};var listItems,active=-1,data,term="",needsInit=true,element,list;function init(){if(!needsInit)
return;element=$("<div/>").hide().addClass(options.resultsClass).css("position","absolute").appendTo(document.body);list=$("<ul/>").appendTo(element).mouseover(function(event){if(target(event).nodeName&&target(event).nodeName.toUpperCase()=='LI'){active=$("li",list).removeClass(CLASSES.ACTIVE).index(target(event));$(target(event)).addClass(CLASSES.ACTIVE);}}).click(function(event){$(target(event)).addClass(CLASSES.ACTIVE);select();input.focus();return false;}).mousedown(function(){config.mouseDownOnSelect=true;}).mouseup(function(){config.mouseDownOnSelect=false;});if(options.width>0)
element.css("width",options.width);needsInit=false;}
function target(event){var element=event.target;while(element&&element.tagName!="LI")
element=element.parentNode;if(!element)
return[];return element;}
function moveSelect(step){listItems.slice(active,active+1).removeClass(CLASSES.ACTIVE);movePosition(step);var activeItem=listItems.slice(active,active+1).addClass(CLASSES.ACTIVE);if(options.scroll){var offset=0;listItems.slice(0,active).each(function(){offset+=this.offsetHeight;});if((offset+activeItem[0].offsetHeight-list.scrollTop())>list[0].clientHeight){list.scrollTop(offset+activeItem[0].offsetHeight-list.innerHeight());}else if(offset<list.scrollTop()){list.scrollTop(offset);}}};function movePosition(step){active+=step;if(active<0){active=listItems.size()-1;}else if(active>=listItems.size()){active=0;}}
function limitNumberOfItems(available){return options.max&&options.max<available?options.max:available;}
function fillList(){list.empty();var max=limitNumberOfItems(data.length);for(var i=0;i<max;i++){if(!data[i])
continue;var formatted=options.formatItem(data[i].data,i+1,max,data[i].value,term);if(formatted===false)
continue;var li=$("<li/>").html(options.highlight(formatted,term)).addClass(i%2==0?"ac_even":"ac_odd").appendTo(list)[0];$.data(li,"ac_data",data[i]);}
listItems=list.find("li");if(options.selectFirst){listItems.slice(0,1).addClass(CLASSES.ACTIVE);active=0;}
if($.fn.bgiframe)
list.bgiframe();}
return{display:function(d,q){init();data=d;term=q;fillList();},next:function(){moveSelect(1);},prev:function(){moveSelect(-1);},pageUp:function(){if(active!=0&&active-8<0){moveSelect(-active);}else{moveSelect(-8);}},pageDown:function(){if(active!=listItems.size()-1&&active+8>listItems.size()){moveSelect(listItems.size()-1-active);}else{moveSelect(8);}},hide:function(){element&&element.hide();listItems&&listItems.removeClass(CLASSES.ACTIVE);active=-1;},visible:function(){return element&&element.is(":visible");},current:function(){return this.visible()&&(listItems.filter("."+CLASSES.ACTIVE)[0]||options.selectFirst&&listItems[0]);},show:function(){var offset=$(input).offset();element.css({width:typeof options.width=="string"||options.width>0?options.width:$(input).width(),top:offset.top+input.offsetHeight,left:offset.left}).show();if(options.scroll){list.scrollTop(0);list.css({maxHeight:options.scrollHeight,overflow:'auto'});if($.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var listHeight=0;listItems.each(function(){listHeight+=this.offsetHeight;});var scrollbarsVisible=listHeight>options.scrollHeight;list.css('height',scrollbarsVisible?options.scrollHeight:listHeight);if(!scrollbarsVisible){listItems.width(list.width()-parseInt(listItems.css("padding-left"))-parseInt(listItems.css("padding-right")));}}}},selected:function(){var selected=listItems&&listItems.filter("."+CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);return selected&&selected.length&&$.data(selected[0],"ac_data");},emptyList:function(){list&&list.empty();},unbind:function(){element&&element.remove();}};};$.Autocompleter.Selection=function(field,start,end){if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};})(jQuery);(function($){var autocompleteCounter=1;var id;$.fn.extend({ddiAutocomplete:function(options){id=autocompleteCounter++;var defaults={width:320,max:150,autoFill:false,highlight:false,url:DDI.contextPath+"/geochoice/suggest/",formatItem:function(row,i,total,value,term){var matched=row[0];if(row[1]!=undefined){var resulted=row[1];}
matched=matched.replace(new RegExp("(^"+term+")","gi"),"<strong>$1</strong>");return'<div><div style="float:left">'+matched+'</div>'
+(resulted!=undefined?'<div style="float:right">'+resulted+'</div></div>':'</div>');},formatResult:function(row){var result=row[1];if(row[1]==undefined){result=row[0];}
return result;},resultsClass:'ac_results '+id};var opts=$.extend(defaults,options);$(this).autocomplete(opts.url,opts);if($.browser.msie){var this_=this;$("div.ac_results."+id+" ul").livequery('scroll',function(){this_.focus();$(this).trigger('mouseup');});}},ddiAutocompleteDetach:function(){$(this).unautocomplete();$("div.ac_results."+id).remove().hide();}});})(jQuery);
(function($){$.widget("ui.dropdown",{_init:function(){this.dropDownVisible=false;var _this=this;this.dropDownObserver=function(event){var isChildOf=$(event.target)[0]==$(_this.element)[0];if(!isChildOf){$(event.target).parents().each(function(){isChildOf=isChildOf||$(this)[0]==$(_this.element)[0];});}
if(!isChildOf){_this.hideDropDown();}};$(this.options.opener).click(function(){if(!_this.visible()){_this.showDropDown();}else{_this.hideDropDown();}
return false;});},showDropDown:function(){this.dropDownVisible=true;$(document).bind("click.dropdown",null,this.dropDownObserver);this.options.onShow&&this.options.onShow.call($(this.element),$(this.options.opener));$(this.element).show(this.options.toggleSpeed);},hideDropDown:function(){this.dropDownVisible=false;$(document).unbind("click.dropdown",null,this.dropDownObserver);$(this.element).hide(this.options.toggleSpeed);this.options.afterHide&&this.options.afterHide.call($(this.element),$(this.options.opener));},visible:function(){return this.dropDownVisible;}});$.extend($.ui.dropdown,{getter:"visible",defaults:{opener:undefined,toggleSpeed:undefined,onShow:undefined,afterHide:undefined}});})(jQuery);;(function($){if(/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery)||/^1.1/.test($.fn.jquery)){alert('blockUI requires jQuery v1.2.3 or later!  You are using v'+$.fn.jquery);return;}
$.fn._fadeIn=$.fn.fadeIn;$.blockUI=function(opts){install(window,opts);};$.unblockUI=function(opts){remove(window,opts);};$.growlUI=function(title,message,timeout){var $m=$('<div class="growlUI"></div>');if(title)$m.append('<h1>'+title+'</h1>');if(message)$m.append('<h2>'+message+'</h2>');if(timeout==undefined)timeout=3000;$.blockUI({message:$m,fadeIn:700,fadeOut:1000,centerY:false,timeout:timeout,showOverlay:false,css:$.blockUI.defaults.growlCSS});};$.fn.block=function(opts){return this.unblock({fadeOut:0}).each(function(){if($.css(this,'position')=='static')
this.style.position='relative';if($.browser.msie)
this.style.zoom=1;install(this,opts);});};$.fn.unblock=function(opts){return this.each(function(){remove(this,opts);});};$.blockUI.version=2.18;$.blockUI.defaults={message:'<h1>Please wait...</h1>',css:{padding:0,margin:0,width:'30%',top:'40%',left:'35%',textAlign:'center',color:'#000',border:'3px solid #aaa',backgroundColor:'#fff',cursor:'wait'},overlayCSS:{backgroundColor:'#000',opacity:'0.6'},growlCSS:{width:'350px',top:'10px',left:'',right:'10px',border:'none',padding:'5px',opacity:'0.6',cursor:null,color:'#fff',backgroundColor:'#000','-webkit-border-radius':'10px','-moz-border-radius':'10px'},iframeSrc:'javascript:false',forceIframe:false,baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var ie6=$.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);var pageBlock=null;var pageBlockEls=[];function install(el,opts){var full=(el==window);var msg=opts&&opts.message!==undefined?opts.message:undefined;opts=$.extend({},$.blockUI.defaults,opts||{});opts.overlayCSS=$.extend({},$.blockUI.defaults.overlayCSS,opts.overlayCSS||{});var css=$.extend({},$.blockUI.defaults.css,opts.css||{});msg=msg===undefined?opts.message:msg;if(full&&pageBlock)
remove(window,{fadeOut:0});if(msg&&typeof msg!='string'&&(msg.parentNode||msg.jquery)){var node=msg.jquery?msg[0]:msg;var data={};$(el).data('blockUI.history',data);data.el=node;data.parent=node.parentNode;data.display=node.style.display;data.position=node.style.position;if(data.parent)
data.parent.removeChild(node);}
var z=opts.baseZ;var lyr1=($.browser.msie)?$('<iframe class="blockUI" style="z-index:'+(z++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>'):$('<div class="blockUI" style="display:none"></div>');var lyr2=$('<div class="blockUI blockOverlay" style="z-index:'+(z++)+';display:none;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var lyr3=full?$('<div class="blockUI blockMsg blockPage" style="z-index:'+z+';display:none;position:fixed"></div>'):$('<div class="blockUI blockMsg blockElement" style="z-index:'+z+';display:none;position:absolute"></div>');if(msg)
lyr3.css(css);if(!opts.applyPlatformOpacityRules||!($.browser.mozilla&&/Linux/.test(navigator.platform)))
lyr2.css(opts.overlayCSS);lyr2.css('position',full?'fixed':'absolute');if($.browser.msie)
lyr1.css('opacity','0.0');$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full?'body':el);var expr=$.browser.msie&&($.browser.version<8||!$.boxModel)&&(!$.boxModel||$('object,embed',full?null:el).length>0);if(ie6||(expr&&lyr3[0].style.setExpression)){if(full&&opts.allowBodyStretch&&$.boxModel)
$('html,body').css('height','100%');if((ie6||!$.boxModel)&&!full){var t=sz(el,'borderTopWidth'),l=sz(el,'borderLeftWidth');var fixT=t?'(0 - '+t+')':0;var fixL=l?'(0 - '+l+')':0;}
$.each([lyr1,lyr2,lyr3],function(i,o){var s=o[0].style;s.position='absolute';if(i<2){full?s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"'):s.setExpression('height','this.parentNode.offsetHeight + "px"');full?s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):s.setExpression('width','this.parentNode.offsetWidth + "px"');if(fixL)s.setExpression('left',fixL);if(fixT)s.setExpression('top',fixT);}
else if(opts.centerY){if(full)s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');s.marginTop=0;}
else if(!opts.centerY&&full){var top=(opts.css&&opts.css.top)?parseInt(opts.css.top):0;var expression='((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';s.setExpression('top',expression);}});}
if(msg){lyr3.append(msg);if(msg.jquery||msg.nodeType)
$(msg).show();}
if($.browser.msie&&opts.showOverlay)
lyr1.show();if(opts.fadeIn){if(opts.showOverlay)
lyr2._fadeIn(opts.fadeIn);if(msg)
lyr3.fadeIn(opts.fadeIn);}
else{if(opts.showOverlay)
lyr2.show();if(msg)
lyr3.show();}
bind(1,el,opts);if(full){pageBlock=lyr3[0];pageBlockEls=$(':input:enabled:visible',pageBlock);if(opts.focusInput)
setTimeout(focus,20);}
else
center(lyr3[0],opts.centerX,opts.centerY);if(opts.timeout){var to=setTimeout(function(){full?$.unblockUI(opts):$(el).unblock(opts);},opts.timeout);$(el).data('blockUI.timeout',to);}};function remove(el,opts){var full=el==window;var $el=$(el);var data=$el.data('blockUI.history');var to=$el.data('blockUI.timeout');if(to){clearTimeout(to);$el.removeData('blockUI.timeout');}
opts=$.extend({},$.blockUI.defaults,opts||{});bind(0,el,opts);var els=full?$('body').children().filter('.blockUI'):$('.blockUI',el);if(full)
pageBlock=pageBlockEls=null;if(opts.fadeOut){els.fadeOut(opts.fadeOut);setTimeout(function(){reset(els,data,opts,el);},opts.fadeOut);}
else
reset(els,data,opts,el);};function reset(els,data,opts,el){els.each(function(i,o){if(this.parentNode)
this.parentNode.removeChild(this);});if(data&&data.el){data.el.style.display=data.display;data.el.style.position=data.position;if(data.parent)
data.parent.appendChild(data.el);$(data.el).removeData('blockUI.history');}
if(typeof opts.onUnblock=='function')
opts.onUnblock(el,opts);};function bind(b,el,opts){var full=el==window,$el=$(el);if(!b&&(full&&!pageBlock||!full&&!$el.data('blockUI.isBlocked')))
return;if(!full)
$el.data('blockUI.isBlocked',b);if(b&&!opts.showOverlay)
return;var events='mousedown mouseup keydown keypress';b?$(document).bind(events,opts,handler):$(document).unbind(events,handler);};function handler(e){if(e.keyCode&&e.keyCode==9){if(pageBlock&&e.data.constrainTabKey){var els=pageBlockEls;var fwd=!e.shiftKey&&e.target==els[els.length-1];var back=e.shiftKey&&e.target==els[0];if(fwd||back){setTimeout(function(){focus(back)},10);return false;}}}
if($(e.target).parents('div.blockMsg').length>0)
return true;return $(e.target).parents().children().filter('div.blockUI').length==0;};function focus(back){if(!pageBlockEls)
return;var e=pageBlockEls[back===true?pageBlockEls.length-1:0];if(e)
e.focus();};function center(el,x,y){var p=el.parentNode,s=el.style;var l=((p.offsetWidth-el.offsetWidth)/2)-sz(p,'borderLeftWidth');var t=((p.offsetHeight-el.offsetHeight)/2)-sz(p,'borderTopWidth');if(x)s.left=l>0?(l+'px'):'0';if(y)s.top=t>0?(t+'px'):'0';};function sz(el,p){return parseInt($.css(el,p))||0;};})(jQuery);;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log('ajaxSubmit: skipping submit process - no element selected');return this;}
if(typeof options=='function')
options={success:options};options=$.extend({url:this.attr('action')||window.location.toString(),type:this.attr('method')||'GET'},options||{});var veto={};this.trigger('form-pre-serialize',[this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');return this;}
if(options.beforeSerialize&&options.beforeSerialize(this,options)===false){log('ajaxSubmit: submit aborted via beforeSerialize callback');return this;}
var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n]instanceof Array){for(var k in options.data[n])
a.push({name:n,value:options.data[n][k]})}
else
a.push({name:n,value:options.data[n]});}}
if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log('ajaxSubmit: submit aborted via beforeSubmit callback');return this;}
this.trigger('form-submit-validate',[a,this,options,veto]);if(veto.veto){log('ajaxSubmit: submit vetoed via form-submit-validate trigger');return this;}
var q=$.param(a);if(options.type.toUpperCase()=='GET'){options.url+=(options.url.indexOf('?')>=0?'&':'?')+q;options.data=null;}
else
options.data=q;var $form=this,callbacks=[];if(options.resetForm)callbacks.push(function(){$form.resetForm();});if(options.clearForm)callbacks.push(function(){$form.clearForm();});if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}
else if(options.success)
callbacks.push(options.success);options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++)
callbacks[i].apply(options,[data,status,$form]);};var files=$('input:file',this).fieldValue();var found=false;for(var j=0;j<files.length;j++)
if(files[j])
found=true;if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive)
$.get(options.closeKeepAlive,fileUpload);else
fileUpload();}
else
$.ajax(options);this.trigger('form-submit-notify',[this,options]);return this;function fileUpload(){var form=$form[0];if($(':input[name=submit]',form).length){alert('Error: Form elements must not be named "submit".');return;}
var opts=$.extend({},$.ajaxSettings,options);var s=jQuery.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id='jqFormIO'+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];if($.browser.msie||$.browser.opera)
io.src='javascript:false;document.write("");';$io.css({position:'absolute',top:'-1000px',left:'-1000px'});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:'n/a',getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr('src','about:blank');}};var g=opts.global;if(g&&!$.active++)$.event.trigger("ajaxStart");if(g)$.event.trigger("ajaxSend",[xhr,opts]);if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;return;}
if(xhr.aborted)
return;var cbInvoked=0;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){options.extraData=options.extraData||{};options.extraData[n]=sub.value;if(sub.type=="image"){options.extraData[name+'.x']=form.clk_x;options.extraData[name+'.y']=form.clk_y;}}}
setTimeout(function(){var t=$form.attr('target'),a=$form.attr('action');$form.attr({target:id,method:'POST',action:opts.url});if(!options.skipEncodingOverride){$form.attr({encoding:'multipart/form-data',enctype:'multipart/form-data'});}
if(opts.timeout)
setTimeout(function(){timedOut=true;cb();},opts.timeout);var extraInputs=[];try{if(options.extraData)
for(var n in options.extraData)
extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0]);$io.appendTo('body');io.attachEvent?io.attachEvent('onload',cb):io.addEventListener('load',cb,false);form.submit();}
finally{$form.attr('action',a);t?$form.attr('target',t):$form.removeAttr('target');$(extraInputs).remove();}},10);function cb(){if(cbInvoked++)return;io.detachEvent?io.detachEvent('onload',cb):io.removeEventListener('load',cb,false);var operaHack=0;var ok=true;try{if(timedOut)throw'timeout';var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;if(doc.body==null&&!operaHack&&$.browser.opera){operaHack=1;cbInvoked--;setTimeout(cb,100);return;}
xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={'content-type':opts.dataType};return headers[header];};if(opts.dataType=='json'||opts.dataType=='script'){var ta=doc.getElementsByTagName('textarea')[0];xhr.responseText=ta?ta.value:xhr.responseText;}
else if(opts.dataType=='xml'&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}
data=$.httpData(xhr,opts.dataType);}
catch(e){ok=false;$.handleError(opts,xhr,'error',e);}
if(ok){opts.success(data,'success');if(g)$.event.trigger("ajaxSuccess",[xhr,opts]);}
if(g)$.event.trigger("ajaxComplete",[xhr,opts]);if(g&&!--$.active)$.event.trigger("ajaxStop");if(opts.complete)opts.complete(xhr,ok?'success':'error');setTimeout(function(){$io.remove();xhr.responseXML=null;},100);};function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject('Microsoft.XMLDOM');doc.async='false';doc.loadXML(s);}
else
doc=(new DOMParser()).parseFromString(s,'text/xml');return(doc&&doc.documentElement&&doc.documentElement.tagName!='parsererror')?doc:null;};};};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind('submit.form-plugin',function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind('click.form-plugin',function(e){var form=this.form;form.clk=this;if(this.type=='image'){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else if(typeof $.fn.offset=='function'){var offset=$(this).offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-this.offsetLeft;form.clk_y=e.pageY-this.offsetTop;}}
setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind('submit.form-plugin');return this.each(function(){$(":submit,input:image",this).unbind('click.form-plugin');});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0)return a;var form=this[0];var els=semantic?form.getElementsByTagName('*'):form.elements;if(!els)return a;for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n)continue;if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});continue;}
var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++)
a.push({name:n,value:v[j]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:n,value:v});}
if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input)
a.push({name:n+'.x',value:form.clk_x},{name:n+'.y',value:form.clk_y});}}
return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n)return;var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++)
a.push({name:n,value:v[i]});}
else if(v!==null&&typeof v!='undefined')
a.push({name:this.name,value:v});});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=='undefined'||(v.constructor==Array&&!v.length))
continue;v.constructor==Array?$.merge(val,v):val.push(v);}
return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=='undefined')successful=true;if(successful&&(!n||el.disabled||t=='reset'||t=='button'||(t=='checkbox'||t=='radio')&&!el.checked||(t=='submit'||t=='image')&&el.form&&el.form.clk!=el||tag=='select'&&el.selectedIndex==-1))
return null;if(tag=='select'){var index=el.selectedIndex;if(index<0)return null;var a=[],ops=el.options;var one=(t=='select-one');var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&&!(op.attributes['value'].specified)?op.text:op.value;if(one)return v;a.push(v);}}
return a;}
return el.value;};$.fn.clearForm=function(){return this.each(function(){$('input,select,textarea',this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=='text'||t=='password'||tag=='textarea')
this.value='';else if(t=='checkbox'||t=='radio')
this.checked=false;else if(tag=='select')
this.selectedIndex=-1;});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=='function'||(typeof this.reset=='object'&&!this.reset.nodeType))
this.reset();});};$.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b});};$.fn.selected=function(select){if(select==undefined)select=true;return this.each(function(){var t=this.type;if(t=='checkbox'||t=='radio')
this.checked=select;else if(this.tagName.toLowerCase()=='option'){var $sel=$(this).parent('select');if(select&&$sel[0]&&$sel[0].type=='select-one'){$sel.find('option').selected(false);}
this.selected=select;}});};function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log)
window.console.log('[jquery.form] '+Array.prototype.join.call(arguments,''));};})(jQuery);(function($){var _bindLinks=function(path,params,callback){var options={event:'submit',link:DDI.contextPath+path,method:'POST',forms:'#sendAsEmailForm',params:params,onSuccess:function(response){if(callback&&response&&response.type){callback(response.type);}
if(response&&response.callback){response.callback();}}};$("#sendAsEmailForm").dialogAjaxify(options);$("#resetButton").click(function(){$("form#sendAsEmailForm").clearForm();});};DDI.SendAsEmail={initInfopageForm:function(type){var path;if(window.location.search==null||window.location.search==''){path=window.location.href;}else{var index=window.location.href.indexOf(window.location.search);path=window.location.href.substring(0,index);}
var params='url='+encodeURIComponent(path)+'&'+type;_bindLinks('/infopage/sendasemail/',params,DDI.SendAsEmail.initInfopageForm);},initMapForm:function(){var params="url="+encodeURIComponent(window.location.href);_bindLinks('/mapmail/',params);}};})(jQuery);
(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);(function($){$.extend({isJSON:function(str){str=jQuery.trim(str);if(str===''){return false;}
str=str.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"/g,'');return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);}});})(jQuery);(function($)
{$.fn.qtip=function(options,blanket)
{var i,id,interfaces,opts,obj,command,config,api;if(typeof options=='string')
{if(typeof $(this).data('qtip')!=='object')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_TOOLTIP_PRESENT,false);if(options=='api')
return $(this).data('qtip').interfaces[$(this).data('qtip').current];else if(options=='interfaces')
return $(this).data('qtip').interfaces;}
else
{if(!options)options={};if(typeof options.content!=='object'||(options.content.jquery&&options.content.length>0))options.content={text:options.content};if(typeof options.content.title!=='object')options.content.title={text:options.content.title};if(typeof options.position!=='object')options.position={corner:options.position};if(typeof options.position.corner!=='object')options.position.corner={target:options.position.corner,tooltip:options.position.corner};if(typeof options.show!=='object')options.show={when:options.show};if(typeof options.show.when!=='object')options.show.when={event:options.show.when};if(typeof options.show.effect!=='object')options.show.effect={type:options.show.effect};if(typeof options.hide!=='object')options.hide={when:options.hide};if(typeof options.hide.when!=='object')options.hide.when={event:options.hide.when};if(typeof options.hide.effect!=='object')options.hide.effect={type:options.hide.effect};if(typeof options.style!=='object')options.style={name:options.style};options.style=sanitizeStyle(options.style);opts=$.extend(true,{},$.fn.qtip.defaults,options);opts.style=buildStyle.call({options:opts},opts.style);opts.user=$.extend(true,{},options);};return $(this).each(function()
{if(typeof options=='string')
{command=options.toLowerCase();interfaces=$(this).qtip('interfaces');if(typeof interfaces=='object')
{if(blanket===true&&command=='destroy')
while(interfaces.length>0)interfaces[interfaces.length-1].destroy();else
{if(blanket!==true)interfaces=[$(this).qtip('api')];for(i=0;i<interfaces.length;i++)
{if(command=='destroy')interfaces[i].destroy();else if(interfaces[i].status.rendered===true)
{if(command=='show')interfaces[i].show();else if(command=='hide')interfaces[i].hide();else if(command=='focus')interfaces[i].focus();else if(command=='disable')interfaces[i].disable(true);else if(command=='enable')interfaces[i].disable(false);};};};};}
else
{config=$.extend(true,{},opts);config.hide.effect.length=opts.hide.effect.length;config.show.effect.length=opts.show.effect.length;if(config.position.container===false)config.position.container=$(document.body);if(config.position.target===false)config.position.target=$(this);if(config.show.when.target===false)config.show.when.target=$(this);if(config.hide.when.target===false)config.hide.when.target=$(this);id=$.fn.qtip.interfaces.length;for(i=0;i<id;i++)
{if(typeof $.fn.qtip.interfaces[i]=='undefined'){id=i;break;};};obj=new qTip($(this),config,id);$.fn.qtip.interfaces[id]=obj;if(typeof $(this).data('qtip')=='object')
{if(typeof $(this).attr('qtip')==='undefined')
$(this).data('qtip').current=$(this).data('qtip').interfaces.length;$(this).data('qtip').interfaces.push(obj);}
else $(this).data('qtip',{current:0,interfaces:[obj]});if(config.content.prerender===false&&config.show.when.event!==false&&config.show.ready!==true)
{config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create',{qtip:id},function(event)
{api=$.fn.qtip.interfaces[event.data.qtip];api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');api.cache.mouse={x:event.pageX,y:event.pageY};construct.call(api);api.options.show.when.target.trigger(api.options.show.when.event);});}
else
{obj.cache.mouse={x:config.show.when.target.offset().left,y:config.show.when.target.offset().top};construct.call(obj);}};});};function qTip(target,options,id)
{var self=this;self.id=id;self.options=options;self.status={animated:false,rendered:false,disabled:false,focused:false};self.elements={target:target.addClass(self.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};self.cache={mouse:{},position:{},toggle:0};self.timers={};$.extend(self,self.options.api,{show:function(event)
{var returned,solo;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'show');if(self.elements.tooltip.css('display')!=='none')return self;self.elements.tooltip.stop(true,false);returned=self.beforeShow.call(self,event);if(returned===false)return self;function afterShow()
{if(self.options.position.type!=='static')self.focus();self.onShow.call(self,event);if($.browser.msie)self.elements.tooltip.get(0).style.removeAttribute('filter');};self.cache.toggle=1;if(self.options.position.type!=='static')
self.updatePosition(event,(self.options.show.effect.length>0));if(typeof self.options.show.solo=='object')solo=$(self.options.show.solo);else if(self.options.show.solo===true)solo=$('div.qtip').not(self.elements.tooltip);if(solo)solo.each(function(){if($(this).qtip('api').status.rendered===true)$(this).qtip('api').hide();});if(typeof self.options.show.effect.type=='function')
{self.options.show.effect.type.call(self.elements.tooltip,self.options.show.effect.length);self.elements.tooltip.queue(function(){afterShow();$(this).dequeue();});}
else
{switch(self.options.show.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeIn(self.options.show.effect.length,afterShow);break;case'slide':self.elements.tooltip.slideDown(self.options.show.effect.length,function()
{afterShow();if(self.options.position.type!=='static')self.updatePosition(event,true);});break;case'grow':self.elements.tooltip.show(self.options.show.effect.length,afterShow);break;default:self.elements.tooltip.show(null,afterShow);break;};self.elements.tooltip.addClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_SHOWN,'show');},hide:function(event)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'hide');else if(self.elements.tooltip.css('display')==='none')return self;clearTimeout(self.timers.show);self.elements.tooltip.stop(true,false);returned=self.beforeHide.call(self,event);if(returned===false)return self;function afterHide(){self.onHide.call(self,event);};self.cache.toggle=0;if(typeof self.options.hide.effect.type=='function')
{self.options.hide.effect.type.call(self.elements.tooltip,self.options.hide.effect.length);self.elements.tooltip.queue(function(){afterHide();$(this).dequeue();});}
else
{switch(self.options.hide.effect.type.toLowerCase())
{case'fade':self.elements.tooltip.fadeOut(self.options.hide.effect.length,afterHide);break;case'slide':self.elements.tooltip.slideUp(self.options.hide.effect.length,afterHide);break;case'grow':self.elements.tooltip.hide(self.options.hide.effect.length,afterHide);break;default:self.elements.tooltip.hide(null,afterHide);break;};self.elements.tooltip.removeClass(self.options.style.classes.active);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_HIDDEN,'hide');},updatePosition:function(event,animate)
{var i,target,tooltip,coords,mapName,imagePos,newPosition,ieAdjust,ie6Adjust,borderAdjust,mouseAdjust,offset,curPosition,returned
if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updatePosition');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_POSITION_STATIC,'updatePosition');target={position:{left:0,top:0},dimensions:{height:0,width:0},corner:self.options.position.corner.target};tooltip={position:self.getPosition(),dimensions:self.getDimensions(),corner:self.options.position.corner.tooltip};if(self.options.position.target!=='mouse')
{if(self.options.position.target.get(0).nodeName.toLowerCase()=='area')
{coords=self.options.position.target.attr('coords').split(',');for(i=0;i<coords.length;i++)coords[i]=parseInt(coords[i]);mapName=self.options.position.target.parent('map').attr('name');imagePos=$('img[usemap="#'+mapName+'"]:first').offset();target.position={left:Math.floor(imagePos.left+coords[0]),top:Math.floor(imagePos.top+coords[1])};switch(self.options.position.target.attr('shape').toLowerCase())
{case'rect':target.dimensions={width:Math.ceil(Math.abs(coords[2]-coords[0])),height:Math.ceil(Math.abs(coords[3]-coords[1]))};break;case'circle':target.dimensions={width:coords[2]+1,height:coords[2]+1};break;case'poly':target.dimensions={width:coords[0],height:coords[1]};for(i=0;i<coords.length;i++)
{if(i%2==0)
{if(coords[i]>target.dimensions.width)
target.dimensions.width=coords[i];if(coords[i]<coords[0])
target.position.left=Math.floor(imagePos.left+coords[i]);}
else
{if(coords[i]>target.dimensions.height)
target.dimensions.height=coords[i];if(coords[i]<coords[1])
target.position.top=Math.floor(imagePos.top+coords[i]);};};target.dimensions.width=target.dimensions.width-(target.position.left-imagePos.left);target.dimensions.height=target.dimensions.height-(target.position.top-imagePos.top);break;default:return $.fn.qtip.log.error.call(self,4,$.fn.qtip.constants.INVALID_AREA_SHAPE,'updatePosition');break;};target.dimensions.width-=2;target.dimensions.height-=2;}
else if(self.options.position.target.add(document.body).length===1)
{target.position={left:$(document).scrollLeft(),top:$(document).scrollTop()};target.dimensions={height:$(window).height(),width:$(window).width()};}
else
{if(typeof self.options.position.target.attr('qtip')!=='undefined')
target.position=self.options.position.target.qtip('api').cache.position;else
target.position=self.options.position.target.offset();target.dimensions={height:self.options.position.target.outerHeight(),width:self.options.position.target.outerWidth()};};newPosition=$.extend({},target.position);if(target.corner.search(/right/i)!==-1)
newPosition.left+=target.dimensions.width;if(target.corner.search(/bottom/i)!==-1)
newPosition.top+=target.dimensions.height;if(target.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left+=(target.dimensions.width/2);if(target.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top+=(target.dimensions.height/2);}
else
{target.position=newPosition={left:self.cache.mouse.x,top:self.cache.mouse.y};target.dimensions={height:1,width:1};};if(tooltip.corner.search(/right/i)!==-1)
newPosition.left-=tooltip.dimensions.width;if(tooltip.corner.search(/bottom/i)!==-1)
newPosition.top-=tooltip.dimensions.height;if(tooltip.corner.search(/((top|bottom)Middle)|center/)!==-1)
newPosition.left-=(tooltip.dimensions.width/2);if(tooltip.corner.search(/((left|right)Middle)|center/)!==-1)
newPosition.top-=(tooltip.dimensions.height/2);ieAdjust=($.browser.msie)?1:0;ie6Adjust=($.browser.msie&&parseInt($.browser.version.charAt(0))===6)?1:0;if(self.options.style.border.radius>0)
{if(tooltip.corner.search(/Left/)!==-1)
newPosition.left-=self.options.style.border.radius;else if(tooltip.corner.search(/Right/)!==-1)
newPosition.left+=self.options.style.border.radius;if(tooltip.corner.search(/Top/)!==-1)
newPosition.top-=self.options.style.border.radius;else if(tooltip.corner.search(/Bottom/)!==-1)
newPosition.top+=self.options.style.border.radius;};if(ieAdjust)
{if(tooltip.corner.search(/top/)!==-1)
newPosition.top-=ieAdjust
else if(tooltip.corner.search(/bottom/)!==-1)
newPosition.top+=ieAdjust
if(tooltip.corner.search(/left/)!==-1)
newPosition.left-=ieAdjust
else if(tooltip.corner.search(/right/)!==-1)
newPosition.left+=ieAdjust
if(tooltip.corner.search(/leftMiddle|rightMiddle/)!==-1)
newPosition.top-=1};if(self.options.position.adjust.screen===true)
newPosition=screenAdjust.call(self,newPosition,target,tooltip);if(self.options.position.target==='mouse'&&self.options.position.adjust.mouse===true)
{if(self.options.position.adjust.screen===true&&self.elements.tip)
mouseAdjust=self.elements.tip.attr('rel');else
mouseAdjust=self.options.position.corner.tooltip;newPosition.left+=(mouseAdjust.search(/right/i)!==-1)?-6:6;newPosition.top+=(mouseAdjust.search(/bottom/i)!==-1)?-6:6;}
if(!self.elements.bgiframe&&$.browser.msie&&parseInt($.browser.version.charAt(0))==6)
{$('select, object').each(function()
{offset=$(this).offset();offset.bottom=offset.top+$(this).height();offset.right=offset.left+$(this).width();if(newPosition.top+tooltip.dimensions.height>=offset.top&&newPosition.left+tooltip.dimensions.width>=offset.left)
bgiframe.call(self);});};newPosition.left+=self.options.position.adjust.x;newPosition.top+=self.options.position.adjust.y;curPosition=self.getPosition();if(newPosition.left!=curPosition.left||newPosition.top!=curPosition.top)
{returned=self.beforePositionUpdate.call(self,event);if(returned===false)return self;self.cache.position=newPosition;if(animate===true)
{self.status.animated=true;self.elements.tooltip.animate(newPosition,200,'swing',function(){self.status.animated=false});}
else self.elements.tooltip.css(newPosition);self.onPositionUpdate.call(self,event);if(typeof event!=='undefined'&&event.type&&event.type!=='mousemove')
$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_POSITION_UPDATED,'updatePosition');};return self;},updateWidth:function(newWidth)
{var hidden;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateWidth');else if(newWidth&&typeof newWidth!=='number')
return $.fn.qtip.log.error.call(self,2,'newWidth must be of type number','updateWidth');hidden=self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);if(!newWidth)
{if(typeof self.options.style.width.value=='number')
newWidth=self.options.style.width.value;else
{self.elements.tooltip.css({width:'auto'});hidden.hide();if($.browser.msie)
self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'normal'});newWidth=self.getDimensions().width+1;if(!self.options.style.width.value)
{if(newWidth>self.options.style.width.max)newWidth=self.options.style.width.max
if(newWidth<self.options.style.width.min)newWidth=self.options.style.width.min};};};if(newWidth%2!==0)newWidth-=1;self.elements.tooltip.width(newWidth);hidden.show();if(self.options.style.border.radius)
{self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
{$(this).width(newWidth-(self.options.style.border.radius*2));})};if($.browser.msie)
{self.elements.wrapper.add(self.elements.contentWrapper.children()).css({zoom:'1'});self.elements.wrapper.width(newWidth);if(self.elements.bgiframe)self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_WIDTH_UPDATED,'updateWidth');},updateStyle:function(name)
{var tip,borders,context,corner,coordinates;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateStyle');else if(typeof name!=='string'||!$.fn.qtip.styles[name])
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.STYLE_NOT_DEFINED,'updateStyle');self.options.style=buildStyle.call(self,$.fn.qtip.styles[name],self.options.user.style);self.elements.content.css(jQueryStyle(self.options.style));if(self.options.content.title.text!==false)
self.elements.title.css(jQueryStyle(self.options.style.title,true));self.elements.contentWrapper.css({borderColor:self.options.style.border.color});if(self.options.style.tip.corner!==false)
{if($('<canvas>').get(0).getContext)
{tip=self.elements.tooltip.find('.qtip-tip canvas:first');context=tip.get(0).getContext('2d');context.clearRect(0,0,300,300);corner=tip.parent('div[rel]:first').attr('rel');coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);drawTip.call(self,tip,coordinates,self.options.style.tip.color||self.options.style.border.color);}
else if($.browser.msie)
{tip=self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');tip.attr('fillcolor',self.options.style.tip.color||self.options.style.border.color);};};if(self.options.style.border.radius>0)
{self.elements.tooltip.find('.qtip-betweenCorners').css({backgroundColor:self.options.style.border.color});if($('<canvas>').get(0).getContext)
{borders=calculateBorders(self.options.style.border.radius)
self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
{context=$(this).get(0).getContext('2d');context.clearRect(0,0,300,300);corner=$(this).parent('div[rel]:first').attr('rel')
drawBorder.call(self,$(this),borders[corner],self.options.style.border.radius,self.options.style.border.color);});}
else if($.browser.msie)
{self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
{$(this).attr('fillcolor',self.options.style.border.color)});};};return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_STYLE_UPDATED,'updateStyle');},updateContent:function(content,reposition)
{var parsedContent,images,loadedImages;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateContent');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateContent');parsedContent=self.beforeContentUpdate.call(self,content);if(typeof parsedContent=='string')content=parsedContent;else if(parsedContent===false)return;if($.browser.msie)self.elements.contentWrapper.children().css({zoom:'normal'});if(content.jquery&&content.length>0)
content.clone(true).appendTo(self.elements.content).show();else self.elements.content.html(content);images=self.elements.content.find('img[complete=false]');if(images.length>0)
{loadedImages=0;images.each(function(i)
{$('<img src="'+$(this).attr('src')+'" />').load(function(){if(++loadedImages==images.length)afterLoad();});});}
else afterLoad();function afterLoad()
{self.updateWidth();if(reposition!==false)
{if(self.options.position.type!=='static')
self.updatePosition(self.elements.tooltip.is(':visible'),true);if(self.options.style.tip.corner!==false)
positionTip.call(self);};};self.onContentUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_UPDATED,'loadContent');},loadContent:function(url,data,method)
{var returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'loadContent');returned=self.beforeContentLoad.call(self);if(returned===false)return self;if(method=='post')
$.post(url,data,setupContent);else
$.get(url,data,setupContent);function setupContent(content)
{self.onContentLoad.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_CONTENT_LOADED,'loadContent');self.updateContent(content);};return self;},updateTitle:function(content)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'updateTitle');else if(!content)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.NO_CONTENT_PROVIDED,'updateTitle');returned=self.beforeTitleUpdate.call(self);if(returned===false)return self;if(self.elements.button)self.elements.button=self.elements.button.clone(true);self.elements.title.html(content)
if(self.elements.button)self.elements.title.prepend(self.elements.button);self.onTitleUpdate.call(self);return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_TITLE_UPDATED,'updateTitle');},focus:function(event)
{var curIndex,newIndex,elemIndex,returned;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'focus');else if(self.options.position.type=='static')
return $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.CANNOT_FOCUS_STATIC,'focus');curIndex=parseInt(self.elements.tooltip.css('z-index'));newIndex=6000+$('div.qtip[qtip]').length-1;if(!self.status.focused&&curIndex!==newIndex)
{returned=self.beforeFocus.call(self,event);if(returned===false)return self;$('div.qtip[qtip]').not(self.elements.tooltip).each(function()
{if($(this).qtip('api').status.rendered===true)
{elemIndex=parseInt($(this).css('z-index'));if(typeof elemIndex=='number'&&elemIndex>-1)
$(this).css({zIndex:parseInt($(this).css('z-index'))-1});$(this).qtip('api').status.focused=false;}})
self.elements.tooltip.css({zIndex:newIndex});self.status.focused=true;self.onFocus.call(self,event);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_FOCUSED,'focus');};return self;},disable:function(state)
{if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'disable');if(state)
{if(!self.status.disabled)
{self.status.disabled=true;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DISABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,'disable');}
else
{if(self.status.disabled)
{self.status.disabled=false;$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_ENABLED,'disable');}
else $.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,'disable');};return self;},destroy:function()
{var i,returned,interfaces;returned=self.beforeDestroy.call(self);if(returned===false)return self;if(self.status.rendered)
{self.options.show.when.target.unbind('mousemove.qtip',self.updatePosition);self.options.show.when.target.unbind('mouseout.qtip',self.hide);self.options.show.when.target.unbind(self.options.show.when.event+'.qtip');self.options.hide.when.target.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind(self.options.hide.when.event+'.qtip');self.elements.tooltip.unbind('mouseover.qtip',self.focus);self.elements.tooltip.remove();}
else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');if(typeof self.elements.target.data('qtip')=='object')
{interfaces=self.elements.target.data('qtip').interfaces;if(typeof interfaces=='object'&&interfaces.length>0)
{for(i=0;i<interfaces.length-1;i++)
if(interfaces[i].id==self.id)interfaces.splice(i,1)}}
delete $.fn.qtip.interfaces[self.id];if(typeof interfaces=='object'&&interfaces.length>0)
self.elements.target.data('qtip').current=interfaces.length-1;else
self.elements.target.removeData('qtip');self.onDestroy.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_DESTROYED,'destroy');return self.elements.target},getPosition:function()
{var show,offset;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getPosition');show=(self.elements.tooltip.css('display')!=='none')?false:true;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();offset=self.elements.tooltip.offset();if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return offset;},getDimensions:function()
{var show,dimensions;if(!self.status.rendered)
return $.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.TOOLTIP_NOT_RENDERED,'getDimensions');show=(!self.elements.tooltip.is(':visible'))?true:false;if(show)self.elements.tooltip.css({visiblity:'hidden'}).show();dimensions={height:self.elements.tooltip.outerHeight(),width:self.elements.tooltip.outerWidth()};if(show)self.elements.tooltip.css({visiblity:'visible'}).hide();return dimensions;}});};function construct()
{var self,adjust,content,url,data,method,tempLength;self=this;self.beforeRender.call(self);self.status.rendered=true;self.elements.tooltip='<div qtip="'+self.id+'" '+'class="qtip '+(self.options.style.classes.tooltip||self.options.style)+'"'+'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;'+'position:'+self.options.position.type+';">'+'  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">'+'    <div class="qtip-contentWrapper" style="overflow:hidden;">'+'       <div class="qtip-content '+self.options.style.classes.content+'"></div>'+'</div></div></div>';self.elements.tooltip=$(self.elements.tooltip);self.elements.tooltip.appendTo(self.options.position.container)
self.elements.tooltip.data('qtip',{current:0,interfaces:[self]});self.elements.wrapper=self.elements.tooltip.children('div:first');self.elements.contentWrapper=self.elements.wrapper.children('div:first').css({background:self.options.style.background});self.elements.content=self.elements.contentWrapper.children('div:first').css(jQueryStyle(self.options.style));if($.browser.msie)self.elements.wrapper.add(self.elements.content).css({zoom:1});if(self.options.hide.when.event=='unfocus')self.elements.tooltip.attr('unfocus',true);if(typeof self.options.style.width.value=='number')self.updateWidth();if($('<canvas>').get(0).getContext||$.browser.msie)
{if(self.options.style.border.radius>0)
createBorder.call(self);else
self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});if(self.options.style.tip.corner!==false)
createTip.call(self);}
else
{self.elements.contentWrapper.css({border:self.options.style.border.width+'px solid '+self.options.style.border.color});self.options.style.border.radius=0;self.options.style.tip.corner=false;$.fn.qtip.log.error.call(self,2,$.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,'render');};if((typeof self.options.content.text=='string'&&self.options.content.text.length>0)||(self.options.content.text.jquery&&self.options.content.text.length>0))
content=self.options.content.text;else if(typeof self.elements.target.attr('title')=='string'&&self.elements.target.attr('title').length>0)
{content=self.elements.target.attr('title').replace("\\n",'<br />');self.elements.target.attr('title','');}
else if(typeof self.elements.target.attr('alt')=='string'&&self.elements.target.attr('alt').length>0)
{content=self.elements.target.attr('alt').replace("\\n",'<br />');self.elements.target.attr('alt','');}
else
{content=' ';$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.NO_VALID_CONTENT,'render');};if(self.options.content.title.text!==false)createTitle.call(self);self.updateContent(content);assignEvents.call(self);if(self.options.show.ready===true)self.show();if(self.options.content.url!==false)
{url=self.options.content.url;data=self.options.content.data;method=self.options.content.method||'get';self.loadContent(url,data,method);};self.onRender.call(self);$.fn.qtip.log.error.call(self,1,$.fn.qtip.constants.EVENT_RENDERED,'render');};function createBorder()
{var self,i,width,radius,color,coordinates,containers,size,betweenWidth,betweenCorners,borderTop,borderBottom,borderCoord,sideWidth,vertWidth;self=this;self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();width=self.options.style.border.width;radius=self.options.style.border.radius;color=self.options.style.border.color||self.options.style.tip.color;coordinates=calculateBorders(radius);containers={};for(i in coordinates)
{containers[i]='<div rel="'+i+'" style="'+((i.search(/Left/)!==-1)?'left':'right')+':0; '+'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if($('<canvas>').get(0).getContext)
containers[i]+='<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';else if($.browser.msie)
{size=radius*2+3;containers[i]+='<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" '+'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/)!==-1)?-2:-1)+'px; '+'margin-left:'+((i.search(/Right/)!==-1)?coordinates[i][2]-3.5:-1)+'px; '+'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';};containers[i]+='</div>';};betweenWidth=self.getDimensions().width-(Math.max(width,radius)*2);betweenCorners='<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; '+'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';borderTop='<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['topLeft']+containers['topRight']+betweenCorners;self.elements.wrapper.prepend(borderTop);borderBottom='<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; '+'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">'+
containers['bottomLeft']+containers['bottomRight']+betweenCorners;self.elements.wrapper.append(borderBottom);if($('<canvas>').get(0).getContext)
{self.elements.wrapper.find('canvas').each(function()
{borderCoord=coordinates[$(this).parent('[rel]:first').attr('rel')];drawBorder.call(self,$(this),borderCoord,radius,color);})}
else if($.browser.msie)self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');sideWidth=Math.max(radius,(radius+(width-radius)))
vertWidth=Math.max(width-radius,0);self.elements.contentWrapper.css({border:'0px solid '+color,borderWidth:vertWidth+'px '+sideWidth+'px'})};function drawBorder(canvas,coordinates,radius,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.arc(coordinates[0],coordinates[1],radius,0,Math.PI*2,false);context.fill();};function createTip(corner)
{var self,color,coordinates,coordsize,path;self=this;if(self.elements.tip!==null)self.elements.tip.remove();color=self.options.style.tip.color||self.options.style.border.color;if(self.options.style.tip.corner===false)return;else if(!corner)corner=self.options.style.tip.corner;coordinates=calculateTip(corner,self.options.style.tip.size.width,self.options.style.tip.size.height);self.elements.tip='<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; '+'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; '+'margin:0 auto; line-height:0.1px; font-size:1px;">';if($('<canvas>').get(0).getContext)
self.elements.tip+='<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';else if($.browser.msie)
{coordsize=self.options.style.tip.size.width+','+self.options.style.tip.size.height;path='m'+coordinates[0][0]+','+coordinates[0][1];path+=' l'+coordinates[1][0]+','+coordinates[1][1];path+=' '+coordinates[2][0]+','+coordinates[2][1];path+=' xe';self.elements.tip+='<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" '+'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; '+'line-height:0.1px; display:inline-block; behavior:url(#default#VML); '+'vertical-align:'+((corner.search(/top/)!==-1)?'bottom':'top')+'"></v:shape>';self.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';self.elements.contentWrapper.css('position','relative');};self.elements.tooltip.prepend(self.elements.tip+'</div>');self.elements.tip=self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);if($('<canvas>').get(0).getContext)
drawTip.call(self,self.elements.tip.find('canvas:first'),coordinates,color);if(corner.search(/top/)!==-1&&$.browser.msie&&parseInt($.browser.version.charAt(0))===6)
self.elements.tip.css({marginTop:-4});positionTip.call(self,corner);};function drawTip(canvas,coordinates,color)
{var context=canvas.get(0).getContext('2d');context.fillStyle=color;context.beginPath();context.moveTo(coordinates[0][0],coordinates[0][1]);context.lineTo(coordinates[1][0],coordinates[1][1]);context.lineTo(coordinates[2][0],coordinates[2][1]);context.fill();};function positionTip(corner)
{var self,ieAdjust,paddingCorner,paddingSize,newMargin;self=this;if(self.options.style.tip.corner===false||!self.elements.tip)return;if(!corner)corner=self.elements.tip.attr('rel');ieAdjust=positionAdjust=($.browser.msie)?1:0;self.elements.tip.css(corner.match(/left|right|top|bottom/)[0],0);if(corner.search(/top|bottom/)!==-1)
{if($.browser.msie)
{if(parseInt($.browser.version.charAt(0))===6)
positionAdjust=(corner.search(/top/)!==-1)?-3:1;else
positionAdjust=(corner.search(/top/)!==-1)?1:2;};if(corner.search(/Middle/)!==-1)
self.elements.tip.css({left:'50%',marginLeft:-(self.options.style.tip.size.width/2)});else if(corner.search(/Left/)!==-1)
self.elements.tip.css({left:self.options.style.border.radius-ieAdjust});else if(corner.search(/Right/)!==-1)
self.elements.tip.css({right:self.options.style.border.radius+ieAdjust});if(corner.search(/top/)!==-1)
self.elements.tip.css({top:-positionAdjust});else
self.elements.tip.css({bottom:positionAdjust});}
else if(corner.search(/left|right/)!==-1)
{if($.browser.msie)
positionAdjust=(parseInt($.browser.version.charAt(0))===6)?1:((corner.search(/left/)!==-1)?1:2);if(corner.search(/Middle/)!==-1)
self.elements.tip.css({top:'50%',marginTop:-(self.options.style.tip.size.height/2)});else if(corner.search(/Top/)!==-1)
self.elements.tip.css({top:self.options.style.border.radius-ieAdjust});else if(corner.search(/Bottom/)!==-1)
self.elements.tip.css({bottom:self.options.style.border.radius+ieAdjust});if(corner.search(/left/)!==-1)
self.elements.tip.css({left:-positionAdjust});else
self.elements.tip.css({right:positionAdjust});};paddingCorner='padding-'+corner.match(/left|right|top|bottom/)[0];paddingSize=self.options.style.tip.size[(paddingCorner.search(/left|right/)!==-1)?'width':'height'];self.elements.tooltip.css('padding',0);self.elements.tooltip.css(paddingCorner,paddingSize);if($.browser.msie&&parseInt($.browser.version.charAt(0))==6)
{newMargin=parseInt(self.elements.tip.css('margin-top'))||0;newMargin+=parseInt(self.elements.content.css('margin-top'))||0;self.elements.tip.css({marginTop:newMargin});};};function createTitle()
{var self=this;if(self.elements.title!==null)self.elements.title.remove();self.elements.title=$('<div class="'+self.options.style.classes.title+'">').css(jQueryStyle(self.options.style.title,true)).css({zoom:($.browser.msie)?1:0}).prependTo(self.elements.contentWrapper);if(self.options.content.title.text)self.updateTitle.call(self,self.options.content.title.text);if(self.options.content.title.button!==false&&typeof self.options.content.title.button=='string')
{self.elements.button=$('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>').css(jQueryStyle(self.options.style.button,true)).html(self.options.content.title.button).prependTo(self.elements.title).click(function(event){if(!self.status.disabled)self.hide(event)});};};function assignEvents()
{var self,showTarget,hideTarget,inactiveEvents;self=this;showTarget=self.options.show.when.target;hideTarget=self.options.hide.when.target;if(self.options.hide.fixed)hideTarget=hideTarget.add(self.elements.tooltip);if(self.options.hide.when.event=='inactive')
{inactiveEvents=['click','dblclick','mousedown','mouseup','mousemove','mouseout','mouseenter','mouseleave','mouseover'];function inactiveMethod(event)
{if(self.status.disabled===true)return;clearTimeout(self.timers.inactive);self.timers.inactive=setTimeout(function()
{$(inactiveEvents).each(function()
{hideTarget.unbind(this+'.qtip-inactive');self.elements.content.unbind(this+'.qtip-inactive');});self.hide(event);},self.options.hide.delay);};}
else if(self.options.hide.fixed===true)
{self.elements.tooltip.bind('mouseover.qtip',function()
{if(self.status.disabled===true)return;clearTimeout(self.timers.hide);});};function showMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.when.event=='inactive')
{$(inactiveEvents).each(function()
{hideTarget.bind(this+'.qtip-inactive',inactiveMethod);self.elements.content.bind(this+'.qtip-inactive',inactiveMethod);});inactiveMethod();};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.timers.show=setTimeout(function(){self.show(event);},self.options.show.delay);};function hideMethod(event)
{if(self.status.disabled===true)return;if(self.options.hide.fixed===true&&self.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&$(event.relatedTarget).parents('div.qtip[qtip]').length>0)
{event.stopPropagation();event.preventDefault();clearTimeout(self.timers.hide);return false;};clearTimeout(self.timers.show);clearTimeout(self.timers.hide);self.elements.tooltip.stop(true,true);self.timers.hide=setTimeout(function(){self.hide(event);},self.options.hide.delay);};if((self.options.show.when.target.add(self.options.hide.when.target).length===1&&self.options.show.when.event==self.options.hide.when.event&&self.options.hide.when.event!=='inactive')||self.options.hide.when.event=='unfocus')
{self.cache.toggle=0;showTarget.bind(self.options.show.when.event+'.qtip',function(event)
{if(self.cache.toggle==0)showMethod(event);else hideMethod(event);});}
else
{showTarget.bind(self.options.show.when.event+'.qtip',showMethod);if(self.options.hide.when.event!=='inactive')
hideTarget.bind(self.options.hide.when.event+'.qtip',hideMethod);};if(self.options.position.type.search(/(fixed|absolute)/)!==-1)
self.elements.tooltip.bind('mouseover.qtip',self.focus);if(self.options.position.target==='mouse'&&self.options.position.type!=='static')
{showTarget.bind('mousemove.qtip',function(event)
{self.cache.mouse={x:event.pageX,y:event.pageY};if(self.status.disabled===false&&self.options.position.adjust.mouse===true&&self.options.position.type!=='static'&&self.elements.tooltip.css('display')!=='none')
self.updatePosition(event);});};};function screenAdjust(position,target,tooltip)
{var self,adjustedPosition,adjust,newCorner,overflow,corner;self=this;if(tooltip.corner=='center')return target.position
adjustedPosition=$.extend({},position);newCorner={x:false,y:false};overflow={left:(adjustedPosition.left<$.fn.qtip.cache.screen.scroll.left),right:(adjustedPosition.left+tooltip.dimensions.width+2>=$.fn.qtip.cache.screen.width+$.fn.qtip.cache.screen.scroll.left),top:(adjustedPosition.top<$.fn.qtip.cache.screen.scroll.top),bottom:(adjustedPosition.top+tooltip.dimensions.height+2>=$.fn.qtip.cache.screen.height+$.fn.qtip.cache.screen.scroll.top)};adjust={left:(overflow.left&&(tooltip.corner.search(/right/i)!=-1||(tooltip.corner.search(/right/i)==-1&&!overflow.right))),right:(overflow.right&&(tooltip.corner.search(/left/i)!=-1||(tooltip.corner.search(/left/i)==-1&&!overflow.left))),top:(overflow.top&&tooltip.corner.search(/top/i)==-1),bottom:(overflow.bottom&&tooltip.corner.search(/bottom/i)==-1)};if(adjust.left)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left+target.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x
newCorner.x='Left';}
else if(adjust.right)
{if(self.options.position.target!=='mouse')
adjustedPosition.left=target.position.left-tooltip.dimensions.width;else
adjustedPosition.left=self.cache.mouse.x-tooltip.dimensions.width;newCorner.x='Right';};if(adjust.top)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top+target.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y
newCorner.y='top';}
else if(adjust.bottom)
{if(self.options.position.target!=='mouse')
adjustedPosition.top=target.position.top-tooltip.dimensions.height;else
adjustedPosition.top=self.cache.mouse.y-tooltip.dimensions.height;newCorner.y='bottom';};if(adjustedPosition.left<0)
{adjustedPosition.left=position.left;newCorner.x=false;};if(adjustedPosition.top<0)
{adjustedPosition.top=position.top;newCorner.y=false;};if(self.options.style.tip.corner!==false)
{adjustedPosition.corner=new String(tooltip.corner);if(newCorner.x!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/Left|Right|Middle/,newCorner.x);if(newCorner.y!==false)adjustedPosition.corner=adjustedPosition.corner.replace(/top|bottom/,newCorner.y);if(adjustedPosition.corner!==self.elements.tip.attr('rel'))
createTip.call(self,adjustedPosition.corner);};return adjustedPosition;};function jQueryStyle(style,sub)
{var styleObj,i;styleObj=$.extend(true,{},style);for(i in styleObj)
{if(sub===true&&i.search(/(tip|classes)/i)!==-1)
delete styleObj[i];else if(!sub&&i.search(/(width|border|tip|title|classes|user)/i)!==-1)
delete styleObj[i];};return styleObj;};function sanitizeStyle(style)
{if(typeof style.tip!=='object')style.tip={corner:style.tip};if(typeof style.tip.size!=='object')style.tip.size={width:style.tip.size,height:style.tip.size};if(typeof style.border!=='object')style.border={width:style.border};if(typeof style.width!=='object')style.width={value:style.width};if(typeof style.width.max=='string')style.width.max=parseInt(style.width.max.replace(/([0-9]+)/i,"$1"));if(typeof style.width.min=='string')style.width.min=parseInt(style.width.min.replace(/([0-9]+)/i,"$1"));if(typeof style.tip.size.x=='number')
{style.tip.size.width=style.tip.size.x;delete style.tip.size.x;};if(typeof style.tip.size.y=='number')
{style.tip.size.height=style.tip.size.y;delete style.tip.size.y;};return style;};function buildStyle()
{var self,i,styleArray,styleExtend,finalStyle,ieAdjust;self=this;styleArray=[true,{}];for(i=0;i<arguments.length;i++)
styleArray.push(arguments[i]);styleExtend=[$.extend.apply($,styleArray)];while(typeof styleExtend[0].name=='string')
{styleExtend.unshift(sanitizeStyle($.fn.qtip.styles[styleExtend[0].name]));};styleExtend.unshift(true,{classes:{tooltip:'qtip-'+(arguments[0].name||'defaults')}},$.fn.qtip.styles.defaults);finalStyle=$.extend.apply($,styleExtend);ieAdjust=($.browser.msie)?1:0;finalStyle.tip.size.width+=ieAdjust;finalStyle.tip.size.height+=ieAdjust;if(finalStyle.tip.size.width%2>0)finalStyle.tip.size.width+=1;if(finalStyle.tip.size.height%2>0)finalStyle.tip.size.height+=1;if(finalStyle.tip.corner===true)
finalStyle.tip.corner=(self.options.position.corner.tooltip==='center')?false:self.options.position.corner.tooltip;return finalStyle;};function calculateTip(corner,width,height)
{var tips={bottomRight:[[0,0],[width,height],[width,0]],bottomLeft:[[0,0],[width,0],[0,height]],topRight:[[0,height],[width,0],[width,height]],topLeft:[[0,0],[0,height],[width,height]],topMiddle:[[0,height],[width/2,0],[width,height]],bottomMiddle:[[0,0],[width,0],[width/2,height]],rightMiddle:[[0,0],[width,height/2],[0,height]],leftMiddle:[[width,0],[width,height],[0,height/2]]};tips.leftTop=tips.bottomRight;tips.rightTop=tips.bottomLeft;tips.leftBottom=tips.topRight;tips.rightBottom=tips.topLeft;return tips[corner];};function calculateBorders(radius)
{var borders;if($('<canvas>').get(0).getContext)
{borders={topLeft:[radius,radius],topRight:[0,radius],bottomLeft:[radius,0],bottomRight:[0,0]};}
else if($.browser.msie)
{borders={topLeft:[-90,90,0],topRight:[-90,90,-radius],bottomLeft:[90,270,0],bottomRight:[90,270,-radius]};};return borders;};function bgiframe()
{var self,html,dimensions;self=this;dimensions=self.getDimensions();html='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; '+'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';self.elements.bgiframe=self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');};$(document).ready(function()
{$.fn.qtip.cache={screen:{scroll:{left:$(window).scrollLeft(),top:$(window).scrollTop()},width:$(window).width(),height:$(window).height()}};var adjustTimer;$(window).bind('resize scroll',function(event)
{clearTimeout(adjustTimer);adjustTimer=setTimeout(function()
{if(event.type==='scroll')
$.fn.qtip.cache.screen.scroll={left:$(window).scrollLeft(),top:$(window).scrollTop()};else
{$.fn.qtip.cache.screen.width=$(window).width();$.fn.qtip.cache.screen.height=$(window).height();};for(i=0;i<$.fn.qtip.interfaces.length;i++)
{var api=$.fn.qtip.interfaces[i];if(api.status.rendered===true&&(api.options.position.type!=='static'||api.options.position.adjust.scroll&&event.type==='scroll'||api.options.position.adjust.resize&&event.type==='resize'))
{api.updatePosition(event,true);}};},100);})
$(document).bind('mousedown.qtip',function(event)
{if($(event.target).parents('div.qtip').length===0)
{$('.qtip[unfocus]').each(function()
{var api=$(this).qtip("api");if($(this).is(':visible')&&!api.status.disabled&&$(event.target).add(api.elements.target).length>1)
api.hide(event);})};})});$.fn.qtip.interfaces=[]
$.fn.qtip.log={error:function(){return this;}};$.fn.qtip.constants={};$.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:'bottomRight',tooltip:'topLeft'},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:'absolute',container:false},show:{when:{target:false,event:'mouseover'},effect:{type:'fade',length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:'mouseout'},effect:{type:'fade',length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};$.fn.qtip.styles={defaults:{background:'white',color:'#111',overflow:'hidden',textAlign:'left',width:{min:0,max:250},padding:'5px 9px',border:{width:1,radius:0,color:'#d3d3d3'},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:'#e1e1e1',fontWeight:'bold',padding:'7px 12px'},button:{cursor:'pointer'},classes:{target:'',tip:'qtip-tip',title:'qtip-title',button:'qtip-button',content:'qtip-content',active:'qtip-active'}},cream:{border:{width:3,radius:0,color:'#F9E98E'},title:{background:'#F0DE7D',color:'#A27D35'},background:'#FBF7AA',color:'#A27D35',classes:{tooltip:'qtip-cream'}},light:{border:{width:3,radius:0,color:'#E2E2E2'},title:{background:'#f1f1f1',color:'#454545'},background:'white',color:'#454545',classes:{tooltip:'qtip-light'}},dark:{border:{width:3,radius:0,color:'#303030'},title:{background:'#404040',color:'#f3f3f3'},background:'#505050',color:'#f3f3f3',classes:{tooltip:'qtip-dark'}},red:{border:{width:3,radius:0,color:'#CE6F6F'},title:{background:'#f28279',color:'#9C2F2F'},background:'#F79992',color:'#9C2F2F',classes:{tooltip:'qtip-red'}},green:{border:{width:3,radius:0,color:'#A9DB66'},title:{background:'#b9db8c',color:'#58792E'},background:'#CDE6AC',color:'#58792E',classes:{tooltip:'qtip-green'}},blue:{border:{width:3,radius:0,color:'#ADD9ED'},title:{background:'#D0E9F5',color:'#5E99BD'},background:'#E5F6FE',color:'#4D9FBF',classes:{tooltip:'qtip-blue'}}};})(jQuery);DDI.Dialog={openDialog:function(url,postParams,callback){$j("#modalDialog").load(url,postParams,function(data,textStatus){if(!$j(this).modalDialog("opened")){$j(this).modalDialog("open");}
if(callback!==undefined){callback(data,textStatus);}});},closeDialog:function(){$j("#modalDialog").modalDialog("close");},isDialogClosed:function(){return $j("#modalDialog").modalDialog("closed");}};DDI.SignIn={initForm:function(){},ajaxifyLinks:function(){$j("#forgotPwdLink").dialogAjaxify();$j("#signinSignupLink").dialogAjaxify();}};DDI.ForgotPwd={initForm:function(){$j("#forgotPwdForm .sec").click(function(){DDI.Dialog.closeDialog();return false;});}};(function($){$.fn.ezpz_hint=function(options){var defaults={hintClass:'ezpz-hint',hintName:'ezpz_hint_dummy_input'};var settings=$.extend(defaults,options);return this.each(function(i){var id=settings.hintName+'_'+i;var hint;var dummy_input;text=$(this).attr('title');$('<input type="text" id="'+id+'" value="" />').insertBefore($(this));hint=$(this).prev('input:first');hint.attr('class',$(this).attr('class'));hint.attr('size',$(this).attr('size'));hint.attr('autocomplete','off');hint.attr('tabIndex',$(this).attr('tabIndex'));hint.addClass(settings.hintClass);hint.val(text);$(this).hide();$(this).attr('autocomplete','off');hint.focus(function(){dummy_input=$(this);$(this).next('input:first').show();$(this).next('input:first').focus();$(this).next('input:first').unbind('blur').blur(function(){if($.trim($(this).val()).length==0){$(this).hide();dummy_input.show();}});$(this).hide();});if($.trim($(this).val()).length!=0){hint.focus();};});};})(jQuery);(function($){$(function(){$j(".searchField").ezpz_hint({hintClass:'qHint'});$j(".searchField").focus();});})(jQuery);(function($){$(function(){$.blockUI.defaults.message='<img src="'+DDI.contextPath+'/img/loading.gif"/>';$.blockUI.defaults.css.border='none';$.blockUI.defaults.css.backgroundColor='';$.blockUI.defaults.overlayCSS.opacity='0.1';$.ajaxSetup({cache:false});$("#openLogin").dialogAjaxify();$("#createLogin").dialogAjaxify();$("#geoSelect").click(function(){$("#areaTab").slideToggle("slow");return false;});$("#areaTab").click(function(){$("#areaTab").slideUp("slow");});var initGeochoice=function(){DDI.GeoChoice.initChooseForm();DDI.GeoChoice.initSignUpLink();DDI.GeoChoice.initMap();};$("#openGeochoice").click(function(){$("#areaTab").slideUp("slow");return false;}).dialogAjaxify({onSuccess:initGeochoice});$("#footerGeochoice").click(function(){return false;}).dialogAjaxify({onSuccess:initGeochoice});$(".areaList").dropdown({opener:"#geoSelect"});$j("div.links .startpage a").mouseleave(function(){$j("#startpageInfo").fadeOut("fast");});$j('div.links .startpage a').click(function(){if(jQuery.browser.msie){document.body.style.behavior='url(#default#homepage)';document.body.setHomePage(window.location.href);}else{var top=$j(this).offset().top+$j(this).height()+2;var left=$j(this).offset().left;$j("#startpageInfo").css({top:top,left:left}).fadeIn("fast");}
return false;});});})(jQuery);(function($){$.fn.catchEnterAndSendTo=function(target,passEvent){this.bind('keypress.catchEnter',null,function(event){if(event.keyCode==13){target.trigger('click',event.data);return passEvent||false;}});return this;}})(jQuery);DDI.AreaSelector={init:function(path){$j('#areaSelector input[name=municipalityName]','').catchEnterAndSendTo($j('#addMunicipality'));$j("#modalDialog").modalDialog("closeHandler",function onDialogClose(){$j('#modalDialog input[name=municipalityName]').ddiAutocompleteDetach();});$j('#areaSelector input[name=municipalityName]').ddiAutocomplete();$j("#areaSelector #addMunicipality").ajaxify({link:DDI.contextPath+path,method:'GET',forms:'#areaSelector input',target:'#areaSelector',onStart:function(){$j('#areaSelector input[name=municipalityName]').ddiAutocompleteDetach();$j('#areaSelector').block();},onSuccess:function(){$j('#areaSelector input')[0].focus();setTimeout(function(){$j('#areaSelector input')[0].focus();},0);}});$j('#areaSelector .chooseArea input[type=radio]').click(function(){$j(".chooseArea .homePortal").insertBefore(this);});$j('#areaSelector .chooseArea .remove').click(function(){var el=$j(this);var radioEl=el.siblings(":radio");var checked=radioEl.attr("checked");var homeTextEl=$j(".chooseArea .homePortal");el.parents('#areaSelector .chooseArea li').remove();if(checked){var firstRadio=$j('#areaSelector .chooseArea :radio:first');homeTextEl.insertBefore(firstRadio);firstRadio.attr("checked",true);}
return false;});}};(function($){DDI.Maps.RoutePlannerCurveProcessor=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["position_changed","curve_redraw"],gjson:new OpenLayers.Format.GeoJSON(),projection:new OpenLayers.Projection("EPSG:4326"),initialize:function(urlPrefix,map,draggable,routeCallback,resolveIcon){OpenLayers.Control.prototype.initialize.apply(this);this.urlPrefix=urlPrefix;this.map=map;this.draggable=draggable||false;this.routeCallback=routeCallback;this.resolveIcon=resolveIcon||function(idx,total){var src=DDI.contextPath+'/mapsv2/media/markers/route/';switch(idx){case 0:src+='map-start';break;case total-1:src+='map-stop';break;default:src+='map-via'+idx;}
src+='-'+DDI.country.toLowerCase()+'.png';return src;};this._xhr=null;},_cancelRequest:function(){if(this._xhr){this._xhr.abort();this._xhr=null;}},update:function(routePoints,alternativesOptions){this._cancelRequest();if(this.map==null)return;if(this.map.getExtent()==null)return;if(!routePoints)return;var
that=this,waypoints=this.buildWaypointsArgument(routePoints),extent=this.map.getExtent().transform(this.map.projection,this.projection);var args={instr:false,contentType:'json',BBOX:[extent.left,extent.top,extent.right,extent.bottom].join(','),waypoints:waypoints,lang:'no',res:this._getGeneralizationForZoom(this.map.getZoom())};if(alternativesOptions){jQuery.extend(args,alternativesOptions);}
this._xhr=jQuery.ajax({url:this.urlPrefix+'/routeProxy',method:"GET",data:args,dataType:'json',success:function(data,status){that._xhr=null;that._processResponse(data);}});},_processResponse:function(data){this.events.triggerEvent("position_changed");this.map.removeFeatureGroup("routeVector");var vectors=this.gjson.read(data['route-geometries'],'FeatureCollection');if(vectors){for(var i=0;i<vectors.length;i++){var vector=vectors[i];var feature=vector.clone();feature.geometry.transform(this.projection,this.map.projection);this.map.addFeature(feature,"routeVector");}
this.setStartViaStopMarkers(this._getRoutePoints(vectors));}},setStartViaStopMarkers:function(routePoints){var that=this;if(!this.startViaStopMarkers||(this.startViaStopMarkers.length!=routePoints.length)){this.clearStartViaStopMarkers();this._createStartViaStopMarkers(routePoints);}else{this._moveStartViaStopMarkers(routePoints);}},_createStartViaStopMarkers:function(routePoints){var that=this;this.startViaStopMarkers=jQuery.map(routePoints,function(point,idx){if(point.lon&&point.lat){var lonlat=new OpenLayers.LonLat(point.lon,point.lat);var position=lonlat.transform(that.projection,that.map.projection);var feature=new Eniro.Feature.PopupFeature(position,{index:idx,locked:false,point:point},{style:{externalGraphic:that.resolveIcon(idx,routePoints.length),graphic:true,graphicZIndex:9001,graphicWidth:54,graphicHeight:28,graphicYOffset:-28,graphicXOffset:-25,pointRadius:0},draggable:that.draggable});that.map.addFeature(feature,"routePlannerStartViaStopMarkers");feature.events.on({dragstart:that._lockFeature,dragmove:that._updateRoutePointPosition,dragend:that._releaseFeature,scope:that});return feature;}});},_moveStartViaStopMarkers:function(routePoints){var that=this;jQuery.each(this.startViaStopMarkers,function(idx,feature){feature.attributes.point={lon:routePoints[idx].lon,lat:routePoints[idx].lat};feature.style.externalGraphic=that.resolveIcon(idx,routePoints.length);if(feature.attributes.locked){return;}
feature.move(routePoints[idx].clone().transform(that.projection,that.map.projection));});},clearStartViaStopMarkers:function(){var that=this;if(this.startViaStopMarkers){jQuery.each(this.startViaStopMarkers,function(){that.map.removeFeature(this);this.destroy();});}
this.startViaStopMarkers=null;},clearCurve:function(){this._cancelRequest();this.map.removeFeatureGroup("routeVector");this.clearStartViaStopMarkers();},_getRoutePoints:function(vectors){var points=[];for(var i=0;i<vectors.length;i++){var
geometry=vectors[i].geometry,lineString;if(i==0){lineString=geometry.components[0];points.push(new OpenLayers.LonLat(lineString.components[0].x,lineString.components[0].y));}
lineString=geometry.components[geometry.components.length-1];var point=lineString.components[lineString.components.length-1];points.push(new OpenLayers.LonLat(point.x,point.y));}
return points;},_lockFeature:function(event){event.feature.attributes.locked=true;},_updateRoutePointPosition:function(event){var
feature=event.feature,position=this.map.getLonLatFromPixel(event.pixel).transform(this.map.projection,this.projection);if(this.routeCallback){var point={id:"s_"+position.lon+","+position.lat,description:i18n.maps.waypoint.user_defined(),position:{lon:position.lon,lat:position.lat}};if(this._xhr&&this._xhr.readyState!=4){if(this._routeCallbackTimer){clearTimeout(this._routeCallbackTimer);var _this=this;var callback=function(){if(_this._xhr){_this._routeCallbackTimer=setTimeout(callback,100);}else{_this.routeCallback(point,feature.attributes.index);}};callback();}}else{this.routeCallback(point,feature.attributes.index);}}},_releaseFeature:function(event){event.feature.attributes.locked=false;var point=event.feature.attributes.point;event.feature.move(new OpenLayers.LonLat(point.lon,point.lat).transform(this.projection,this.map.projection));this.events.triggerEvent("curve_redraw");},_getGeneralizationForZoom:function(zoomLevel){if(zoomLevel<=3)return 1600;if(zoomLevel==4)return 940;if(zoomLevel==5)return 220;if(zoomLevel==6)return 140;if(zoomLevel==7)return 80;if(zoomLevel==8)return 40;if(zoomLevel==9)return 20;if(zoomLevel==10)return 6;if(zoomLevel==11)return 3;if(zoomLevel==12)return 2;return 1;},buildWaypointsArgument:function(waypoints){var coordsList=jQuery.map(waypoints,function(el){if(el.lon!==undefined&&el.lat!==undefined){return[el.lon,el.lat].join(",");}});if(coordsList.length<2)return null;return coordsList.join(";");}});})(jQuery);DDI.Maps.RoutePlanner=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["activate","deactivate","changepoints"],routewareProjection:new OpenLayers.Projection("EPSG:4326"),MAX_ZOOM:19,urlPrefix:null,widget:null,suggestPopup:null,alertPopup:null,alternativesPopup:null,isProcessing:false,updateCallback:function(){},routePointMarker:null,curveProcessor:null,initialize:function(urlPrefix,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.urlPrefix=urlPrefix;if(options.updateCallback)this.updateCallback=options.updateCallback;this._initWidget();},setMap:function(map){var _this=this;OpenLayers.Control.prototype.setMap.apply(this,[map]);this.curveProcessor=new DDI.Maps.RoutePlannerCurveProcessor(this.urlPrefix,map,true,function(routePoint,index){var element=$j('.routePoints .routePoint input[name!=]',this.div).get(index);$j('.routePoints',this.div).routePoints("setTo",element,routePoint.id,routePoint.description,routePoint.position);this.events.triggerEvent("changepoints");});this.curveProcessor.events.on({curve_redraw:function(){_this.describeRoute(false);}})},destroy:function(){this.deactivate();this.destroyPopups();OpenLayers.Control.prototype.destroy.apply(this,arguments);},activate:function(){if(this.active)return;OpenLayers.Control.prototype.activate.apply(this,arguments);this.map.events.on({"moveend":this.redrawRoute,scope:this});},deactivate:function(){OpenLayers.Control.prototype.deactivate.apply(this,arguments);this.map.events.un({"moveend":this.redrawRoute,scope:this});},redrawRoute:function(){this.updateRouteCurve();},onHide:function(){this.destroyPopups();this.alternativesPopup.hide();this.isProcessing=false;},draw:function(px){var that=this;OpenLayers.Control.prototype.draw.apply(this,arguments);$j('#addRoutePoint',this.div).click(function(){$j('.routePoints',that.div).routePoints("via");return false;});$j("#reverseRoute",this.div).click(function(){$j(".routePoints",that.div).routePoints("reverse");return false;});$j('input:submit.btnDirections',this.div).focus().click(function(){that.isProcessing=true;that.invokeSuggestPopup();return false;});this.alternativesPopup=this._createAlternativesPopup('a#showMoreAlternativesLink');$j('a#showMoreAlternativesLink').click(function(){return false;});$j(".clearLink",this.div).click(function(){$j(".routePoints",that.div).routePoints("clear");return false;});},_initWidget:function(){var that=this;$j('.routePoints',this.div).routePoints({add:function(){that.updateCallback();if(that.alternativesPopup&&that.alternativesPopup.isVisible()){that.alternativesPopup.updatePosition();}
window.mapView.updateLayout();},routechange:function(){if(that.isProcessing){that.invokeSuggestPopup();}else{that.updateRouteCurve();}},beforeremove:function(){that.destroyPopups();},beforeswap:function(){that.destroyPopups();},beforereverse:function(){that.destroyPopups();},remove:function(){that.updateCallback();if(that.alternativesPopup&&that.alternativesPopup.isVisible()){that.alternativesPopup.updatePosition();}
window.mapView.updateLayout();}});},displayPanel:function(){$j("#getDirectionsActivateLink a:visible").click();},_addWaypoint:function(type,id,text,position){this.displayPanel();var lonlat=position&&(position.transform?position.transform(this.routewareProjection):position);this.div.show();text=$j.trim(text);$j('.routePoints',this.div).routePoints(type,id,text,lonlat&&{lon:lonlat.lon,lat:lonlat.lat});},prependWaypoint:function(id,text,position){this._addWaypoint("setStart",id,text,position);},appendWaypoint:function(id,text,position){this._addWaypoint("setEnd",id,text,position);},appendViaWaypoint:function(id,text,position){this._addWaypoint("via",id,text,position);},fillWaypoints:function(waypoints){$j('.routePoints',this.div).routePoints("clear");var instance=this;jQuery.each(waypoints,function(index,waypoint){if(index==0){instance.prependWaypoint(waypoint.rp_id,waypoint.description,waypoint.coord);}else if(index==waypoints.length-1){instance.appendWaypoint(waypoint.rp_id,waypoint.description,waypoint.coord);}else{instance.appendViaWaypoint(waypoint.rp_id,waypoint.description,waypoint.coord);}});},getWaypointsState:function(){var rp_ids=[],descrs=[],lon=[],lat=[],isEmpty=true;jQuery.each($j(".routePoints").routePoints("collectData"),function(idx,el){if(!el.id)return;if((el.description&&el.description!=='')||(el.lat&&el.lat!=='')||(el.lon&&el.lon!=='')){isEmpty=false;}
rp_ids.push(el.id||"");descrs.push(el.description||"");lon.push(el.lon||"");lat.push(el.lat||"");});return isEmpty?null:{rp_id:rp_ids,description:descrs,rp_lon:lon,rp_lat:lat};},setCurrentWaypoint:function(id,description,position){if(description&&position){$j('.routePoints',this.div).routePoints("setTo",this.suggestPopup.getTarget(),id,description,{lon:position.lon,lat:position.lat});}else{this.suggestPopup.loadContent(this.urlPrefix+'/routeLookup',{id:id});}},getNextUnresolvedWaypoint:function(){var list=$j('input:text',this.div);for(var i=0;i<list.length;i++){var name=list.eq(i).attr('name');var level='via';switch(i){case 0:{level='start';break;}
case list.length-1:{level='stop';break;}}
if(name==null||name==''){return{element:list.eq(i),level:level,value:list.eq(i).val()};}}
return null;},processWaypoint:function(offset,service){if(!service||service=='all'){url='/waypointSearch';}else{url='/'+service+'WaypointSearch';}
var data={q:$j(this.suggestPopup.getTarget()).val()};if(offset)data.offset=offset;this.suggestPopup.loadContent(this.urlPrefix+url,data);},destroyPopups:function(){this.destroySuggestPopup();this.destroyAlertPopup();},destroySuggestPopup:function(){this._destroyPopup(this.suggestPopup);this.suggestPopup=null;},destroyAlertPopup:function(){this._destroyPopup(this.alertPopup);this.alertPopup=null;},_destroyPopup:function(popup){if(popup){popup.destroy();}},_createAlternativesPopup:function(target){var that=this;return $j(target).routePlannerAlternatives({content:$j('div.directionsAlt:hidden').remove().children(),api:{onRender:function(){$j('div.directionsAlt td.line a').click(function(){that.alternativesPopup.hide();return false;});$j('div.directionsAlt td.line input:submit').click(function(){that.alternativesPopup.storeSettings();that.alternativesPopup.hide();that.isProcessing=true;that.invokeSuggestPopup();return false;});}}});},_createAlertPopup:function(target){var that=this;return $j(target).routePlannerAlert({api:{beforeShow:function(){that.isProcessing=false;},onHide:function(){that.destroyAlertPopup();}}});},_createSuggestPopup:function(waypoint){var that=this;var options={content:{title:{text:'<h2>'+i18n.maps.get_directions.popup.title[waypoint.level]()+'</h2>'}},api:{beforeContentUpdate:function(content){if(jQuery.isJSON(content)){var json=jQuery.evalJSON(content);if(json.length){json=json[0];}
var point=new OpenLayers.LonLat(json.lon,json.lat);that.setCurrentWaypoint(json.id,json.description,point);return false;}else{return content;}},onHide:function(){that.destroySuggestPopup();that.isProcessing=false;}}};return $j(waypoint.element).routePlannerSuggest(options).loadContent(that.urlPrefix+'/waypointSearch',{q:waypoint.value});},invokeSuggestPopup:function(){this.destroyPopups();var waypoint=this.getNextUnresolvedWaypoint();if(waypoint!=null){$j(waypoint.element).select();if(!waypoint.value.trim().length){this.alertPopup=this._createAlertPopup(waypoint.element);}else{this.suggestPopup=this._createSuggestPopup(waypoint);}}else{this.isProcessing=false;this.activate();this.describeRoute();}},buildRoute:function(){return jQuery.map($j(".routePoints",this.div).routePoints("collectData"),function(point){return point&&point.lon!=undefined&&point.lat!=undefined?point:null;});},describeRoute:function(centerOnComplete){if(typeof(centerOnComplete)=="undefined"){centerOnComplete=true;}
var args={waypoints:this.curveProcessor.buildWaypointsArgument(this.buildRoute())};if(this.alternativesPopup){jQuery.extend(args,this.alternativesPopup.buildArguments());}
this.updateCallback();var that=this;jQuery.ajax({url:DDI.contextPath+'/map/routeInfo',method:"GET",data:args,beforeSend:function(){$j(".resultWrapper","#sideBar").hide();$j(".routeResultListWrapper","#sideBar").html('<p style="text-align: center"><img src="'+DDI.contextPath+'/img/loading.gif" alt="'+i18n.common.loading()+'"/></p>').show();},success:function(data){that.processDescribeRouteResponse(data,centerOnComplete);},error:function(){$j(".routeResultListWrapper","#sideBar").html(i18n.maps.error.common.ajax());}});},processDescribeRouteResponse:function(data,centerOnComplete){var that=this;$j(".routeResultListWrapper","#sideBar").html(data);if($j(".resultListWrapper","#sideBar").is(':empty')){$j(".backLink","#sideBar").hide();}else{$j(".backLink","#sideBar").click(function(){$j(".resultWrapper","#sideBar").hide();$j(".resultListWrapper","#sideBar").show();return false;});}
var routePointsData=$j(".routePoints .routePoint input",this.div);$j(".routeResultListWrapper .replace","#sideBar").each(function(idx){var description=$j(routePointsData[idx]).val();$j(this).text(description);});if(centerOnComplete){var extentJs=$j(".routeResultListWrapper .routeExtent","#sideBar").text();var extent=eval(extentJs);if(extent!==undefined){this.map.routeExtent=extent;extent=extent.clone().transform(this.routewareProjection,this.map.baseLayer.projection);var resolution=this.map.getResolutionForZoom(this.map.getZoomForExtent(extent));var zoom=Math.min(this.map.getZoomForResolution(resolution),that.MAX_ZOOM);this.map.setCenter(extent.getCenterLonLat(),zoom);}}},setRoutePointMarker:function(lon,lat){this.clearRoutePointMarker(true);var lonlat=new OpenLayers.LonLat(lon,lat);var position=lonlat.transform(this.routewareProjection,this.map.projection);this.routePointMarker=new Eniro.Feature.PopupFeature(position,null,{style:{externalGraphic:DDI.contextPath+"/img/maps/map_icon_kjorerute.gif",graphic:true,graphicZIndex:9010,graphicWidth:21,graphicHeight:24,graphicYOffset:-26,graphicXOffset:-10,pointRadius:0}});this.map.addFeature(this.routePointMarker);},clearRoutePointMarker:function(){if(this.routePointMarker){this.map.removeFeature(this.routePointMarker);this.routePointMarker.destroy();this.routePointMarker=null;}},centerOnPoint:function(lon,lat){var lonlat=new OpenLayers.LonLat(lon,lat);var position=lonlat.transform(this.routewareProjection,this.map.projection);this.map.setCenter(position,15);},updateRouteCurve:function(){if(this.curveProcessor==null)return;var routePoints=this.buildRoute();if(routePoints.length>1){this.curveProcessor.update(routePoints,this.alternativesPopup.buildArguments());this.activate();}else{this.curveProcessor.clearCurve();this.deactivate();}}});(function($){$.fn.extend({routePlannerAlert:function(options){var that=this;var settings=$.extend(true,{content:{text:i18n.maps.waypoint_alert.text()},api:{onShow:function(){that.codeId=setTimeout(function(){$(that).qtip('hide');},2000);}}},$.fn.routePlannerAlert.defaults,options);$(this).qtip(settings);return{destroy:function(){if(that.codeId){clearTimeout(that.codeId);}
$(that).qtip('destroy');$.fn.qtip.interfaces.pop(undefined);}};}});$.fn.routePlannerAlert.defaults={show:{ready:true,delay:0,when:{event:'uninvokedevent'}},position:{corner:{target:'rightMiddle',tooltip:'leftMiddle'},adjust:{scroll:false}},hide:{effect:{length:1500},when:{event:'click'}},style:{width:150,paddingTop:20,paddingBottom:20,color:'#ff0000',fontSize:15,tip:{corner:'leftMiddle',color:'#999999',size:{x:20,y:20}},border:{width:1,radius:3,color:'#999999'}}};})(jQuery);(function($){$.fn.extend({routePlannerSuggest:function(options){var that=this;var top=$(this).offset().top;var windowHeight=$(window).height();var height33=windowHeight*0.33;var height66=windowHeight*0.66;var tipCorner,cornerTooltip='leftTop';var popupHeight=300;var padding=50;if(top<height33){if(windowHeight-top<popupHeight)popupHeight=windowHeight-top-padding;}else if(top>height33&&top<height66){tipCorner=cornerTooltip='leftMiddle';if(windowHeight-padding<popupHeight)popupHeight=windowHeight-padding;}else if(top>height66){tipCorner=cornerTooltip='leftBottom';if(top-padding<popupHeight)popupHeight=top-padding;}
var loader='<img src="'+DDI.contextPath+'/img/loading.gif" style="left:117px;top:'+(popupHeight/2)+'px;position:absolute">';var adjusted={content:{text:loader,title:{button:'<img alt="'+i18n.common.close()+'" src="'+DDI.contextPath+'/img/map/icon-popup-close.gif"/>'}},position:{corner:{tooltip:cornerTooltip}},style:{height:popupHeight,tip:{corner:tipCorner}}};var settings=$.extend(true,{},$.fn.routePlannerSuggest.defaults,options,adjusted);$(this).qtip(settings);this.alive=true;var errorContent='<p style="padding:10px">'+i18n.maps.error.common.ajax()+'</p>';return{show:function(){$(that).qtip('show');},hide:function(){$(that).qtip('hide');},destroy:function(){that.alive=false;$(that).qtip('destroy');$.fn.qtip.interfaces.pop(undefined);},getTarget:function(){return $(that).qtip('api').elements.target;},updatePosition:function(){$(that).qtip('api').updatePosition();},loadContent:function(url,data){$(that).qtip('api').updateContent(loader);$.ajax({url:url,data:data,success:function(content){if(that.alive){$(that).qtip('api').updateContent(content);}},error:function(){if(that.alive){$(that).qtip('api').updateContent(errorContent);}}});return this;}};}});$.fn.routePlannerSuggest.defaults={show:{delay:0,ready:true,when:{event:'uninvokedevent'}},position:{corner:{target:'rightMiddle'},adjust:{scroll:false}},hide:{when:{event:'click'}},style:{width:274,overflow:'auto',padding:0,tip:{corner:'leftTop',color:'#000',size:{x:20,y:20}},border:{width:1,radius:2,color:'#000'},title:{color:'',backgroundColor:'',paddingTop:2,paddingRight:0,paddingBottom:0},classes:{tooltip:'popupContentAdr',content:'results',button:'close'}}};})(jQuery);(function($){$.fn.extend({routePlannerAlternatives:function(options){var that=this;this.parameters={pref:"fastest"};if(options!=undefined&&typeof options=='object'){this.clickObserver=function(event){var tooltip=$(that).qtip('api').elements.tooltip;var isChildOf=$(event.target)[0]==tooltip[0];if(!isChildOf){$(event.target).parents().each(function(){isChildOf=isChildOf||$(this)[0]==tooltip[0];});}
if(!isChildOf){$(that).qtip('hide');}};this.storeParameters=function(){$('input:radio','div.directionsAlt').each(function(){if($(this).is(':checked')){that.parameters['pref']=$(this).attr('value');}});$('input:checkbox','div.directionsAlt').each(function(){if($(this).is(':checked')){that.parameters[$(this).attr('name')]=$(this).attr('value');}else{if(that.parameters[$(this).attr('name')]){delete that.parameters[$(this).attr('name')];}}});};this.restoreParameters=function(){$('input:checkbox,input:radio','div.directionsAlt').each(function(){var value=that.parameters[$(this).attr('name')];if(value&&$(this).attr('value')==value){$(this).attr('checked','true');}else{$(this).removeAttr('checked');}});};var settings=$.extend(true,{api:{beforeShow:function(){$(document).bind("click.alternatives",null,that.clickObserver);$(that).text(i18n.maps.alternatives.hide_alternatives()).removeClass("more").addClass("hide");that.restoreParameters();},beforeHide:function(){$(document).unbind("click.alternatives",null,that.clickObserver);$(that).text(i18n.maps.alternatives.show_alternatives()).removeClass("hide").addClass("more");}}},$.fn.routePlannerAlternatives.defaults,options);$(this).qtip(settings);}
return{isVisible:function(){var tooltip=$(that).qtip('api').elements.tooltip;return tooltip&&tooltip.is(":visible");},updatePosition:function(){$(that).qtip("api").updatePosition();},buildArguments:function(){var urlOptions={};var avoidArray=[];for(var argName in that.parameters){if(argName!='pref'){avoidArray.push(that.parameters[argName]);}}
urlOptions.routeType=that.parameters['pref'];if(avoidArray.length){urlOptions.avoid=avoidArray;}
return urlOptions;},hide:function(){$(that).qtip("hide");},storeSettings:function(){that.storeParameters();},getParameters:function(){!that.parameters['pref']&&(that.parameters['pref']='fastest');return that.parameters;},setValues:function(q){jQuery.extend(q,jQuery.map(['toll','ferry','highway','pref'],function(item){q[item]&&(that.parameters[item]=q[item]);}));}};}});$.fn.routePlannerAlternatives.defaults={show:{delay:0,when:{event:'click'}},position:{corner:{target:'bottomMiddle'},adjust:{scroll:false}},hide:{when:{event:'click'}},style:{width:'auto',padding:'5px 6px',classes:{content:'directionsAlt'},border:{width:1,radius:3,color:'#ccc'}}};})(jQuery);OpenLayers.Control.Panel=OpenLayers.Class(OpenLayers.Control,{controls:null,defaultControl:null,initialize:function(options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.controls=[];},destroy:function(){OpenLayers.Control.prototype.destroy.apply(this,arguments);for(var i=this.controls.length-1;i>=0;i--){if(this.controls[i].events){this.controls[i].events.un({"activate":this.redraw,"deactivate":this.redraw,scope:this});}
OpenLayers.Event.stopObservingElement(this.controls[i].panel_div);this.controls[i].panel_div=null;}},activate:function(){if(OpenLayers.Control.prototype.activate.apply(this,arguments)){for(var i=0,len=this.controls.length;i<len;i++){if(this.controls[i]==this.defaultControl){this.controls[i].activate();}}
this.redraw();return true;}else{return false;}},deactivate:function(){if(OpenLayers.Control.prototype.deactivate.apply(this,arguments)){for(var i=0,len=this.controls.length;i<len;i++){this.controls[i].deactivate();}
return true;}else{return false;}},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);for(var i=0,len=this.controls.length;i<len;i++){this.map.addControl(this.controls[i]);this.controls[i].deactivate();this.controls[i].events.on({"activate":this.redraw,"deactivate":this.redraw,scope:this});}
this.activate();return this.div;},redraw:function(){this.div.innerHTML="";if(this.active){for(var i=0,len=this.controls.length;i<len;i++){var element=this.controls[i].panel_div;if(this.controls[i].active){element.className=this.controls[i].displayClass+"ItemActive";}else{element.className=this.controls[i].displayClass+"ItemInactive";}
this.div.appendChild(element);}}},activateControl:function(control){if(!this.active){return false;}
if(control.type==OpenLayers.Control.TYPE_BUTTON){control.trigger();this.redraw();return;}
if(control.type==OpenLayers.Control.TYPE_TOGGLE){if(control.active){control.deactivate();}else{control.activate();}
this.redraw();return;}
for(var i=0,len=this.controls.length;i<len;i++){if(this.controls[i]!=control){if(this.controls[i].type!=OpenLayers.Control.TYPE_TOGGLE){this.controls[i].deactivate();}}}
control.activate();},addControls:function(controls){if(!(controls instanceof Array)){controls=[controls];}
this.controls=this.controls.concat(controls);for(var i=0,len=controls.length;i<len;i++){var element=document.createElement("div");var textNode=document.createTextNode(" ");controls[i].panel_div=element;if(controls[i].title!=""){controls[i].panel_div.title=controls[i].title;}
OpenLayers.Event.observe(controls[i].panel_div,"click",OpenLayers.Function.bind(this.onClick,this,controls[i]));OpenLayers.Event.observe(controls[i].panel_div,"mousedown",OpenLayers.Function.bindAsEventListener(OpenLayers.Event.stop));}
if(this.map){for(var i=0,len=controls.length;i<len;i++){this.map.addControl(controls[i]);controls[i].deactivate();controls[i].events.on({"activate":this.redraw,"deactivate":this.redraw,scope:this});}
this.redraw();}},onClick:function(ctrl,evt){OpenLayers.Event.stop(evt?evt:window.event);this.activateControl(ctrl);},getControlsBy:function(property,match){var test=(typeof match.test=="function");var found=OpenLayers.Array.filter(this.controls,function(item){return item[property]==match||(test&&match.test(item[property]));});return found;},getControlsByName:function(match){return this.getControlsBy("name",match);},getControlsByClass:function(match){return this.getControlsBy("CLASS_NAME",match);},CLASS_NAME:"OpenLayers.Control.Panel"});OpenLayers.Control.DragFeature=OpenLayers.Class(OpenLayers.Control,{geometryTypes:null,onStart:function(feature,pixel){},onDrag:function(feature,pixel){},onComplete:function(feature,pixel){},layer:null,feature:null,dragCallbacks:{},featureCallbacks:{},lastPixel:null,initialize:function(layer,options){OpenLayers.Control.prototype.initialize.apply(this,[options]);this.layer=layer;this.handlers={drag:new OpenLayers.Handler.Drag(this,OpenLayers.Util.extend({down:this.downFeature,move:this.moveFeature,up:this.upFeature,out:this.cancel,done:this.doneDragging},this.dragCallbacks)),feature:new OpenLayers.Handler.Feature(this,this.layer,OpenLayers.Util.extend({over:this.overFeature,out:this.outFeature},this.featureCallbacks),{geometryTypes:this.geometryTypes})};},destroy:function(){this.layer=null;OpenLayers.Control.prototype.destroy.apply(this,[]);},activate:function(){return(this.handlers.feature.activate()&&OpenLayers.Control.prototype.activate.apply(this,arguments));},deactivate:function(){this.handlers.drag.deactivate();this.handlers.feature.deactivate();this.feature=null;this.dragging=false;this.lastPixel=null;OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},overFeature:function(feature){if(!this.handlers.drag.dragging){this.feature=feature;this.handlers.drag.activate();this.over=true;OpenLayers.Element.addClass(this.map.viewPortDiv,this.displayClass+"Over");}else{if(this.feature.id==feature.id){this.over=true;}else{this.over=false;}}},downFeature:function(pixel){this.lastPixel=pixel;this.onStart(this.feature,pixel);},moveFeature:function(pixel){var res=this.map.getResolution();this.feature.geometry.move(res*(pixel.x-this.lastPixel.x),res*(this.lastPixel.y-pixel.y));this.layer.drawFeature(this.feature);this.lastPixel=pixel;this.onDrag(this.feature,pixel);},upFeature:function(pixel){if(!this.over){this.handlers.drag.deactivate();}},doneDragging:function(pixel){this.onComplete(this.feature,pixel);},outFeature:function(feature){if(!this.handlers.drag.dragging){this.over=false;this.handlers.drag.deactivate();OpenLayers.Element.removeClass(this.map.viewPortDiv,this.displayClass+"Over");this.feature=null;}else{if(this.feature.id==feature.id){this.over=false;}}},cancel:function(){this.handlers.drag.deactivate();this.over=false;},setMap:function(map){this.handlers.drag.setMap(map);this.handlers.feature.setMap(map);OpenLayers.Control.prototype.setMap.apply(this,arguments);},CLASS_NAME:"OpenLayers.Control.DragFeature"});(function($){DDI.GeoChoice={mapContainerSelector:null,countyIdMapping:null,initGeoChoice:function(opts){if(opts==null||opts.mapContainerSelector==null||opts.countyIdMapping==null){throw new Error("Illegal argument exception! Required arguments are not specified!");}
this.mapContainerSelector=opts.mapContainerSelector;this.countyIdMapping=opts.countyIdMapping;},detachAutocompleter:function(){$('#municipalityName').ddiAutocompleteDetach();},createAutocompleter:function(){$('#municipalityName').ddiAutocomplete();}}})(jQuery);(function($){$.extend(DDI.GeoChoice,{initMap:function(){var that=this;$("area",this.mapContainerSelector).each(function(){$(this).dialogAjaxify({update_position:false,link:DDI.contextPath+"/geochoice/county/?id="+that.countyIdMapping[this.id],target:"#mapNav",onSuccess:function(){DDI.GeoChoice.createAutocompleter();DDI.GeoChoice.initCountyLinks();},onStart:DDI.GeoChoice.detachAutocompleter});});$("#modalDialog").modalDialog("closeHandler",DDI.GeoChoice.detachAutocompleter);},initSignUpLink:function(){$("#modalDialog .signupLink").dialogAjaxify();$("#geochoiceSigninLink").dialogAjaxify();},initChooseForm:function(){DDI.GeoChoice.createAutocompleter();$('#municipalityForm').dialogAjaxify({event:'submit',link:DDI.contextPath+'/geochoice/',method:'POST',forms:'#municipalityForm',onStart:DDI.GeoChoice.detachAutocompleter,onSuccess:function(){DDI.GeoChoice.initSignUpLink();DDI.GeoChoice.initChooseForm();DDI.GeoChoice.initMap();}});},initCountyLinks:function(){$(".municipalityLink").click(function(){$("#municipalityName").val($(this).text());$("input:hidden [name=ajax]","#municipalityForm").val(true);$("#municipalityForm").submit();return false;});$("#backToMap").dialogAjaxify({target:"#mapNav",onSuccess:function(){DDI.GeoChoice.initMap();DDI.GeoChoice.createAutocompleter();},onStart:DDI.GeoChoice.detachAutocompleter});}});})(jQuery);<!--
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
DDI.Maps.MarkerTool=OpenLayers.Class(OpenLayers.Control,{EVENT_TYPES:["activate","deactivate","beforeMarkerDeletion","markerSet"],initialize:function(options){this.handlers={};this._marker=null;this._markerPosition=null;this.popupFactory=options.popupFactory||this.getDefaultPopupFactory();OpenLayers.Control.prototype.initialize.apply(this,arguments);},activate:function(){this.handlers.click.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments);},deactivate:function(){this.handlers.click.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments);},draw:function(){this.handlers.click=new OpenLayers.Handler.Click(this,{click:this.clickCallback});this.activate();},clickCallback:function(event){var position=this.map.getLonLatFromPixel(event.xy);this.setMarker(position);this.events.triggerEvent("markerSet",{position:position});},getDefaultPopupFactory:function(){return(function(tool){return function(position){return tool.getDefaultPopup(position);}})(this);},getDefaultPopup:function(position){return new Eniro.Feature.PopupFeature(position);},setPopupFactory:function(popupFactory){this.popupFactory=popupFactory;},removeMarker:function(){this._markerPosition=null;if(this._marker){this.events.triggerEvent("beforeMarkerDeletion");this._marker.closePopup();this.map.removeFeature(this._marker);this._marker=null;}},setMarker:function(position){this.removeMarker();this._markerPosition=position;this._marker=this.popupFactory(position);this.map.addFeature(this._marker);},getMarker:function(){return this._marker;},getMarkerPosition:function(){return this._markerPosition;},CLASS_NAME:"DDI.Maps.MarkerTool"});DDI.Maps.GeotagPanel=OpenLayers.Class(OpenLayers.Control.Panel,{DEFAULT_PROJECTION:new OpenLayers.Projection('EPSG:4326'),initialize:function(options){this.cachedControls={};options=options||{};options.projection=options.projection||this.DEFAULT_PROJECTION;options.defaultControl=options.defaultControl||this._getDefaultControl();OpenLayers.Control.Panel.prototype.initialize.apply(this,[options]);this._setControls();},_getControl:function(cacheName,createCallback){if(!this.cachedControls[cacheName]){this.cachedControls[cacheName]=createCallback();}
return this.cachedControls[cacheName];},getMarkerTool:function(){return this._getControl('markerTool',function(){return new DDI.Maps.MarkerTool({displayClass:'MarkerTool'});});},getNavigationControl:function(){return this._getControl('navigation',function(){return new OpenLayers.Control.Navigation({displayClass:'Navigation'});});},_getDefaultControl:function(){return this.defaultControl||this.getNavigationControl();},_setControls:function(){this.addControls([this.getMarkerTool(),this.getNavigationControl()]);},CLASS_NAME:'DDI.Maps.GeotagPanel'});DDI.Maps.GeotagPanel.DEFAULT_PROJECTION=DDI.Maps.GeotagPanel.prototype.DEFAULT_PROJECTION;DDI.SendAsSms={initForm:function(servletPath){$j("#sendSmsForm").dialogAjaxify({event:'submit',link:DDI.contextPath+servletPath,method:'POST',forms:'#sendSmsForm'});}};function mailto(C){var A="mailto:";for(var B=0;B<C.length;B++){A=A+C[B]}this.location.href=A};(function($){$.widget("ui.routePoints",{_init:function(){this._initStartStop();},_initStartStop:function(){this.append();this.append();},_spawnRoutePoint:function(){var _this=this;return $("<div/>").addClass("routePoint").append($("<img height='28px' width='54px'/>")).append($("<input type='text'/>").addClass("txt").keydown(function(event){if(event.keyCode==13){_this.options.routechange();}else{$(this).attr("name","");}})).append($("<div/>").addClass("controls").append($("<a>"+i18n.maps.get_directions.up()+"</a>").addClass("up").attr("href","#")).append($("<a>"+i18n.maps.get_directions.down()+"</a>").addClass("down").attr("href","#")).append($("<a>"+i18n.maps.get_directions.remove()+"</a>").addClass("remove").attr("href","#")));},setTo:function(element,id,text,position){if(id!==undefined){$(element,this.element).attr("name",id);}
if(text!==undefined){$(element,this.element).val(text);}
if(position!==undefined){$(element,this.element).attr("lon",position.lon).attr("lat",position.lat);}
this.options.routechange();},_updateRoutePointData:function(element,id,text,position){this.setTo($("input",element),id,text,position);},routePointsNumber:function(){return $(".routePoint",this.element).size();},reorder:function(){var _this=this;var points=$(".routePoint > img",this.element);points.each(function(idx){$(this).attr("src",_this.options.imageSrc(idx,points.length));});},update:function(){var removeFlag=this.canRemove();var routePointsCount=$(".routePoint",this.element).length;$(".routePoint",this.element).each(function(idx){if(idx>0){$("a.up",this).removeClass("disabled").removeAttr("tabindex");}else{$("a.up",this).addClass("disabled").attr("tabindex",-1);}
if(idx<routePointsCount-1){$("a.down",this).removeClass("disabled").removeAttr("tabindex");}else{$("a.down",this).addClass("disabled").attr("tabindex",-1);}
if(removeFlag){$("a.remove",this).removeClass("disabled").removeAttr("tabindex");}else{$("a.remove",this).addClass("disabled").attr("tabindex",-1);}});},_attachControls:function(point){var _this=this;$(".up",point).click(function(){var prevSibling=$(point).prev();if(prevSibling.length>0){_this.options.beforeswap($(point),$(prevSibling));prevSibling.before(point);_this.reorder();_this.update();_this.options.swap($(point),$(prevSibling));_this.options.routechange();}
return false;});$(".down",point).click(function(){var nextSibling=$(point).next();if(nextSibling.length>0){_this.options.beforeswap($(point),$(nextSibling));nextSibling.after(point);_this.reorder();_this.update();_this.options.swap($(point),$(nextSibling));_this.options.routechange();}
return false;});$(".remove",point).click(function(){_this.remove(point);return false;});},prepend:function(id,text,position){if(this.canAdd()){var routePoint=this._spawnRoutePoint();$(this.element).prepend(routePoint);this._updateRoutePointData(routePoint,id,text,position);this._attachControls(routePoint);this.reorder();this.update();this.options.add($(routePoint));}},append:function(id,text,position){if(this.canAdd()){var routePoint=this._spawnRoutePoint();$(this.element).append(routePoint);this._updateRoutePointData(routePoint,id,text,position);this._attachControls(routePoint);this.reorder();this.update();this.options.add($(routePoint));}},via:function(id,text,position){var last=$(".routePoint:last",this.element);if(this.canAdd()&&last.length>0){var routePoint=this._spawnRoutePoint();last.before(routePoint);this._updateRoutePointData(routePoint,id,text,position);this._attachControls(routePoint);this.reorder();this.update();this.options.add($(routePoint));}},canAdd:function(){return this.routePointsNumber()<this.options.maxWayPoints;},remove:function(idx){if(this.canRemove()){var point=null;if(typeof(idx)=='object'){var byObject=$(idx,this.element);point=byObject.length>0?byObject:null;}else{var byIndex=$(".routePoint",this.element).get(idx);point=byIndex!=null?byIndex:null;}
if(point!=null){this.options.beforeremove($(point));$(point).remove();this.reorder();this.update();this.options.remove($(point));this.options.routechange();}}},canRemove:function(){return this.routePointsNumber()>2;},reverse:function(){var _this=this;this.options.beforereverse();$(".routePoint",this.element).each(function(){$(_this.element).prepend($(this));});this.reorder();this.update();this.options.reverse();this.options.routechange();},_getStartPointElement:function(){return $(".routePoint:first",this.element);},_getEndPointElement:function(){return $(".routePoint:last",this.element);},setStart:function(id,text,position){var start=this._getStartPointElement();if($("input",start).val()){this.prepend(id,text,position);}else{this._updateRoutePointData(start,id,text,position);}},setEnd:function(id,text,position){var end=this._getEndPointElement();if($("input",end).val()){this.append(id,text,position);}else{this._updateRoutePointData(end,id,text,position);}},clear:function(){while(this.canRemove()){this.remove(0);}
$(".routePoint input:text",this.element).each(function(){$(this).attr("name","").removeAttr("lon").removeAttr("lat").val("");});this.options.routechange();},collectData:function(){return jQuery.map($(".routePoint input:text",this.element),function(el){return{id:$(el).attr("name"),description:$(el).val().replace(/'/g," "),lon:$(el).attr("lon"),lat:$(el).attr("lat")};});}});var getPointSrc=function(number,total){var src=DDI.contextPath+'/mapsv2/media/markers/route/';if(number==0){src+='map-start';}else if(number==total-1){src+='map-stop';}else{src+='map-via'+number;}
return src+'-'+DDI.country.toLowerCase()+'.png';};$.extend($.ui.routePoints,{getter:"routePointsNumber collectData",getPointSrc:getPointSrc,defaults:{maxWayPoints:8,imageSrc:getPointSrc,routechange:function(){},add:function(el){},beforeremove:function(el){},remove:function(el){},swap:function(swapthat,swapwith){},beforeswap:function(swapthat,swapwith){},beforereverse:function(){},reverse:function(){}}});})(jQuery);DDI.UrlHelper={rebuildUrl:function(urlParams,pathName){if(urlParams==undefined){urlParams={};}
if(pathName==null){pathName=window.location.href;}
var params=this._changeParameters(this._getParams(pathName),urlParams);var paramsString=this._toParamsString(params);var url=this._getUrl(pathName);return url+(paramsString!=''?('?'+paramsString):'');},getParamValue:function(name){if(name==undefined){return;}
return this._getParams(window.location.search)[name];},navigateWithReferrer:function(url){var fakeLink=document.createElement("a");if(typeof(fakeLink.click)=='undefined'){window.location.href=url;}else{fakeLink.href=url;document.body.appendChild(fakeLink);fakeLink.click();}},_getParams:function(url){var params=new Object();var idx=url.indexOf('?');if(idx<0)return params;var paramsString=url.substring(idx+1);var pairs=paramsString.split('&');for(var i=0;i<pairs.length;i++){var pos=pairs[i].indexOf('=');if(pos==-1)continue;var paramName=pairs[i].substring(0,pos);params[paramName]=pairs[i].substring(pos+1);}
return params;},_changeParameters:function(params,paramsToAdd){var paramsFiltered={};for(var paramName in paramsToAdd){params[paramName]=paramsToAdd[paramName];}
for(var paramName in params){if(params[paramName]!=null){paramsFiltered[paramName]=params[paramName];}}
return paramsFiltered;},_toParamsString:function(params){var paramsArray=[];for(var paramsName in params){paramsArray.push(paramsName+'='+params[paramsName]);}
return paramsArray.join("&");},_getUrl:function(replacePathName){var wndLoc=window.location;var href=wndLoc.protocol+"//"+wndLoc.host;if(replacePathName&&replacePathName.indexOf(href)<0){href+=(replacePathName.indexOf("/")!=0?"/":"")+replacePathName;}else if(replacePathName){href=replacePathName;}else{href+=wndLoc.pathname;}
var idx=href.indexOf("?");if(idx<0){return href;}else{return href.substring(0,idx);}}};(function($){MapSearch=function(action,container,map,callbacks){this.action=action;this.container=$(container);this.map=map;this.callbacks=jQuery.extend({searchPerformed:function(){},markersDataReceived:function(){},searchCleared:function(){}},callbacks);this.projection=this.DEFAULT_PROJECTION;};MapSearch.DEFAULT_PROJECTION=new OpenLayers.Projection("EPSG:4326");MapSearch.prototype={DEFAULT_PROJECTION:MapSearch.DEFAULT_PROJECTION,activate:function(){this.map.events.on({moveend:this._resetOffsetAndRefresh,scope:this});},deactivate:function(){this.map.events.un({moveend:this._resetOffsetAndRefresh,scope:this});},perform:function(query){this.clear();if(typeof(query)=='object'){this.params=query;}else{this.params={q:query};}
this.callbacks.searchPerformed(this.params);this.activate();this._refresh();},extendParams:function(params){var newParams=jQuery.extend({},this.params,params);this.perform(newParams);},clear:function(){this._cancelRequest();this.deactivate();this.container.empty();this.params=null;this.callbacks.searchCleared();},_resetOffsetAndRefresh:function(){this.params.offset=0;this.callbacks.searchPerformed(this.params);this._refresh();},_refresh:function(){if(this.params){var _this=this;this._cancelRequest();var loader='<img src="'+DDI.contextPath+'/img/maps/ajax-loader.gif" style="top: 10px; left: 45%; position: relative;">';this.container.empty().append(loader);this.currentXhr=jQuery.ajax({type:"GET",url:this.action,data:this._buildArgs(),success:function(response){$(_this.container).html(response);_this.callbacks.markersDataReceived(_this._evaluateMarkersData());}});}},_buildArgs:function(){var extent=this._getExtent();var resolution=this._poiResolution();return jQuery.extend({wRes:resolution.w,hRes:resolution.h,north:extent.top,south:extent.bottom,west:extent.left,east:extent.right},this.params);},_getExtent:function(){return this.map.getExtent().transform(this.map.projection,this.projection);},_poiResolution:function(){var pos=this.map.getCenter();var area=new OpenLayers.Bounds();area.extend(pos);var res=this.map.getResolution();pos=pos.add(27*res,37*res);area.extend(pos);return area.transform(this.map.baseLayer.projection,this.projection).getSize();},_evaluateMarkersData:function(response){return jQuery.grep(eval($(".resultData",this.container).text())||[],function(e){return e!=null;});},_cancelRequest:function(){if(this.currentXhr){this.currentXhr.abort();}}};})(jQuery);(function($){MapItemLocator=function(action,container,map,callback,errback){this.action=action;this.container=$(container);this.map=map;this.callback=callback||function(){};this.errback=errback||function(){};};MapItemLocator.prototype={perform:function(query){var _this=this;var params={};if(typeof(query)=='object'){jQuery.extend(params,query);}else{jQuery.extend(params,{id:query});}
jQuery.ajax({type:"GET",url:this.action,data:params,success:function(response){_this.callback(_this._evaluateMarkerData(response));$(_this.container).html(response);},error:function(){_this.errback();}});},_evaluateMarkerData:function(response){var $result=$('<div>'+response+'</div>').find(".resultData");if($result.length){return new Function("var data = "+$result.text()+"; return data;")();}else{return null;}}};})(jQuery);(function($){var noop=function(){};HistoryManager=function(){this.active=false;this.handlers=[];};HistoryManager.prototype.activate=function(active){var wasActive=this.active;this.active=active!=undefined?active:true;return wasActive;};HistoryManager.prototype.deactivate=function(){var wasActive=this.active;this.active=false;return wasActive;};HistoryManager.prototype.addHandler=function(handler){this.handlers.push(handler);};HistoryManager.prototype.restoreState=function(){var wasActive=this.deactivate();var state=this._getState();jQuery.each(this.handlers,function(){this.restoreState(state);});this.activate(wasActive);};HistoryManager.prototype.stateChanged=function(){if(!this.active)return;var state={};jQuery.each(this.handlers,function(){jQuery.extend(state,this.buildState());});var wasActive=this.deactivate();window.location.hash="#"+jQuery.param(state);this.activate(wasActive);};HistoryManager.prototype._getState=function(){var paramsString=window.location.hash;if(paramsString.charAt(0)=='#'){paramsString=paramsString.substr(1);}
var state={};if(!paramsString.length){return state;}
jQuery.each(paramsString.split('&'),function(){var kv=this.split('=',2);var k=kv[0];var v=kv[1];var decodedValue=v!=undefined?decodeURIComponent(v.replace(/\+/g,"%20")):undefined;if(state[k]==undefined){state[k]=decodedValue;}else if(jQuery.isArray(state[k])){state[k].push(decodedValue);}else{state[k]=[state[k],decodedValue];}});return state;};HistoryManager.prototype.isPositionAffected=function(){var state=this._getState();return state.lon||state.lat;};})(jQuery);(function($){DDI.Maps.PopupContentLoader={};DDI.Maps.PopupContentLoader.handler=function(e){var loadContent=e.feature.loadContent;if(loadContent){jQuery.get(loadContent.url,loadContent.data,function(data){if(e.popup.id){e.popup.setSize(new OpenLayers.Size(190,100));e.popup.setContentHTML(data);}});}};DDI.Maps.PopupContentLoader.activate=function(){Eniro.AppEvents.on({onPopupOpened:DDI.Maps.PopupContentLoader.handler});};DDI.Maps.PopupContentLoader.deactivate=function(){Eniro.AppEvents.un({onPopupOpened:DDI.Maps.PopupContentLoader.handler});};})(jQuery);MapPositionHandler=function(map){this.map=map;};MapPositionHandler.prototype.buildState=function(){var center=this.map.getCenter();var zoom=this.map.getZoom();return{lat:center.lat,lon:center.lon,zoom:zoom};};MapPositionHandler.prototype.restoreState=function(state){if(state.lon!=undefined&&state.lat!=undefined){this.map.moveTo(new OpenLayers.LonLat(state.lon,state.lat));if(state.zoom!=undefined){this.map.zoomTo(parseInt(state.zoom));}}else if(state.top!==undefined&&state.right!==undefined&&state.bottom!==undefined&&state.left!==undefined){var bounds=new OpenLayers.Bounds(state.left,state.bottom,state.right,state.top);this.map.zoomToExtent(bounds.transform(new OpenLayers.Projection("EPSG:4326"),this.map.projection));}};MapLayerHandler=function(map){this.map=map;};MapLayerHandler.prototype.buildState=function(){var layerId=this.map.baseLayer.id;return{baseLayerId:layerId};};MapLayerHandler.prototype.restoreState=function(state){if(state.baseLayerId!=undefined){var layerId=this.map.getLayer(state.baseLayerId);this.map.setBaseLayer(layerId);}};MapPinHandler=function(markerTool){this.markerTool=markerTool;};MapPinHandler.prototype.buildState=function(){var position=this.markerTool.getMarkerPosition();return position!=null?{pinLon:position.lon,pinLat:position.lat}:null;};MapPinHandler.prototype.restoreState=function(state){if(state.pinLon!=undefined&&state.pinLat!=undefined){this.markerTool.setMarker(new OpenLayers.LonLat(state.pinLon,state.pinLat));}};MapViewSearchHandler=function(mapView){this.mapView=mapView;};MapViewSearchHandler.prototype.buildState=function(){var state={};jQuery.extend(state,this.mapView.currentSearch);return state;};MapViewSearchHandler.prototype.restoreState=function(state){if(state.id!=undefined&&state.type!=undefined){this.mapView.customSearch(state.type,state.id);}else if(state.q!=undefined&&state.type!=undefined){this.mapView.performSearch(state.type,state.q,parseInt(state.offset)||0);}};(function($){RoutePlannerHandler=function(route){this.route=route;};RoutePlannerHandler.prototype.buildState=function(){var state={};jQuery.extend(state,this.route.getWaypointsState());jQuery.extend(state,this.route.alternativesPopup.getParameters());return state;};RoutePlannerHandler.prototype.restoreState=function(state){if(!!state.description){var waypoints=$.map(state.rp_id,function(el,idx){return{rp_id:el,description:(state.description&&state.description[idx])||undefined,coord:((!!state.rp_lon[idx]||!!state.rp_lat[idx])&&{lon:state.rp_lon[idx],lat:state.rp_lat[idx]})||undefined};});$("#dropDownBar").show();this.route.fillWaypoints(waypoints);this.route.alternativesPopup.setValues(state);$('input:submit.btnDirections',this.route.div).trigger('click');}};})(jQuery);(function($){MapView=function(options){var _this=this;this.options=options;this.searchType='all';this.printSearchType='address';this._createMap();this._appendLogo();new PoiManager(this.map);this.currentSearch={};var resultsContainer=$j("#sideBar .resultListWrapper");this.mapSearch=new MapSearch(DDI.contextPath+"/map/mapSearch/",resultsContainer,this.map,{markersDataReceived:function(markers){_this.displayResultMarkers(markers);},searchCleared:function(){_this.clearMapMarkers();},searchPerformed:function(params){_this.currentSearch.offset=params.offset;_this.historyManager.stateChanged();}});var displayItemMarkerCallback=function(itemList){_this.mapSearch.clear();_this.clearMapMarkers();var item=itemList.shift();_this.displayMapItemMarker(item);};var displayErrorCallback=function(){$(resultsContainer).empty().append($("<div class='resultInfo'><p>"+i18n.maps.error.common.ajax()+"</p></div>"));};this.mapItemLocators={'address':new MapItemLocator(DDI.contextPath+"/map/addressResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'company':new MapItemLocator(DDI.contextPath+"/map/companyResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'people':new MapItemLocator(DDI.contextPath+"/map/peopleResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'activity':new MapItemLocator(DDI.contextPath+"/map/activityResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'clubsandorgs':new MapItemLocator(DDI.contextPath+"/map/clubsAndOrgsResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'public_info':new MapItemLocator(DDI.contextPath+"/map/publicResult/",resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback),'group':new MapItemLocator(DDI.contextPath+'/map/groupResult/',resultsContainer,this.map,displayItemMarkerCallback,displayErrorCallback)};var positionHandler=new MapPositionHandler(this.map);var layerHandler=new MapLayerHandler(this.map);var searchHandler=new MapViewSearchHandler(this);this.historyManager=new HistoryManager();this.map.events.on({moveend:function(){_this.historyManager.stateChanged();},changebaselayer:function(){_this.historyManager.stateChanged();}});this.historyManager.addHandler(positionHandler);this.historyManager.addHandler(layerHandler);this.historyManager.addHandler(searchHandler);this._enablePrintMapLink();$j("#dropDownBarCloseLink").click(function(){var dropDownHeight=$j("#dropDownBar").is(":hidden")?0:$j("#dropDownBar").outerHeight(true);var height=$j("#sideBar").height();$j("#dropDownBar").hide();$j("#sideBar").css({height:height+dropDownHeight});$j("#getDirectionsActivateLink").removeClass("show");$j("#getDirectionsActivateLink strong").hide();$j("#getDirectionsActivateLink a").show();return false;});$j("#getDirectionsActivateLink a").click(function(){var leftColumn=$j("#leftColumn");$j(this).hide();$j("#getDirectionsActivateLink strong").show();$j("#getDirectionsActivateLink").addClass("show");var height=$j("#sideBar").height();$j("#dropDownBar").show();var dropDownHeight=$j("#dropDownBar").is(":hidden")?0:$j("#dropDownBar").outerHeight(true);var sidebarheight=height-dropDownHeight;$j("#sideBar").css({height:sidebarheight>0?sidebarheight:0});if(leftColumn.is(":hidden")){_this.displayLeftColumn(true);}
return false;});this.initSearchForm();DDI.Maps.PopupContentLoader.activate();$j("#tabBar span.option a").click(function(){_this.toggleLeftColumn();return false;});$j(window).resize(function(){_this.updateLayout();});this.updateLayout();};MapView.prototype._createMap=function(){this.map=new Eniro.API.Map('map-container',DDI.contextPath+'/mapsv2',{activeLayers:[Eniro.Map.LAYER_MAP,Eniro.Map.LAYER_AERIAL,Eniro.Map.LAYER_HYBRID,Eniro.Map.LAYER_NAUTICAL],layerSelector:true,zoomBar:true,keyboardControl:false,navigationControl:false});};MapView.prototype._appendLogo=function(){this.map.addControl(new DDI.Maps.Logo());};MapView.prototype._enablePrintMapLink=function(){var _this=this;$j("#container .mapTools a.print").click(function(){var hmr=_this.historyManager._getState();var params={};jQuery.each(['pref','ferry','highway','toll'],function(idx,avoid){if(hmr[avoid]){params[avoid]=hmr[avoid];}});var extent=_this.map.getExtent().clone().transform(_this.map.projection,new OpenLayers.Projection("EPSG:4326"));jQuery.extend(params,{top:extent.top,right:extent.right,bottom:extent.bottom,left:extent.left});jQuery.extend(params,_this.routeController.getWaypointsState());jQuery.extend(params,_this.currentSearch);window.location.href=_this.options.printUrl+"#"+jQuery.param(params);return false;});};MapView.prototype.initRoutePlanner=function(){var _this=this;this.routeController=window.route=new DDI.Maps.RoutePlanner(DDI.contextPath+"/map",{div:$("#dropDownBar"),updateCallback:function(){_this.historyManager.stateChanged();}});this.map.addControl(route);var routeHandler=new RoutePlannerHandler(this.routeController);window.route.deactivate();this.historyManager.addHandler(routeHandler);window.route.events.on({activate:function(){_this.historyManager.stateChanged();},deactivate:function(){_this.historyManager.stateChanged();},changepoints:function(){_this.historyManager.stateChanged();},scope:this})};MapView.prototype.initGeotagPanel=function(){this._customPinXhr=null;this.geotagPanel=new DDI.Maps.GeotagPanel({div:$('<div class="MapGeotagPanel"/>').appendTo('.eniro-controlbar-area').get(0)});this.geotagPanel.getMarkerTool().setPopupFactory(OpenLayers.Function.bind(this.createMarkerPopup,this));this.geotagPanel.getMarkerTool().events.on({"beforeMarkerDeletion":function(){if(this._customPinXhr!=null){this._customPinXhr.abort();this._customPinXhr=null;}
this.historyManager.stateChanged();},"markerSet":function(){this.historyManager.stateChanged();},scope:this});this.map.addControl(this.geotagPanel);var pinHandler=new MapPinHandler(this.geotagPanel.getMarkerTool());this.historyManager.addHandler(pinHandler);};MapView.prototype.initPosition=function(position){if(!this.historyManager.isPositionAffected()){var center=position.transform(new OpenLayers.Projection("EPSG:4326"),this.map.projection);this.map.setCenter(center,10,false,true);}};MapView.prototype.createMarkerPopup=function(position){this._invokeCustomPinAjaxLoader(position);return new Eniro.Feature.PopupFeature(position,{},{popupContents:'<div id="customPinPopupContent"><img src="'+DDI.contextPath+'/img/maps/ajax-loader.gif" alt="'+
i18n.common.loading()+'" title="'+i18n.common.loading()+'" /></div>'});};MapView.prototype._invokeCustomPinAjaxLoader=function(position){var
lonlat=position.clone().transform(this.map.projection,new OpenLayers.Projection("EPSG:4326")),callback=function(marker,response){var popupContent=$("#customPinPopupContent");if(!popupContent.length){setTimeout(function(){callback(marker,response);},100);}else{popupContent.html(response);marker.popupContents=response;marker.closePopup();marker.openPopup();}},this_=this;this._customPinXhr=jQuery.ajax({url:DDI.contextPath+'/map/popup',dataType:'text',data:{id:'s_'+lonlat.lon+','+lonlat.lat},success:function(response){callback(this_.geotagPanel.getMarkerTool().getMarker(),response);this_._customPinXhr=null;}});};MapView.prototype.clearUserMarker=function(){this.geotagPanel.getMarkerTool().removeMarker();};MapView.prototype.initSearchForm=function(){var _this=this;$j("#addressSearchForm").submit(function(){_this.validateAndSearch(_this.searchType);return false;});$j(".searchSubmitLink").click(function(){_this.validateAndSearch($j(this).attr('search-type'));return false;});};MapView.prototype.setCurrentWaypoint=function(){this.routeController.setCurrentWaypoint.apply(this.routeController,arguments);};MapView.prototype.validateAndSearch=function(type){var _this=this;var q=$(".mainSearch form input[name=q]");if($.trim(q.val()).length!=0){q.val($.trim(q.val()));_this.performSearch(type,q.val());}};MapView.prototype.performSearch=function(type,q,offset){var form=$(".mainSearch form");var searchField=$(".searchField[name=q]",form);var typeField=$("input:hidden[name=type]",form);$("input:submit",form).focus();this.displayLeftColumn(true);if(type!=null&&type in MapView.SEARCH_ACTIONS&&q!==null){searchField.val(q);this.searchType=type;typeField.val(MapView.SEARCH_ACTIONS[type]);$(".resultWrapper","#sideBar").hide();$(".resultListWrapper").show();this.switchSearchType(type);this.currentSearch={type:type,q:q};this.mapSearch.perform({type:MapView.SEARCH_ACTIONS[type],q:q,offset:offset||0});}};MapView.prototype.displayResultMarkers=function(markers){var _this=this;this.clearMapMarkers();jQuery.each(markers,function(idx,group){var markerLonLat=new OpenLayers.LonLat(group.point.lon,group.point.lat).transform(new OpenLayers.Projection(group.point.proj),_this.map.projection);var marker=new Eniro.Feature.PopupFeature(markerLonLat,{},{popupContents:"<p>"+i18n.common.loading()+"</p>",style:{externalGraphic:DDI.contextPath+"/mapsv2/media/markers/search/address-"+(idx+1)+".png",graphicWidth:27,graphicHeight:37,graphicXOffset:-11,graphicYOffset:-35}});marker.loadContent={url:DDI.contextPath+"/map/popup",data:{id:group.id}};_this.map.addFeature(marker,MapView.SEARCH_RESULTS_FEATURE_GROUP_NAME);});};MapView.prototype.displayMapItemMarker=function(item){var position=new OpenLayers.LonLat(item.point.lon,item.point.lat).transform(new OpenLayers.Projection("EPSG:4326"),this.map.baseLayer.projection);this.map.setCenter(position);this.map.zoomTo(17);var marker=new Eniro.Feature.PopupFeature(position,{},{popupContents:"<p>"+i18n.common.loading()+"</p>"});marker.loadContent={url:DDI.contextPath+"/map/popup",data:{id:item.id}};this.map.addFeature(marker,MapView.MAP_ITEM_FEATURE_GROUP_NAME);};MapView.prototype.clearMapMarkers=function(){var _this=this;jQuery.each([MapView.MAP_ITEM_FEATURE_GROUP_NAME,MapView.SEARCH_RESULTS_FEATURE_GROUP_NAME],function(idx,group){jQuery.each(_this.map.featureGroups[group]||[],function(idx,feature){if(feature){feature.closePopup();}});_this.map.removeFeatureGroup(group);});};MapView.prototype.switchSearchType=function(type){$(".searchOpt li").removeClass("selected");var link=$(".searchOpt li a[search-type="+type+"]");if(link.length>0){link.parent("li").addClass("selected");if(type=='all'){type='address';}}
this.printSearchType=type;};MapView.prototype.updateLayout=function(){var leftColumnVisible=$("#leftColumn").is(":visible");$("#map-container").hide();var topHeight=$("#container").height();var docWidth=$(window).width();var docHeight=$(window).height();var contentHeight=docHeight-topHeight;$("#map-container").css({width:docWidth-(leftColumnVisible?$("#sideBar").width():0),height:contentHeight,left:leftColumnVisible?$("#sideBar").width():0});var dropDownHeight=$("#dropDownBar").is(":hidden")?0:$("#dropDownBar").outerHeight(true);var sideBarHeight=contentHeight-$("#tabBar").height()-dropDownHeight;$("#sideBar").height(sideBarHeight>0?sideBarHeight:0);$("#map-container").show();this.map.updateSize();};MapView.prototype.toggleLeftColumn=function(){this.displayLeftColumn($("#leftColumn").is(":hidden"));};MapView.prototype.displayLeftColumn=function(visible){var tabBarPane=$("#tabBar");var togglePane=$("span.option",tabBarPane);var getDirectionsActivateLink=$("#getDirectionsActivateLink");var dropDownBar=$("#dropDownBar");var leftColumn=$("#leftColumn");if(visible){leftColumn.show();if(dropDownBar.is(':visible')){getDirectionsActivateLink.find("strong").show();getDirectionsActivateLink.find("a").hide();getDirectionsActivateLink.addClass("show");}
tabBarPane.removeClass("close").addClass("open");togglePane.removeClass("close").addClass("open");}else{getDirectionsActivateLink.removeClass("show");getDirectionsActivateLink.find("strong").hide();getDirectionsActivateLink.find("a").show();tabBarPane.removeClass("open").addClass("close");togglePane.removeClass("open").addClass("close");leftColumn.hide();}
this.updateLayout();};MapView.prototype.setSearchOffset=function(offset){this.mapSearch.extendParams({offset:offset});};MapView.prototype.customSearch=function(type,id){if(type!=null&&type in this.mapItemLocators){this.searchType=type;this.currentSearch={id:id,type:type};this.mapItemLocators[type].perform(id);this.switchSearchType(type);}
this.displayLeftColumn(true);};MapView.prototype.customSearchFromElement=function(type,element){this.customSearch(type,$(element).val());};MapView.prototype.moveToCoord=function(lonlat){this.map.moveTo(lonlat.transform(new OpenLayers.Projection("EPSG:4326"),this.map.projection));this.map.zoomTo(17);};MapView.prototype.sendSms=function(id,type,pin){var params={lat:this.map.getCenter().lat,lon:this.map.getCenter().lon,zoom:this.map.getZoom()};if(id&&type){jQuery.extend(params,{id:id,searchType:type});}
if(pin){var pinLonLat=new OpenLayers.LonLat(pin.lon,pin.lat).transform(new OpenLayers.Projection(pin.proj),this.map.projection);jQuery.extend(params,{pinLon:pinLonLat.lon,pinLat:pinLonLat.lat});}
var paramList=[];jQuery.each(params,function(k,v){paramList.push([k,v].join("="));});var queryParams=paramList.join("&");DDI.Dialog.openDialog(DDI.contextPath+"/mapsms/?"+queryParams);};MapView.SEARCH_ACTIONS={'all':'','address':'ADDRESS','company':'COMPANY','people':'PEOPLE','activity':'ACTIVITY','clubsandorgs':'CLUBSANDORGS','public_info':'PUBLIC_INFO','group':''};MapView.SEARCH_RESULTS_FEATURE_GROUP_NAME="_searchResults";MapView.MAP_ITEM_FEATURE_GROUP_NAME="_mapItem";})(jQuery);