var GeoMashup,customizeGeoMashup,customizeGeoMashupMap,customGeoMashupColorIcon,customGeoMashupCategoryIcon,customGeoMashupSinglePostIcon,customGeoMashupMultiplePostImage;GeoMashup={opts:{},actions:{},objects:{},object_count:0,locations:{},open_attachments:[],errors:[],color_names:["red","lime","blue","orange","yellow","aqua","green","silver","maroon","olive","navy","purple","gray","teal","fuchsia","white","black"],colors:{red:"#ff071e",lime:"#62d962",blue:"#9595ff",orange:"#fe8f00",yellow:"#f2f261",aqua:"#8eeff0",green:"#459234",silver:"#c2c2c2",maroon:"#ae1a40",olive:"#9f9b46",navy:"#30389d",purple:"#a54086",gray:"#9b9b9b",teal:"#13957b",fuchsia:"#e550e5",white:"#ffffff",black:"#000000"},firstLoad:true,clone:function(obj){var ClonedObject=function(){};ClonedObject.prototype=obj;return new ClonedObject},forEach:function(obj,callback){var key;for(key in obj){if(obj.hasOwnProperty(key)&&typeof obj[key]!=="function"){callback.apply(this,[key,obj[key]])}}},locationCache:function(latlng,key){if(!this.locations.hasOwnProperty(latlng)){return false}if(!this.locations[latlng].cache){this.locations[latlng].cache={}}if(!this.locations[latlng].cache.hasOwnProperty(key)){this.locations[latlng].cache[key]={}}return this.locations[latlng].cache[key]},addAction:function(name,callback){if(typeof callback!=="function"){return false}if(typeof this.actions[name]!=="object"){this.actions[name]=[callback]}else{this.actions[name].push(callback)}return true},doAction:function(name){var args,i;if(typeof this.actions[name]!=="object"){return false}args=Array.prototype.slice.apply(arguments,[1]);for(i=0;i<this.actions[name].length;i+=1){if(typeof this.actions[name][i]==="function"){this.actions[name][i].apply(null,args)}}return true},parentScrollToGeoPost:function(){var geo_post;if(this.have_parent_access){geo_post=parent.document.getElementById("gm-post");if(geo_post){parent.focus();parent.scrollTo(geo_post.offsetLeft,geo_post.offsetTop)}}return false},getShowPostElement:function(){if(this.have_parent_access&&!this.show_post_element&&this.opts.name){this.show_post_element=parent.document.getElementById(this.opts.name+"-post")}if(this.have_parent_access&&!this.show_post_element){this.show_post_element=parent.document.getElementById("gm-post")}return this.show_post_element},parentizeLinksMarkup:function(markup){var container=document.createElement("div");container.innerHTML=markup;this.parentizeLinks(container);return container.innerHTML},parentizeLinks:function(node){var i,links=node.getElementsByTagName("a");if(parent){for(i=0;i<links.length;i+=1){if(links[i].target.length===0||links[i].target==="_self"){links[i].target="_parent"}}}},showLoadingIcon:function(){if(!this.spinner_div.parentNode){this.container.appendChild(this.spinner_div)}},hideLoadingIcon:function(){if(this.spinner_div.parentNode){this.spinner_div.parentNode.removeChild(this.spinner_div)}},getObjectsAtLocation:function(point){return this.locations[point].objects},getMarkerObjects:function(marker){return this.getObjectsAtLocation(this.getMarkerLatLng(marker))},getMarkerLatLng:function(marker){},addGlowMarker:function(marker){},openInfoWindow:function(marker){},closeInfoWindow:function(marker){},removeGlowMarker:function(){},hideAttachments:function(){},showMarkerAttachments:function(marker){},loadFullPost:function(point){},selectMarker:function(marker){var point=this.getMarkerLatLng(marker);this.selected_marker=marker;if(this.opts.marker_select_info_window){this.openInfoWindow(marker)}if(this.opts.marker_select_attachments){this.showMarkerAttachments(marker)}if(this.opts.marker_select_highlight){this.addGlowMarker(marker)}if(this.opts.marker_select_center){this.centerMarker(marker)}if("full-post"!==this.opts.template&&this.getShowPostElement()){this.loadFullPost(point)}this.doAction("selectedMarker",this.opts,this.selected_marker,this.map)},centerMarker:function(marker,zoom){},deselectMarker:function(){var i,post_element=GeoMashup.getShowPostElement();if(post_element){post_element.innerHTML=""}if(this.glow_marker){this.removeGlowMarker()}if(this.selected_marker){this.closeInfoWindow(this.selected_marker)}this.hideAttachments();this.selected_marker=null},addObjectIcon:function(obj){},createMarker:function(point,obj){var marker;return marker},checkDependencies:function(){},clickObjectMarker:function(object_id,try_count){},clickMarker:function(object_id,try_count){this.clickObjectMarker(object_id,try_count)},getCategoryName:function(category_id){if(!this.opts.term_properties.hasOwnProperty("category")){return null}return this.opts.term_properties.category[category_id]},hideMarker:function(marker){},showMarker:function(marker){},hideLine:function(line){},showLine:function(line){},isLineVisible:function(line){},newLatLng:function(lat,lng){var latlng;return latlng},extendLocationBounds:function(){},addMarkers:function(){},makeMarkerMultiple:function(marker){},setMarkerImage:function(marker,image_url){},autoZoom:function(){},recluster:function(){},updateMarkerVisibilities:function(){this.forEach(this.locations,function(point,loc){GeoMashup.updateMarkerVisibility(loc.marker,point)});this.updateVisibleList()},updateMarkerVisibility:function(marker){if(this.isMarkerOn(marker)){this.showMarker(marker)}else{this.hideMarker(marker)}},isMarkerOn:function(marker){var i,objects,visible_object_indices=[],filter={visible:false};objects=this.getMarkerObjects(marker);for(i=0;i<objects.length;i+=1){if(this.isObjectOn(objects[i])){filter.visible=true;visible_object_indices.push(i)}}if(filter.visible){if(objects.length>1){if(visible_object_indices.length===1){GeoMashup.setMarkerImage(marker,objects[visible_object_indices[0]].icon.image)}else{GeoMashup.makeMarkerMultiple(marker)}}else if(objects[0].combined_term_count>1){if(objects[0].visible_term_count===1){jQuery.each(objects[0].visible_terms,function(taxonomy,term_ids){if(term_ids.length===1){GeoMashup.setMarkerImage(marker,GeoMashup.term_manager.getTermData(taxonomy,term_ids[0],"icon").image)}})}else{GeoMashup.setMarkerImage(marker,objects[0].icon.image)}}}this.doAction("markerVisibilityOptions",this.opts,filter,marker,this.map);return filter.visible},isObjectOn:function(obj){var filter={visible:false};obj.visible_terms={};obj.visible_term_count=0;if(!GeoMashup.term_manager||0===obj.combined_term_count){filter.visible=true}else{jQuery.each(obj.terms,function(taxonomy,term_ids){obj.visible_terms[taxonomy]=[];jQuery.each(term_ids,function(i,term_id){if(GeoMashup.term_manager.getTermData(taxonomy,term_id,"visible")){obj.visible_terms[taxonomy].push(term_id);obj.visible_term_count+=1;filter.visible=true}})})}this.doAction("objectVisibilityOptions",this.opts,filter,obj,this.map);return filter.visible},getOnObjectIDs:function(objects){var i,object_ids=[];for(i=0;i<objects.length;i+=1){if(this.isObjectOn(objects[i])){object_ids.push(objects[i].object_id)}}return object_ids},addObjects:function(response_data,add_term_info){var i,k,object_id,point,taxonomy,term_ids,term_id,marker,plus_image,added_markers=[];if(add_term_info&&this.term_manager){this.term_manager.reset()}for(i=0;i<response_data.length;i+=1){object_id=response_data[i].object_id;point=this.newLatLng(parseFloat(response_data[i].lat),parseFloat(response_data[i].lng));response_data[i].categories=[];response_data[i].combined_term_count=0;if(this.term_manager){for(taxonomy in response_data[i].terms){if(response_data[i].terms.hasOwnProperty(taxonomy)&&typeof taxonomy!=="function"){term_ids=response_data[i].terms[taxonomy];for(k=0;k<term_ids.length;k+=1){GeoMashup.term_manager.extendTerm(point,taxonomy,term_ids[k],response_data[i])}response_data[i].combined_term_count+=term_ids.length;if("category"===taxonomy){response_data[i].categories=term_ids}}}}if(this.opts.max_posts&&this.object_count>=this.opts.max_posts){break}if(!this.objects[object_id]){this.objects[object_id]=response_data[i];this.object_count+=1;if(!this.locations[point]){this.extendLocationBounds(point);this.locations[point]={objects:[response_data[i]],loaded_content:{}};marker=this.createMarker(point,response_data[i]);this.objects[object_id].marker=marker;this.locations[point].marker=marker;added_markers.push(marker)}else{this.locations[point].objects.push(response_data[i]);marker=this.locations[point].marker;this.makeMarkerMultiple(marker);this.objects[object_id].marker=marker;this.addObjectIcon(this.objects[object_id])}}}this.addMarkers(added_markers);if(this.term_manager){this.term_manager.populateTermElements()}if(this.firstLoad){this.firstLoad=false;if(this.opts.auto_info_open&&this.object_count>0){if(!this.opts.open_object_id){if(this.opts.context_object_id&&this.objects[this.opts.context_object_id]){this.opts.open_object_id=this.opts.context_object_id}else{this.opts.open_object_id=response_data[0].object_id}}this.clickObjectMarker(this.opts.open_object_id)}if(this.opts.zoom==="auto"){this.autoZoom()}else{if(this.opts.context_object_id&&this.objects[this.opts.context_object_id]){this.centerMarker(this.objects[this.opts.context_object_id].marker,parseInt(this.opts.zoom,10))}this.updateVisibleList()}}},requestObjects:function(use_bounds){},hideMarkers:function(){var point;for(point in this.locations){if(this.locations.hasOwnProperty(point)&&this.locations[point].marker){this.hideMarker(this.locations[point].marker)}}this.recluster();this.updateVisibleList()},showMarkers:function(){jQuery.each(this.locations,function(point,location){if(GeoMashup.isMarkerOn(location.marker)){GeoMashup.showMarker(location.marker)}});this.recluster();this.updateVisibleList()},adjustZoom:function(){var old_level,new_level;new_level=this.map.getZoom();if(typeof this.last_zoom_level==="undefined"){this.last_zoom_level=new_level}old_level=this.last_zoom_level;if(this.term_manager){this.term_manager.updateLineZoom(old_level,new_level)}if(this.clusterer&&"google"===this.opts.map_api){if(old_level<=this.opts.cluster_max_zoom&&new_level>this.opts.cluster_max_zoom){this.clusterer.clusteringEnabled=false;this.clusterer.refresh(true)}else if(old_level>this.opts.cluster_max_zoom&&new_level<=this.opts.cluster_max_zoom){this.clusterer.clusteringEnabled=true;this.clusterer.refresh(true)}}this.last_zoom_level=new_level},objectLinkHtml:function(object_id){return['<a href="#',this.opts.name,'" onclick="frames[\'',this.opts.name,"'].GeoMashup.clickObjectMarker(",object_id,');">',this.objects[object_id].title,"</a>"].join("")},isMarkerVisible:function(marker){return false},updateVisibleList:function(){var list_element,header_element,list_html,list_items,list_titles,list_count=0;if(this.have_parent_access&&this.opts.name){header_element=parent.document.getElementById(this.opts.name+"-visible-list-header");list_element=parent.document.getElementById(this.opts.name+"-visible-list")}if(header_element){header_element.style.display="block"}if(list_element){list_html=['<ul class="gm-visible-list">'];list_items=[];list_titles=[];this.forEach(this.objects,function(object_id,obj){if(this.isObjectOn(obj)&&this.isMarkerVisible(obj.marker)){var list_item=[];list_item.push('<li><img src="');list_item.push(obj.icon.image);list_item.push('" alt="');list_item.push(obj.title);list_item.push('" />');list_item.push(this.objectLinkHtml(object_id));list_item.push("</li>");list_count+=1;list_items[obj.title]=list_item.join("");list_titles.push(obj.title)}});list_titles.sort();var list_merged="";list_titles.forEach(function(index,title){list_merged+=list_items[index]});list_html.push(list_merged);list_html.push("</ul>");list_element.innerHTML=list_html.join("");this.doAction("updatedVisibleList",this.opts,list_count)}},adjustViewport:function(){this.updateVisibleList()},createMap:function(container,opts){}};
