var selection_element_frame=null;var selection_element_content=null;function selection_frame_updateHeight(){frame_update_height(selection_element_frame)}jQuery.fx.addTickListener(["selection_woning_content","selection_options"],selection_frame_updateHeight);(function(a){a.fn.selection_slideDown=function(){a(this).slideDown()};a.fn.selection_slideUp=function(){a(this).slideUp()}})(jQuery);var selection_frame=null;var selection_frame_options=null;function selection_parse_options(h){var c=false;if(h=="clear"){if(!selection_frame_options){return}c=true}var d=selection_frame.find("#selection_woning_content");if(c){$("#selection_pogingwoning_counter").html("");$("#selection_woning_counter").html("");d.find("span.span_counter").html("");$("#selection_autokraak_counter").html("")}else{if(selection_frame_options==null){selection_frame_options=new Array();if(h.a){$("#selection_auto_label").addClass("preventievideo").attr("videoid",h.a[0].v).click(function(){frame_create("/preventievideo/"+$(this).attr("videoid")+"/",true,{reuse:true,name:"preventie_video_"+$(this).attr("videoid")});return false})}for(var j=0;j<h.w.l.length;j++){var n=h.w.l[j];if(n.i!=25){var e="selection_checkbox_"+n.i;var f="";n.n="<nobr>"+n.n+"</nobr>";if(n.v){n.n='<span class="preventievideo" title="Bekijk preventiefilm...">'+n.n+"</span>"}var m=$('<div class="selection_row"><input type="checkbox" id="'+e+'" checked /><div class="label"><label for="'+e+'">'+n.n+f+'<span id="'+e+'_counter" class="span_counter"></span></label></div></div>');checkbox_update(m);m.appendTo(d);if(n.v){m.find(".preventievideo").attr("videoid",n.v).click(function(){frame_create("/preventievideo/"+$(this).attr("videoid")+"/",true,{reuse:true,name:"preventie_video_"+$(this).attr("videoid")});return false})}m.find(".dynamiccheckbox, input").click(selection_update_selection);m.find("input").change(selection_update_selection)}}}var l=h.w.l;var k=0;var b=0;for(var j=0;j<l.length;j++){var n=l[j];var e="selection_checkbox_"+n.i;var a=$("#"+e+"_counter");a.html("&nbsp;("+n.c+")");if(n.c){if(n.i==25){k+=n.c}else{b+=n.c}}}$("#selection_pogingwoning_counter").html("&nbsp;("+k+")");$("#selection_woning_counter").html("&nbsp;("+b+")");var g=h.a?h.a[0].c:0;if(g){g=parseInt(g)}else{g=0}selection_autokraak_ID=h.a[0].i;$("#selection_autokraak_counter").html("&nbsp;("+g+")")}selection_frame.css("display","block").animate({opacity:1},"slow")}var selection_autokraak_ID=-1;var selection_current=null;var selection_update_timer=null;var selection_enabled_methods=null;function selection_update_selection(){var a="";selection_enabled_methods=new Array();selection_frame.find("input").each(function(){var b=$(this).attr("id");if(b=="selection_auto"){b=selection_autokraak_ID}else{if(b=="selection_pogingwoning"){b=25}else{if(b=="selection_woning"){return}else{b=b.replace(/selection_checkbox_/,"")}}}if($(this).attr("checked")){selection_enabled_methods[b]=true}else{selection_enabled_methods[b]=false}if($(this).attr("checked")){if(a){a+=","}a+=b}});if(selection_current!=a){if(selection_update_timer){clearTimeout(selection_update_timer);selection_update_timer=null}selection_update_timer=setTimeout("selection_update_selection_delayed();",100);selection_current=a}}function map_goto_anchor(c,d,b){var a=selection_get_markerDataByID(c);map.setZoom(20);if(a){map.setCenter(new google.maps.LatLng(a.lat,a.lng))}else{map.setCenter(new google.maps.LatLng(d,b))}}var marker_data_response=null;function selection_get_markerDataByID(b){if(!marker_data_response){return false}var a=null;jQuery.each(marker_data_response.m,function(d){var c=marker_data_response.m[d];if(c.ID==b){a=c}});return a}function selection_update_selection_delayed(){selection_update_timer=null;if(markerCluster){markerCluster.clearMarkers();markerCluster=null}if(map_active_infowindow){map_active_infowindow.close();map_active_infowindow=null}var d=90;var f=-90;var a=180;var b=-180;var g=Array();var e=null;jQuery.each(marker_data_response.n,function(h){var j=marker_data_response.n[h];notifications_show(j.id,j.t,j.ti,j.l,j.c,j.ttl)});marker_data_response.n=null;jQuery.each(marker_data_response.m,function(n){var j=marker_data_response.m[n];var h=false;if(!selection_enabled_methods){h=true}else{h=selection_enabled_methods[j.im]}if(h){var q=j.lat;var l=j.lng;var r=j.ID;var o=new google.maps.LatLng(q,l);if(!e){e=new google.maps.LatLngBounds(o)}else{e.extend(o)}if(q<d){d=q}if(q>f){f=q}if(l<a){a=l}if(l>b){b=l}var k=newMarker(new google.maps.LatLng(q,l),r,j.imt,j.dos,j.im);g.push(k)}});if(marker_data_response.idv){map.setCenter(new google.maps.LatLng(52.07599205363387,5.110392751074206));map.setZoom(12)}else{if(e){map.fitBounds(e);map.setZoom(map.getZoom()-1)}}marker_data_response.idv=false;marker_data_response.disableZoom=true;var c={gridSize:40,zoomOnClick:false,averageCenter:true,styles:[{url:"/wp-content/themes/stopdecriminaliteit/images/icons/map_cluster_35.png",height:35,width:35,opt_textColor:"white"},{url:"/wp-content/themes/stopdecriminaliteit/images/icons/map_cluster_45.png",height:45,width:45,opt_textColor:"white"},{url:"/wp-content/themes/stopdecriminaliteit/images/icons/map_cluster_55.png",height:55,width:55,opt_textColor:"white"}]};markerCluster=new MarkerClusterer(map,g,c);google.maps.event.addListener(markerCluster,"clusterclick",function(G){var k=false;if(map.getZoom()<20){var B=G.markers_.length;var r=true;var p=0;for(var F=0;F<B&&r;F++){var u=G.markers_[F];for(var D=0;D<B&&r;D++){if(F!=D){p++;var q=G.markers_[D];if(!q.getPosition().equals(u.getPosition())){r=false}}}}if(r){k=true;map.panTo(G.getCenter());map.setZoom(20)}}if(map.getZoom()>=20&&!k){var h=0;var H=0;var C=G.markers_.slice(0);var K={closeClusterMarker:null,markers:Array()};for(var F=0;F<C.length;F++){var u=C[F];markerCluster.removeMarker(u)}var E=C.length;var z=Math.PI/(E);var J=0;var M=(E-5)*0.1;if(M<0){M=0}for(var F=0;F<C.length;F++){var u=C[F];var w=0;var v=-0.0001/2;v*=1+M;var I=J*2;var t=w*Math.cos(I)-v*Math.sin(I);var A=v*Math.cos(I)+w*Math.sin(I);J+=z;A*=1.6;var L=G.clusterIcon_.center_;var o=0.00001*-2;var n=0.00001*-2;var s=L.lat()+o+t;var N=L.lng()+n+A;h+=s;H+=N;u.setMap(map);u.setVisible(true);u.setPosition(new google.maps.LatLng(s,N));selection_custom_markers.push(u);K.markers.push(u)}K.closeClusterMarker=new google.maps.Marker({map:map,visible:true,position:new google.maps.LatLng(h/C.length,H/C.length),icon:"/wp-content/themes/stopdecriminaliteit/images/icons/map_cluster_35.png",title:"Klik om cluster te sluiten...",html:"hey"});var m=selection_openClusters.length;google.maps.event.addListener(K.closeClusterMarker,"click",function(){var x=markerCluster.getMarkers();markerCluster.clearMarkers();for(var l=0;l<selection_openClusters[m].markers.length;l++){var j=selection_openClusters[m].markers[l];j.setMap(null);j.setVisible(false);j.isAdded=false;var y=newMarker(j.customProperties.position,j.customProperties.markerId,j.customProperties.imt,j.customProperties.dos,j.customProperties.im);x.push(y)}K.closeClusterMarker.setMap(null);K.closeClusterMarker.setVisible(false);markerCluster.addMarkers(x)});selection_custom_markers.push(K.closeClusterMarker);selection_openClusters.push(K)}else{map.panTo(G.getCenter());map.fitBounds(G.getBounds())}})}var selection_custom_markers=Array();var selection_openClusters=Array();function selection_custom_markers_remove(){for(var b=0;b<selection_custom_markers.length;b++){var a=selection_custom_markers[b];a.setMap(null);delete a}selection_custom_markers=Array();selection_openClusters=Array()}function selection_write_frame(){var b="width:315px;";var a='<div class="frame selectionframe" style='+b+">";a+='	<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">';a+='		<tr height="5">';a+='			<td width="5"><div class="border_l draggable_div"></div></td>';a+='			<td><div class="border_w draggable_div"></div></td>';a+='			<td width="5"><div class="border_r draggable_div"></div></td>';a+="		</tr>";a+='		<tr height="100%">';a+='			<td width="5"><div class="border_h draggable_div"></div></td>';a+='			<td><div class="container"><div class="content">';a+='			</div><div class="dragframe"></div></div></td>';a+='			<td width="5"><div class="border_h draggable_div"></div></td>';a+="		</tr>";a+='		<tr height="5">';a+='			<td width="5"><div class="border_bl draggable_div"></div></td>';a+='			<td><div class="border_w draggable_div"></div></td>';a+='			<td width="5"><div class="border_br draggable_div"></div></td>';a+="		</tr>";a+="	</table>";a+="</div>";var d=$(a);d.css("left","100px");d.css("top","100px");d.css("display","none");d.css("opacity","0");selection_frame=d;var c='<div id="selection_content">';c+='<div class="collapse header_collapse"><div class="icon"></div></div><div class="header">Legenda</div>';c+='<div class="options" id="selection_options">';c+='<div class="section firstsection clusterinfosection"><div class="legendaimg"></div><div class="label"><label>Cluster van autokraken en woninginbraken,<br />klik om te openen</label></div></div>';c+='<div class="section pogingwoningsection"><input type="checkbox" id="selection_pogingwoning" checked/><div class="legendaimg legenda_poging"></div><div class="label"><label for="selection_pogingwoning">Poging tot woninginbraak <span id="selection_pogingwoning_counter"></span></label></div></div>';c+='<div class="section mainsection woningsection"><input type="checkbox" id="selection_woning" checked/><div class="legendaimg legenda_woning"></div><div class="label"><label for="selection_woning">Woninginbraken <span id="selection_woning_counter"></span></label></div><div class="rowcollapse" forid="selection_woning_content"><div class="icon"></div></div></div>';c+='<div class="section subsection" id="selection_woning_content">';c+="</div>";c+='<div class="section mainsection autosection"><input type="checkbox" id="selection_auto" checked /><div class="legendaimg legenda_auto"></div><div class="label"><span id="selection_auto_label">Autokraken</span> <span id="selection_autokraak_counter"></span></div></div></div>';c+="</div>";c+="</div>";d.find(".content").html(c);c=d.find("#selection_content");selection_element_frame=d;selection_element_content=c;checkbox_update(c);d.find("div.border_w, div.border_h").css("opacity",0.6);d.appendTo($("#frames"));c.find(".woningsection div.dynamiccheckbox, .woningsection input").click(function(){var e=c.find(".mainsection input").attr("checked");c.find(".subsection input").each(function(){$(this).attr("checked",e);$(this).change()});selection_update_selection()});c.find(".pogingwoningsection div.dynamiccheckbox, .pogingwoningsection input").click(function(){selection_update_selection()});c.find(".pogingwoningsection input").change(function(){selection_update_selection()});c.find(".autosection div.dynamiccheckbox, .autosection input").click(function(){selection_update_selection()});c.find(".autosection input").change(function(){selection_update_selection()});c.find(".header_collapse").click(function(){selection_minimized=!selection_minimized;if(selection_minimized){$(this).find(".icon").addClass("minimized");c.find("div.options").selection_slideUp()}else{$(this).find(".icon").removeClass("minimized");c.find("div.options").selection_slideDown()}});c.find("div.rowcollapse").each(function(){var e=$("#"+$(this).attr("forid"));e.attr("isout",0);if(!$(this).attr("id")){$(this).attr("id","_selection_row_collapse")}$(this).click(function(){var f=e.attr("isout")==0;e.attr("isout",f?1:0);if(f){e.selection_slideDown()}else{e.selection_slideUp()}selection_button_rotate($(this).attr("id"),f)})});frame_setHandlers(d);frame_add(d)}var selection_button_rotate_timeout=null;function selection_button_rotate(a,b){clearTimeout(selection_button_rotate_timeout);selection_button_rotate_timeout=null;var f=40;var c=$("#"+a).find(".icon");var e=parseInt(c.attr("animationState"));if(!e){e=0}$(c).css("backgroundPosition",(e*-9)+"px -20px");if(b){e++}else{e--}if(e>4){e=4}else{if(e<0){e=0}else{selection_button_rotate_timeout=setTimeout("selection_button_rotate('"+a+"', "+(b?"true":"false")+");",f)}}c.attr("animationState",e)}var selection_minimized=false;$(window).ready(function(){selection_write_frame()});
