<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="GraphWise Political Contributions Map"
	description="Displays graphs of political contributions from individuals in the United States, for each state."
        title_url="http://www.graphwise.com"
        directory_title="GraphWise Political Contributions Graph"
        screenshot="http://www.graphwise.com/harvesters/FEC.gov/PolMap.png"
        thumbnail="http://www.graphwise.com/harvesters/FEC.gov/PolMapThumb.png"
        render_inline="optional"
        author="David Quinn-Jacobs"
        author_email="dqj@graphwise.com"
        author_photo="http://www.graphwise.com/images/icons/dqjAuthor.png"
        author_affiliation="GraphWise.com"
        author_aboutme="Software designer and developer.  Initial creator of the GraphWise.com system."
        author_location="Ithaca, NY"
        author_link="http://www.graphwise.com"
        category="News"  
	height="720"
	width="840"
	>
</ModulePrefs>
<UserPref display_name="Image Format" name="gr_format" datatype="enum" default_value="svgz">
	<EnumValue value="svgz" display_value="SVG (better, requires Firefox or free Adobe SVG viewer)" />
	<EnumValue value="png" display_value="PNG (non-interactive)" />
</UserPref>
<Content type="html"><![CDATA[
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAYL9QBcFR1LZlyy_G9SH_aBTGr67bavXMc5ojCAUAfG7ZFw7AoRQtCyyhmjg4WRVcoAnBjxOsfz5k1Q" type="text/javascript"></script>
<script language="VBScript">
On Error Resume Next
If useVBMethod = true Then
	hasSVGSupport = IsObject(CreateObject("Adobe.SVGCtl"))
End If
</script>
<script type="text/javascript">
var grBaseURL = 'http://www.graphwise.com/';
var grHarvestURL = grBaseURL + 'harvesters/FEC.gov/';
var grLogoLink = '<a href="http://www.graphwise.com"><img src="'+grBaseURL+'images/logos/logoGraphWiseMirroredSmall.png" border="0"/></a>';
var grMap;
var grTooltip = document.createElement("div");
var grPrefs = new _IG_Prefs();
var grFormat = grPrefs.getString("gr_format");
var hasSVGSupport = false;
var useVBMethod = false;

if (navigator.userAgent.indexOf("Firefox") != -1) {
  var n = navigator.userAgent.indexOf("Firefox") + 8;
  if ((parseInt(navigator.userAgent.charAt(n)) == 1) && (parseInt(navigator.userAgent.charAt(n + 2)) >= 5))
	hasSVGSupport = true;
  else if (parseInt(navigator.userAgent.charAt(n)) > 1)
	hasSVGSupport = true;
 }
 else if (navigator.mimeTypes && navigator.mimeTypes.length) {
   if (navigator.mimeTypes["image/svg+xml"])
	 hasSVGSupport = true;
 }
 else {
   useVBMethod = true;
 }

var grStateCentroids = new Array();
grStateCentroids["Alabama"] = new GLatLng( 34.7356758024691, -86.5923922224596 );
grStateCentroids["Alaska"] = new GLatLng( 53.3308100550838, -168.187470829389 );
grStateCentroids["Arizona"] = new GLatLng( 36.2463773395062, -111.615135530525 );
grStateCentroids["Arkansas"] = new GLatLng( 36.3745018333333, -92.2404553521374 );
grStateCentroids["California"] = new GLatLng( 34.034180345679, -120.386475658584 );
grStateCentroids["Colorado"] = new GLatLng( 40.1123906851852, -105.837605375902 );
grStateCentroids["Connecticut"] = new GLatLng( 41.7653157407408, -72.7500704191033 );
grStateCentroids["Delaware"] = new GLatLng( 39.5919031111111, -75.5734057276619 );
//grStateCentroids["District of Columbia"] = new GLatLng( 38.9432264290123, -77.014843331318 );
grStateCentroids["Florida"] = new GLatLng( 24.8239841227306, -80.8128505589159 );
grStateCentroids["Georgia"] = new GLatLng( 34.8044546604938, -83.4848125832388 );
grStateCentroids["Hawaii"] = new GLatLng( 23.7284171581896, -166.171539079549 );
grStateCentroids["Idaho"] = new GLatLng( 46.0109290123457, -115.25942158465 );
grStateCentroids["Illinois"] = new GLatLng( 42.3841872530864, -89.4736534897358 );
grStateCentroids["Indiana"] = new GLatLng( 41.637323308642, -86.1259739940181 );
grStateCentroids["Iowa"] = new GLatLng( 43.3672035185185, -93.5547624934191 );
grStateCentroids["Kansas"] = new GLatLng( 39.8555297623457, -98.3303635104984 );
grStateCentroids["Kentucky"] = new GLatLng( 38.859923462963, -84.6841789112593 );
grStateCentroids["Louisiana"] = new GLatLng( 29.8796603709091, -88.8255873459908 );
grStateCentroids["Maine"] = new GLatLng( 43.6900192271536, -70.1578640420269 );
grStateCentroids["Maryland"] = new GLatLng( 38.1788128833971, -76.0527088760855 );
grStateCentroids["Massachusetts"] = new GLatLng( 42.5447558209877, -71.9165613329627 );
grStateCentroids["Michigan"] = new GLatLng( 45.6625052222222, -85.5537117162697 );
grStateCentroids["Minnesota"] = new GLatLng( 48.7185493950617, -94.5945829561728 );
grStateCentroids["Mississippi"] = new GLatLng( 34.6460881388889, -89.4242207167089 );
grStateCentroids["Missouri"] = new GLatLng( 40.403672037037, -92.5918042214141 );
grStateCentroids["Montana"] = new GLatLng( 48.4396797777778, -109.192907672176 );
grStateCentroids["Nebraska"] = new GLatLng( 42.2346756358025, -99.9053783224672 );
grStateCentroids["Nevada"] = new GLatLng( 39.6569722716049, -117.034131681386 );
grStateCentroids["New Hampshire"] = new GLatLng( 43.6958601450617, -71.5101267326957 );
grStateCentroids["New Jersey"] = new GLatLng( 40.9233455308642, -74.638104312308 );
grStateCentroids["New Mexico"] = new GLatLng( 36.5294757469136, -105.857244341589 );
grStateCentroids["New York"] = new GLatLng( 40.8539188888889, -73.7699673858154 );
grStateCentroids["North Carolina"] = new GLatLng( 36.4464627530864, -79.6107260441304 );
grStateCentroids["North Dakota"] = new GLatLng( 48.6260139475309, -99.6237594623845 );
grStateCentroids["Ohio"] = new GLatLng( 41.6527994699955, -82.8207385186695 );
grStateCentroids["Oklahoma"] = new GLatLng( 36.6829932839506, -97.5522601607084 );
grStateCentroids["Oregon"] = new GLatLng( 45.3428610617284, -121.378793620387 );
grStateCentroids["Pennsylvania"] = new GLatLng( 41.9217809814815, -78.0204010573646 );
grStateCentroids["Puerto Rico"] = new GLatLng( 18.3231539012346, -65.2732113512323 );
grStateCentroids["Rhode Island"] = new GLatLng( 41.5234845535524, -71.3834372851514 );
grStateCentroids["South Carolina"] = new GLatLng( 34.888059808642, -81.0260661357534 );
grStateCentroids["South Dakota"] = new GLatLng( 45.6913540185185, -99.9036100826851 );
grStateCentroids["Tennessee"] = new GLatLng( 36.4820787993827, -86.5863271120342 );
grStateCentroids["Texas"] = new GLatLng( 27.6294930593335, -97.1996143438316 );
grStateCentroids["Utah"] = new GLatLng( 41.3986721296296, -111.260921682652 );
grStateCentroids["Vermont"] = new GLatLng( 44.5024862469136, -72.7303999097772 );
grStateCentroids["Virginia"] = new GLatLng( 37.9466637839506, -76.0240703187518 );
grStateCentroids["Washington"] = new GLatLng( 48.6648342044502, -123.174473648561 );
grStateCentroids["West Virginia"] = new GLatLng( 39.5697930246914, -80.627783600124 );
grStateCentroids["Wisconsin"] = new GLatLng( 45.3700939324083, -86.9017926206626 );
grStateCentroids["Wyoming"] = new GLatLng( 43.8752936296296, -107.365810650813 );

function createIcon() { icon = new GIcon();
  icon.image = "http://www.graphwise.com/images/icons/gwiseMapMarker.png"; 
  icon.iconSize = new GSize( 19, 22 );
  icon.iconAnchor = new GPoint( 1, 1 );
  icon.infoWindowAnchor = new GPoint( 1, 1 );
  return icon; 
}
function createHtmlMarker( icnt, point, name ) { 
  var gwicon = createIcon();
  var marker_options = { icon: gwicon };
  var marker = new GMarker( point, marker_options );
  var state_name = name.replace( " ", "_" );
  var extension = 'png'; 
  if ( grFormat == 'svgz' && hasSVGSupport ) {
	extension = 'svgz'; 
  }
  var src = grHarvestURL + '/?img=state' + state_name + 'P.' + extension; 
  var thumb_src = grHarvestURL + '?th=1&amp;img=state' + state_name + 'P.png'; 
  var zoom = src + '&amp;zoom=1'; 
  var zoom_link = 'Click <a href="' + zoom + '">here</a> to customize and share this graph.'; 
  marker.tooltip = '<div class="tooltip"><img src="' + thumb_src + '"/><br/>' + name + '<br/>' + 
            '<span style="color:#888;">(click marker to zoom in)</span></div>'; 

    var info = '<iframe class="infowin" src="'+src+'"></iframe>'; 

  GEvent.addListener( marker, "click", function(){marker.openInfoWindowHtml( info )} );
  GEvent.addListener( marker, "mouseover", function() { showTooltip( marker ); } );
  GEvent.addListener( marker, "mouseout", function() { grTooltip.style.visibility="hidden" } );
  return marker; 
}

function showTooltip( marker ) { 
  grTooltip.innerHTML = marker.tooltip; 
  var point = grMap.getCurrentMapType().getProjection().fromLatLngToPixel(grMap.getBounds().getSouthWest(),grMap.getZoom());
  var offset = grMap.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),grMap.getZoom());
  var anchor = marker.getIcon().iconAnchor; var width = marker.getIcon().iconSize.width; 
  var pos = new GControlPosition( G_ANCHOR_BOTTOM_LEFT, new GSize( offset.x - point.x - anchor.x + width,- offset.y + point.y +anchor.y ) );
  pos.apply( grTooltip );
  grTooltip.style.visibility = "visible"; 
}

function initialize() { 
  grMap = new GMap2( document.getElementById( "grMap" ) );
  document.getElementById("grMap").appendChild( grTooltip );
  grTooltip.style.visibility="hidden"; 

  var center_point = new GLatLng( 37.4419, -97.1419 );
  grMap.setCenter( center_point, 4 );
  GEvent.addListener( grMap, "infowindowclose", function() { grMap.setCenter( center_point, 4 ); } );

  var icnt = 0;
  for ( state_name in grStateCentroids ) { 
	marker = createHtmlMarker( icnt, grStateCentroids[state_name], state_name );
	grMap.addOverlay( marker );
	icnt++; 
  }
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<style type="text/css">
.tooltip { 
	background-color:#ffffff; 
	font-family: arial,verdana; 
	font-size: 10px;
	font-weight:bold;
	border:1px #006699 solid;
	width: 160px;
	height: 150px;
	text-align: center;
	margin: 0px;
	padding: 0px; 
 }
.infowin { 
	background-color:#ffffff; 
	font-family: arial,verdana; 
	font-size: 10px; 
	font-weight:bold; 
	border:1px #006699 solid; 
	width: 520px; 
	height: 460px; 
	text-align: center; 
 }
.infograph { 
	width: 520px; 
	height: 460px; 
 }
</style>
<div style="margin:0px; padding:0px; width:100%; text-align:center;" align="center">
	<div style="margin:auto;">
		<h3 style="font-size: 1.2em; vertical-align: center; margin:0px; padding:0px;">2008 Presidential Election Campaign Contributions</h3>
	</div>
	<div id="grMap" style="margin:auto; width: 800px; height: 600px"></div>
	<div style="margin:auto;"><a href="http://www.graphwise.com">
		<img src="http://www.graphwise.com/images/logos/logoGraphWiseMirrored.png" border="0" align="center"/></a></div> 
	</div>
 ]]></Content>
</Module> 

