(function(){var A=new YAHOO.util.YUILoader({base:"",require:["dom","event","element"],loadOptional:false,combine:true,filter:"MIN",allowRollup:true,onSuccess:function(){State.Init()}});A.insert()})();State={Init:function(){YAHOO.util.Event.onAvailable("CountyMap",this.InitializeMaps,this)},InitializeMaps:function(){if(GBrowserIsCompatible()){var D=new GMap2(document.getElementById("CountyMap"));var C=new GLatLngBounds();D.setCenter(new GLatLng(parseFloat(State.Data.Latitude),parseFloat(State.Data.Longitude)),5);D.addControl(new GLargeMapControl());D.clearOverlays();for(var B=0;B<State.CountyPolylines.length;B++){var A=State.NewPolygon(State.CountyPolylines[B],D,C)}D.setZoom(D.getBoundsZoomLevel(C));D.setCenter(C.getCenter())}},NewPolygon:function(E,F,D){var A=Global.BuildPolygon(F,E.Polyline,1,1,"#444444",true,0.6,true,D);for(var C=0;C<A.length;C++){var B=A[C];GEvent.addListener(B,"click",function(){location.href="/"+Global.RootUrl+"/state/"+Global.CleanStringForUrl(E.StateAbbr)+"/county/"+Global.CleanStringForUrl(E.CountyName)});GEvent.addListener(B,"mouseover",function(S,Q,N,M){var J=new GLatLng(E.Latitude,E.Longitude);var G=null;var P=document.getElementById("CountyMap");if(typeof E.HoverDom=="undefined"){E.HoverDom=document.createElement("div");E.HoverDom.id="MapHover_"+E.Fips;G=new YAHOO.util.Element(E.HoverDom);var L=document.createElement("div");var K=document.createElement("div");L.innerHTML=E.CountyName+" County";K.innerHTML=E.PopulationEstimate=="0"?"":"Population "+E.PopulationEstimate;L.className="Title";K.className="Subtitle";G.appendChild(L);G.appendChild(K);G.addClass("MapHover");G.appendTo(F.getPane(G_MAP_FLOAT_PANE))}else{G=new YAHOO.util.Element(E.HoverDom);G.setStyle("display","block")}G.fireQueue();G.setStyle("visibility","hidden");var T=F.fromLatLngToDivPixel(J);var I=F.fromLatLngToDivPixel(F.getBounds().getSouthWest()).x;var H=F.fromLatLngToDivPixel(F.getBounds().getSouthWest()).y-F.getSize().height;var R=0;var O=0;T.x-=I;T.y-=H;if(T.x>P.offsetWidth/2){R=(T.x+I-E.HoverDom.offsetWidth)-24/2}else{R=(T.x+I)+24/2}if(T.y-E.HoverDom.offsetHeight/2<4){O=(4+H)}else{if(T.y+E.HoverDom.offsetHeight/4>P.offsetHeight-4){O=(P.offsetHeight+H-E.HoverDom.offsetHeight-4)}else{O=(T.y+H-(E.HoverDom.offsetHeight/2))}}G.setStyle("left",R+"px");G.setStyle("top",O+"px");G.setStyle("visibility","visible")});GEvent.addListener(B,"mouseout",function(){HoverDom=new YAHOO.util.Element(E.HoverDom);HoverDom.setStyle("display","none")})}}};