(function(a){function d(){a.fn.ajaxSubmit.debug&&window.console&&window.console.log&&window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""))}a.fn.ajaxSubmit=function(b){function c(){function n(){if(!z++){o.detachEvent?o.detachEvent("onload",n):o.removeEventListener("load",n,false);var s=0,m=true;try{if(A)throw"timeout";var t,p;p=o.contentWindow?o.contentWindow.document:o.contentDocument?o.contentDocument:o.document;if(p.body==null&&!s&&a.browser.opera){s=1;z--;setTimeout(n,100);
return}l.responseText=p.body?p.body.innerHTML:null;l.responseXML=p.XMLDocument?p.XMLDocument:p;l.getResponseHeader=function(D){return{"content-type":k.dataType}[D]};if(k.dataType=="json"||k.dataType=="script"){var B=p.getElementsByTagName("textarea")[0];l.responseText=B?B.value:l.responseText}else if(k.dataType=="xml"&&!l.responseXML&&l.responseText!=null)l.responseXML=x(l.responseText);t=a.httpData(l,k.dataType)}catch(E){m=false;a.handleError(k,l,"error",E)}if(m){k.success(t,"success");u&&a.event.trigger("ajaxSuccess",
[l,k])}u&&a.event.trigger("ajaxComplete",[l,k]);u&&!--a.active&&a.event.trigger("ajaxStop");if(k.complete)k.complete(l,m?"success":"error");setTimeout(function(){v.remove();l.responseXML=null},100)}}function x(s,m){if(window.ActiveXObject){m=new ActiveXObject("Microsoft.XMLDOM");m.async="false";m.loadXML(s)}else m=(new DOMParser).parseFromString(s,"text/xml");return m&&m.documentElement&&m.documentElement.tagName!="parsererror"?m:null}var q=h[0];if(a(":input[name=submit]",q).length)alert('Error: Form elements must not be named "submit".');
else{var k=a.extend({},a.ajaxSettings,b),r=jQuery.extend(true,{},a.extend(true,{},a.ajaxSettings),k),y="jqFormIO"+(new Date).getTime(),v=a('<iframe id="'+y+'" name="'+y+'" />'),o=v[0];if(a.browser.msie||a.browser.opera)o.src='javascript:false;document.write("");';v.css({position:"absolute",top:"-1000px",left:"-1000px"});var l={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=
1;v.attr("src","about:blank")}},u=k.global;u&&!a.active++&&a.event.trigger("ajaxStart");u&&a.event.trigger("ajaxSend",[l,k]);if(r.beforeSend&&r.beforeSend(l,r)===false)r.global&&jQuery.active--;else if(!l.aborted){var z=0,A=0;if(r=q.clk){var C=r.name;if(C&&!r.disabled){b.extraData=b.extraData||{};b.extraData[C]=r.value;if(r.type=="image"){b.extraData[name+".x"]=q.clk_x;b.extraData[name+".y"]=q.clk_y}}}setTimeout(function(){var s=h.attr("target"),m=h.attr("action");h.attr({target:y,method:"POST",action:k.url});
b.skipEncodingOverride||h.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});k.timeout&&setTimeout(function(){A=true;n()},k.timeout);var t=[];try{if(b.extraData)for(var p in b.extraData)t.push(a('<input type="hidden" name="'+p+'" value="'+b.extraData[p]+'" />').appendTo(q)[0]);v.appendTo("body");o.attachEvent?o.attachEvent("onload",n):o.addEventListener("load",n,false);q.submit()}finally{h.attr("action",m);s?h.attr("target",s):h.removeAttr("target");a(t).remove()}},10)}}}if(!this.length){d("ajaxSubmit: skipping submit process - no element selected");
return this}if(typeof b=="function")b={success:b};b=a.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},b||{});var e={};this.trigger("form-pre-serialize",[this,b,e]);if(e.veto){d("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(b.beforeSerialize&&b.beforeSerialize(this,b)===false){d("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var f=this.formToArray(b.semantic);if(b.data){b.extraData=b.data;for(var g in b.data)if(b.data[g]instanceof
Array)for(var j in b.data[g])f.push({name:g,value:b.data[g][j]});else f.push({name:g,value:b.data[g]})}if(b.beforeSubmit&&b.beforeSubmit(f,this,b)===false){d("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[f,this,b,e]);if(e.veto){d("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}e=a.param(f);if(b.type.toUpperCase()=="GET"){b.url+=(b.url.indexOf("?")>=0?"&":"?")+e;b.data=null}else b.data=e;var h=this,i=[];b.resetForm&&
i.push(function(){h.resetForm()});b.clearForm&&i.push(function(){h.clearForm()});if(!b.dataType&&b.target){var w=b.success||function(){};i.push(function(n){a(b.target).html(n).each(w,arguments)})}else b.success&&i.push(b.success);b.success=function(n,x){for(var q=0,k=i.length;q<k;q++)i[q].apply(b,[n,x,h])};e=a("input:file",this).fieldValue();f=false;for(g=0;g<e.length;g++)if(e[g])f=true;if(b.iframe||f)a.browser.safari&&b.closeKeepAlive?a.get(b.closeKeepAlive,c):c();else a.ajax(b);this.trigger("form-submit-notify",
[this,b]);return this};a.fn.ajaxForm=function(b){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){a(this).ajaxSubmit(b);return false}).each(function(){a(":submit,input:image",this).bind("click.form-plugin",function(c){var e=this.form;e.clk=this;if(this.type=="image")if(c.offsetX!=undefined){e.clk_x=c.offsetX;e.clk_y=c.offsetY}else if(typeof a.fn.offset=="function"){var f=a(this).offset();e.clk_x=c.pageX-f.left;e.clk_y=c.pageY-f.top}else{e.clk_x=c.pageX-this.offsetLeft;e.clk_y=c.pageY-
this.offsetTop}setTimeout(function(){e.clk=e.clk_x=e.clk_y=null},10)})})};a.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){a(":submit,input:image",this).unbind("click.form-plugin")})};a.fn.formToArray=function(b){var c=[];if(this.length==0)return c;var e=this[0],f=b?e.getElementsByTagName("*"):e.elements;if(!f)return c;for(var g=0,j=f.length;g<j;g++){var h=f[g],i=h.name;if(i)if(b&&e.clk&&h.type=="image")!h.disabled&&e.clk==h&&c.push({name:i+".x",value:e.clk_x},
{name:i+".y",value:e.clk_y});else if((h=a.fieldValue(h,true))&&h.constructor==Array)for(var w=0,n=h.length;w<n;w++)c.push({name:i,value:h[w]});else h!==null&&typeof h!="undefined"&&c.push({name:i,value:h})}if(!b&&e.clk){b=e.getElementsByTagName("input");g=0;for(j=b.length;g<j;g++){f=b[g];(i=f.name)&&!f.disabled&&f.type=="image"&&e.clk==f&&c.push({name:i+".x",value:e.clk_x},{name:i+".y",value:e.clk_y})}}return c};a.fn.formSerialize=function(b){return a.param(this.formToArray(b))};a.fn.fieldSerialize=
function(b){var c=[];this.each(function(){var e=this.name;if(e){var f=a.fieldValue(this,b);if(f&&f.constructor==Array)for(var g=0,j=f.length;g<j;g++)c.push({name:e,value:f[g]});else f!==null&&typeof f!="undefined"&&c.push({name:this.name,value:f})}});return a.param(c)};a.fn.fieldValue=function(b){for(var c=[],e=0,f=this.length;e<f;e++){var g=a.fieldValue(this[e],b);g===null||typeof g=="undefined"||g.constructor==Array&&!g.length||(g.constructor==Array?a.merge(c,g):c.push(g))}return c};a.fieldValue=
function(b,c){var e=b.name,f=b.type,g=b.tagName.toLowerCase();if(typeof c=="undefined")c=true;if(c&&(!e||b.disabled||f=="reset"||f=="button"||(f=="checkbox"||f=="radio")&&!b.checked||(f=="submit"||f=="image")&&b.form&&b.form.clk!=b||g=="select"&&b.selectedIndex==-1))return null;if(g=="select"){var j=b.selectedIndex;if(j<0)return null;e=[];g=b.options;var h=(f=f=="select-one")?j+1:g.length;for(j=f?j:0;j<h;j++){var i=g[j];if(i.selected){i=a.browser.msie&&!i.attributes.value.specified?i.text:i.value;
if(f)return i;e.push(i)}}return e}return b.value};a.fn.clearForm=function(){return this.each(function(){a("input,select,textarea",this).clearFields()})};a.fn.clearFields=a.fn.clearInputs=function(){return this.each(function(){var b=this.type,c=this.tagName.toLowerCase();if(b=="text"||b=="password"||c=="textarea")this.value="";else if(b=="checkbox"||b=="radio")this.checked=false;else if(c=="select")this.selectedIndex=-1})};a.fn.resetForm=function(){return this.each(function(){if(typeof this.reset==
"function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};a.fn.enable=function(b){if(b==undefined)b=true;return this.each(function(){this.disabled=!b})};a.fn.selected=function(b){if(b==undefined)b=true;return this.each(function(){var c=this.type;if(c=="checkbox"||c=="radio")this.checked=b;else if(this.tagName.toLowerCase()=="option"){c=a(this).parent("select");b&&c[0]&&c[0].type=="select-one"&&c.find("option").selected(false);this.selected=b}})}})(jQuery);
(function(a){a.fn.textChildren=function(d,b){if(typeof d=="object"){b=d;d="all"}var c=a.extend({},a.fn.textChildren.defaults,b||{}),e=c.outputType=="string"?"":[],f="";this.each(function(){var g=d,j=a.grep(this.childNodes,function(h){return h.nodeType==3});if(d=="first")g=0;else if(d=="last")g=j.length-1;else if(d<0)g=j.length+d;if(!(g>=j.length||g<0))if(d==undefined||d=="all")for(g=0;g<j.length;g++){f=c.trim?a.trim(j[g].nodeValue):j[g].nodeValue;if(c.outputType=="array")e.length&&f==""||e.push(f);
else e+=e==""?f:c.stringDelimiter+f}else{f=c.trim?a.trim(j[g].nodeValue):j[g].nodeValue;if(c.outputType=="array")e.push(f);else e+=e==""?f:c.stringDelimiter+f}});return e};a.fn.textChildren.defaults={outputType:"string",stringDelimiter:"",trim:true}})(jQuery);
(function(a){var d;a.signin=function(b){d===undefined&&a.setSecurityCallbacks();var c=a.extend({success:function(){},error:function(){},statusTarget:"#userStatus"},b||{});b=a("#loginDialog").attr("signinUrl");a.ajax({type:"GET",dataType:"html",url:b,async:false,success:function(){c.success()},error:function(e){if(e.status==401||e.status==403)if(d.beforeSignin()){e=e.responseText;var f=a(e).is("#loginContent.modules-bikemapLogin-facebookConnect")?540:275,g=a(e).is("#loginContent.modules-bikemapLogin-facebookConnect")?
313:115;a("#loginDialog").dialog({autoOpen:false,open:function(){a("input[id=signin_username]").focus()},bgiframe:true,modal:true,resizable:false,width:f,height:g});a("#loginDialog").html(e);setupEventHandling(c);e=a(window).width()/2-f/2;a("#loginDialog").dialog("option","position",[e,200]).dialog("option","close",function(){c.error()}).dialog("open")}}})};a.signout=function(b){d===undefined&&a.setSecurityCallbacks();var c=a.extend({success:function(){},facebook:false,statusTarget:"#userStatus"},
b||{});if(d.beforeSignout())if(c.facebook===true)typeof FB!=="undefined"&&FB.Connect.logout(function(){doLogout(c)});else doLogout(c)};a.setSecurityCallbacks=function(b){d=a.extend({beforeSignin:function(){return true},afterSignin:function(){},beforeSignout:function(){return true},afterSignout:function(){}},b||{})};a.fn.secureAjaxSubmit=function(){var b=a(this).filter("form");a(b).disableControls();a.signin({success:function(){return a(b).each(function(){return a(this).ajaxSubmit({target:a(this).closest(".ajaxTarget")})})},
error:function(){a(b).enableControls()}})};a.fn.secureSubmit=function(){var b=a(this).filter("form");a(b).disableControls();a.signin({success:function(){a(b)[0].submit()},error:function(){a(b).enableControls()}})};setupEventHandling=function(b){a("#loginDialog #bikemapForm").bind("submit",b,onBikemapLoginSubmit);a("#loginDialog #facebookForm").bind("submit",b,onFacebookConnect)};onBikemapLoginSubmit=function(b){b.preventDefault();doSubmit(this,b.data)};onFacebookConnect=function(b){b.preventDefault();
form=this;typeof FB!=="undefined"?FB.Connect.requireSession(function(){var c=FB.Facebook.apiClient.get_session().session_key;a(form).find("input[id=connect_session_key]").val(c);doSubmit(form,b.data)},true):alert("Cannot connect to Facebook because the Facebook Javascript library could not be loaded (Facebook might be blocked by your organisation)")};doSubmit=function(b,c){csrfForms=getCSRFProtectedForms();a(b).ajaxSubmit({data:{csrfTokensForForms:csrfForms},beforeSend:function(){a("#loginDialog :input").attr("disabled",
"disabled");a("#loginDialog :button").attr("disabled","disabled");a("#loginDialog #facebookConnectBtn").attr("src","/sfPublicSpacesPlugin/images/connect_grey_medium_long.gif");a("#loginDialog .disabledPane").show()},complete:function(e,f){if(f==="success"){a(c.statusTarget).html(e.responseText);var g=e.getResponseHeader("X-JSON");if(g!==null){g=window.eval("("+g+")");replaceCSRFTokens(g)}a("#loginDialog").dialog("option","close",function(){refreshElements();d.afterSignin();c.success()}).dialog("close")}else{a("#loginDialog").html(e.responseText);
setupEventHandling(c)}}})};getCSRFProtectedForms=function(){var b=[];a("form:has(input[id$=__csrf_token])").each(function(){var c=a(this).attr("name");a.inArray(c,b)&&b.push(c)});return b.join("&")};replaceCSRFTokens=function(b){for(var c=0;c<b.length;c+=1)a("."+b[c].form+" input[id$=__csrf_token]").val(b[c].token)};refreshElements=function(){a(".refreshOnUserStatusChange").each(function(){var b=this;a.get(a(b).attr("refreshURL"),function(c){a("body").append('<div id="refreshedContent" class="out"></div>').children(":last").html(c);
var e=a(b).find("*").filter(":visible").textChildren().replace(/\s/g,""),f=a("#refreshedContent").find("*").filter(":visible").textChildren().replace(/\s/g,"");e!=f?a(b).fadeOut("normal",function(){a(b).html(c);a(b).fadeIn("normal")}):a(b).html(c);a("#refreshedContent").remove()})})};doLogout=function(b){a(b.statusTarget).load(a("#signout").attr("href"),function(){refreshElements();d.afterSignout();b.success()})}})(jQuery);
$(function(){typeof FB_RequireFeatures!=="undefined"&&FB_RequireFeatures(["Api"],function(){FB.init(fbApiKey)});$("#signin").live("click",function(a){a.preventDefault();$.signin()});$("#signout").live("click",function(a){a.preventDefault();$.signout()})});
(function(a){var d=[];a.fn.changeLabelWithInputField=function(){var b=a(this).attr("for");a(this).hide();a("#"+b).css("display","block")};a.fn.disableControls=function(){return this.each(function(){a(this).find(":button").attr("disabled","disabled");a(this).find(":input").addClass("disabled");return a(this)})};a.fn.enableControls=function(){return this.each(function(){a(this).find(":button").removeAttr("disabled");a(this).find(":input").removeClass("disabled");return a(this)})};a.fn.storeDefault=
function(){return this.each(function(){if(!d[this.id])d[this.id]=this.value;return a(this)})};a.fn.removeDefault=function(){return this.each(function(){if(this.value==d[this.id])this.value="";a(this).removeClass("default-value-inactive");return a(this)})};a.fn.setDefault=function(){return this.each(function(){if(this.value==""){a(this).addClass("default-value-inactive");this.value=d[this.id]}return a(this)})}})(jQuery);
jQuery(function(){$("input.default-value").storeDefault().addClass("default-value-inactive").live("focus",function(){$(this).removeDefault().blur(function(){$(this).setDefault()})});$(".secureAjaxSubmit").live("submit",function(a){a.preventDefault();$(this).secureAjaxSubmit()});$(".upload").live("click",function(a){a.preventDefault();$(this).changeLabelWithInputField()})});var newPoint=null,warnedAboutZoom=false,geocoder=null;
MapToolkit.MapTypesControl=function(a){var d='<div class="mtk-maptypes-container"><div class="mtk-maptypes-more" onclick="$(\'#mtk-maptypes-more\').toggle();">&nbsp;</div><div id="mtk-maptypes-more" class="mtk-maptypes-more-menu" style="display:none;"><ul><li onclick="$(\'#mtk-maptypes-more\').hide();MapToolkit.MapTypesControl.setMapType(\''+a.div+"', OSM_MAP)\">"+MapToolkit.i18n["maptype: openstreetmap"]+"</li><li onclick=\"$('#mtk-maptypes-more').hide();MapToolkit.MapTypesControl.setMapType('"+
a.div+"', OSM_CYCLE_MAP)\">"+MapToolkit.i18n["maptype: opencyclemap"]+"</li><li onclick=\"$('#mtk-maptypes-more').hide();MapToolkit.MapTypesControl.setMapType('"+a.div+"', G_HYBRID_MAP)\">"+MapToolkit.i18n["maptype: satellite with labels"]+'</li></ul></div><div class="mtk-maptypes-button '+(a.config.map.mapTypes[0]=="G_SATELLITE_MAP"?"mtk-maptypes-active":"mtk-maptypes-inactive")+'" onclick="MapToolkit.MapTypesControl.setMapType(\''+a.div+"', G_SATELLITE_MAP, this)\">"+MapToolkit.i18n["maptype: satellite"]+
'</div><div class="mtk-maptypes-button '+(a.config.map.mapTypes[0]=="G_NORMAL_MAP"?"mtk-maptypes-active":"mtk-maptypes-inactive")+'" onclick="MapToolkit.MapTypesControl.setMapType(\''+a.div+"', G_NORMAL_MAP, this)\">"+MapToolkit.i18n["maptype: map"]+"</div></div>",b='<a href="'+_mtkConfig.widgetUri+'" class="publicspaces-widgetlink">'+_mtkConfig.widgetLink+"</a>";this.initialize=function(c){var e=jQuery(d)[0];c.getContainer().appendChild(e);$EL(e).pngFix&&$EL(e).pngFix();if(_mtkConfig.showWidgetLink){var f=
jQuery(b)[0];c.getContainer().appendChild(f);$EL(f).pngFix&&$EL(f).pngFix()}return e};this.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(30,10))};return this};MapToolkit.MapTypesControl.prototype=new GControl;
MapToolkit.MapTypesControl.setMapType=function(a,d,b){MapToolkit.getMap(a).gmap.setMapType(d);$EACH($CLASS("mtk-maptypes-button"),function(c){if(b==c){$ADD_CLASS(c,"mtk-maptypes-active");$REMOVE_CLASS(c,"mtk-maptypes-inactive")}else{$REMOVE_CLASS(c,"mtk-maptypes-active");$ADD_CLASS(c,"mtk-maptypes-inactive")}})};
var OptionalControl=function(a){var d=new MapToolkit.OptionalControl(a);this.initialize=function(b){return d.initialize(b)};this.categories=d.categories;this.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(180,10))}};OptionalControl.prototype=new GControl;
$(function(){MapToolkit.createMap("map",{nocache:_mtkConfig.nocache,api_key:_mtkConfig.mtkApiKey,map:{useLocationHash:true,size:{offsetBottom:1},location:{lat:_mtkConfig.latitude,lng:_mtkConfig.longitude,zoom:_mtkConfig.zoomLevel},controls:_mtkConfig.mapControls,mapTypes:[_mtkConfig.mapType]},clusters:{threshold:10,style:"detailed",naming:"Eintr\u00e4ge"},menu:"OptionalControl",resources:_mtkConfig.resources,items:_mtkConfig.items,layers:_mtkConfig.layers},function(a){_mtkConfig.centerAtRegion===
true&&$.lookupRegion(a);if(window.location.search.length>1)window.location.hash=window.location.search.substring(1)});$("a.publicspaces-widgetlink").live("click",function(a){a.preventDefault();$.showWidgetDlg(a)});$("a.map-aware").live("click",function(){var a=window.location.hash;if(a.length>1)this.href=this.href+(this.href.indexOf("?")!==-1?"&":"?")+a.substring(1)})});
(function(a){a.fn.ajaxDialog=function(d){var b=this,c=a(b).attr("content"),e=a(b).attr("width")*1,f=a(b).attr("height")*1,g=a(b).attr("resizable")==="true"?true:false,j=a.extend({autoOpen:false,bgiframe:true,modal:true,resizable:g,width:e,height:f},d||{});a.ajax({type:"GET",dataType:"html",url:c,async:false,success:function(h){a(b).dialog(j);a(b).html(h);h=a(window).width()/2-e/2;var i=a(window).height()/2-f/2;a(b).dialog("option","position",[h,i]).dialog("open")}})};a.createOrMoveNewPoint=function(d,
b,c){b!==undefined&&c&&a.checkZoomLevel(d,b);if(newPoint===null){a.fadePoints(d,"slow");newPoint=a.createPoint(d,b,a.getSelectedCategory(),true);a.browser.msie?a(".pointForm input[type=radio]").live("click",function(){newPoint.setImage(a.getIconPath(a.getSelectedCategory()))}):a(".pointForm input[type=radio]").live("change",function(){newPoint.setImage(a.getIconPath(a.getSelectedCategory()))})}else b!==undefined&&newPoint.setPoint(b);a.reverseGeocode(b)};a.createPoint=function(d,b,c,e){var f=_mtkConfig.locationResource==
"biketrap"||_mtkConfig.locationResource=="biketrap_test"?[4,30]:[13,30];c=MapToolkit.Icon.get({image:a.getIconPath(c),iconSize:[25,30],iconAnchor:f,shadow:"/images/icon_shadow.png",shadowSize:[45,30]});marker=new GMarker(b,{draggable:e,clickable:e,icon:c,zIndexProcess:function(){return 1}});e===true&&GEvent.addListener(marker,"dragend",function(g){a.reverseGeocode(g)});d.gmap.addOverlay(marker);return marker};a.getIconPath=function(d){return"/images/icon_category_"+d+".png"};a.fadePoints=function(d,
b){a("."+_mtkConfig.markerClass).fadeTo(b,0.5);a("."+_mtkConfig.markerClass+"-shadow").fadeTo(b,0.2);d.config.resources[_mtkConfig.locationResource].markerClass="semitransparent "+_mtkConfig.markerClass};a.checkZoomLevel=function(d,b){if(warnedAboutZoom===false){if(d.gmap.getZoom()<=_mtkConfig.zoomWarning){var c={};c[zoomWarningOkBtn]=function(){a(this).dialog("close");a.zoomToPoint(d,b)};c[zoomWarningIgnoreBtn]=function(){a(this).dialog("close")};var e=a(window).width()/2-150,f=a(window).height()/
2-75;a("#zoomWarningDialog").dialog({autoOpen:false,bgiframe:true,modal:true,resizable:false,width:300,height:150,position:[e,f],buttons:c});a("#zoomWarningDialog").closest(".ui-dialog").find(".ui-button").eq(1).addClass("button-as-link");a("#zoomWarningDialog").dialog("open")}warnedAboutZoom=true}};a.zoomToPoint=function(d,b){d.gmap.setCenter(b);d.gmap.setZoom(_mtkConfig.zoomWarning+1)};a.getSelectedCategory=function(){return a(".pointForm input[type=radio]:checked").val()};a.showWidgetDlg=function(){a("#widgetDialog").ajaxDialog({open:function(){var d=
_mtkConfig.widgetUri+"#"+window.location.hash;a("#widgetDialog").updateSnippet(d);a("#widgetDialog input.dimensions").focus(function(){a("#widgetDialog #size_custom").attr("checked","checked")});a("#widgetDialog input.dimensions").change(function(){a("#widgetDialog #size_custom").attr("mapWidth",a("#widgetDialog #size_custom_width").val());a("#widgetDialog #size_custom").attr("mapHeight",a("#widgetDialog #size_custom_height").val());a("#widgetDialog").updateSnippet(getCurrentPreviewUri())});a("#widgetDialog input[type=radio]").change(function(){a("#widgetDialog").updateSnippet(getCurrentPreviewUri())})},
buttons:{OK:function(){a(this).dialog("close")}}})};getCurrentPreviewUri=function(){return a("#previewContainer iframe")[0].contentWindow.location.href};a.fn.updateSnippet=function(d){var b=a(this).find("input[type=radio]:checked")[0];a(this).find("#previewContainer iframe");var c=a(this).find("#snippet"),e=a(b).attr("mapWidth")*1;b=a(b).attr("mapHeight")*1;d='<div style="width:'+e+'px; margin:2px 0px !important; padding: 1px !important; border:1px solid #999999 !important; font-size:10px !important; color:#999999 !important; text-align: right !important; font-family:Arial,Verdana,Helvetica,sans-serif !important;"><iframe src="'+
d+'" style="width:'+e+"px; height:"+b+'px; border:0px"></iframe><br />'+_mtkConfig.widgetText+'<a href="'+_mtkConfig.widgetHref+'">'+_mtkConfig.widgetHrefText+" "+_mtkConfig.widgetTagline+"</a>. </div>";a(c).val(d);a("#previewContainer").html(d)};a.lookupRegion=function(d){if(geocoder===null)geocoder=new GClientGeocoder;geocoder.getLocations(_mtkConfig.region,function(b){b=getPlace(b);var c=getLatLngBox(b);b=c.getCenter();c=d.gmap.getBoundsZoomLevel(c);d.gmap.setCenter(b,c)})};a.lookupStreet=function(d){var b=
a(".pointForm #point_street");a(b).hasClass("default-value-inactive")||a(b).val()===""||(newPoint===null?a.reverseGeocode(d.gmap.getCenter(),function(){doLookupStreet(d)}):doLookupStreet(d))};doLookupStreet=function(d){var b=a(".pointForm #point_street").val();b=b.indexOf(",")==-1?a(".pointForm #point_street").val()+", "+a(".pointForm #point_city").val()+", "+a(".pointForm #point_zip").val()+", "+a(".pointForm #point_county").val()+", "+a(".pointForm #point_country").val():b;if(geocoder===null)geocoder=
new GClientGeocoder;geocoder.getLocations(b,function(c){var e=getPlace(c);c=getCountry(e);getState(c);getCounty(c);c=getCity(c);getZip(c);c=getStreet(c);if(e!==undefined){var f=getLatLngBox(e);e=f.getCenter();f=d.gmap.getBoundsZoomLevel(f);d.gmap.setCenter(e,f);a.createOrMoveNewPoint(d,e,false);c!==undefined&&a(".pointForm #point_street").val(c.ThoroughfareName)}})};a.reverseGeocode=function(d,b){if(d){a(".pointForm #point_longitude").val(d.lng());a(".pointForm #point_latitude").val(d.lat());if(geocoder===
null)geocoder=new GClientGeocoder;geocoder.getLocations(d,function(c){c=getPlace(c);c=getCountry(c);var e=getState(c),f=getCounty(c),g=getCity(c),j=getZip(g),h=getStreet(g),i=a(".pointForm #point_street");if(i[0].getAttribute("changed")===null||i[0].getAttribute("changed")==="false"){i.removeDefault();i.val(h!==undefined?h.ThoroughfareName:"")}a(".pointForm #point_zip").val(j!==undefined?j.PostalCodeNumber:"");a(".pointForm #point_city").val(g!==undefined?g.LocalityName:"");a(".pointForm #point_county").val(f!==
undefined?f.SubAdministrativeAreaName:"");a(".pointForm #point_state").val(e!==undefined?e.AdministrativeAreaName:"");a(".pointForm #point_countryname").val(c!==undefined?c.CountryName:"");a(".pointForm #point_country").val(c!==undefined?c.CountryNameCode:"");b&&b()})}};getPlace=function(d){return d.Placemark!==undefined?d.Placemark[0]:undefined};getLatLngBox=function(d){if(d!==undefined){d=d.ExtendedData.LatLonBox;return new GLatLngBounds(new GLatLng(d.south,d.west),new GLatLng(d.north,d.east))}};
getCountry=function(d){return d!==undefined?d.AddressDetails.Country:undefined};getState=function(d){return d!==undefined?d.AdministrativeArea:undefined};getCounty=function(d){if(d!==undefined)return d.AdministrativeArea?d.AdministrativeArea.SubAdministrativeArea:d.SubAdministrativeArea};getCity=function(d){if(d!==undefined){var b=getCounty(d);d=getState(d);return b!==undefined?b.Locality:d.Locality}};getZip=function(d){if(d!==undefined)return d.DependentLocality!==undefined?d.DependentLocality.PostalCode:
d.PostalCode};getStreet=function(d){if(d!==undefined)return d.DependentLocality!==undefined?d.DependentLocality.Thoroughfare:d.Thoroughfare}})(jQuery);$(function(){$(".pagination a").live("click",function(a){a.preventDefault();$("#categoryPoints").load($(this).attr("href"))})});
