var map_width = 450;
var map_height = 450;
var half_width = map_width / 2;
var half_height = map_height / 2;
var scale_default = 8;
var hourglass_count = 0;

//commented out after adding theme_name node to map_xml.php, which pulls theme_name from theme_arrays.php
//var themes = new Array();
//themes[23] = "Housing Affordability Index, 0-30% of Area Median Income";
//themes[22] = "H+T Affordability Index,  0-48% of Area Median Income";
//themes[24] = "H+T Affordability Index,  0-45% of Area Median Income";
//themes[3] = "Transportation Costs as Percent of Income";
//themes[2] = "Housing Costs as Percent of Income";
//themes[16] = "Housing Costs as Percent of Income - Owners Only";
//themes[18] = "Housing Costs as Percent of Income - Renters Only";
//themes[1] = "H+T Costs as Percent of Income";
//themes[15] = "H+T Costs as Percent of Income - Owners Only";
//themes[17] = "H+T Costs as Percent of Income - Renters Only";
//themes[4] = "Autos per Household";
//themes[6] = "Vehicle Miles Traveled per Household";
//themes[13] = "Transit Ridership";
//themes[14] = "Transportation Cost";
//themes[5] = "Households Density";
//themes[7] = "Travel Time to Work";
//themes[8] = "Employment Access Index";
//themes[9] = "Average Block Size";
//themes[10] = "Transit Connectivity Index";
//themes[11] = "Workers per Household";
//themes[12] = "Median Household Income";
//themes[19] = "Percent of Households Who Own";
//themes[20] = "Average Monthly Ownership Costs";
//themes[21] = "Average Monthly Rent";
//themes[25] = "Annual Household Gasoline Expenditures - 2000";
//themes[26] = "Annual Household Gasoline Expenditures - 2008";
//themes[27] = "Monthly Household Transportation Expenditures - 2000";
//themes[28] = "Monthly Household Transportation Expenditures - 2008";
//themes[29] = "Monthly Household Transportation Expenditures as Percent of Income - 2000";
//themes[30] = "Monthly Household Transportation Expenditures as Percent of Income - 2008";
//themes[32] = "CO<sub>2</sub>/Acre From Household Auto Use";
//themes[33] = "CO<sub>2</sub>/Household From Household Auto Use";

var views = new Array();
views[0] = "Housing + Transportation Affordability Index|23|24";
views[1] = "Compare Variables|5|4";
views[2] = "Gas Cost Impacts|25|26";
views[3] = "Greenhouse Gas Impacts|31|32";
	
function init() {
		// quit if this function has already been called
		if (arguments.callee.done) return;
		// flag this function so we don't do the same thing twice
		arguments.callee.done = true;
		// create the "page loaded" message 
		var http = getHTTPObject(); // We create the HTTP Object
		hourglass('init');
		initDrag();
		}
		/* for Mozilla */
		if (document.addEventListener) {
			document.addEventListener("DOMContentLoaded", init, null);
			/** DOMMouseScroll is for mozilla. */
		//	document.addEventListener('DOMMouseScroll', zoomWheel, false);
		}
	/** IE/Opera. */
	// window.onmousewheel = document.onmousewheel = zoomWheel;
		/* for Internet Explorer */
		/*@cc_on @*/
		/*@if (@_win32)
			 document.write("<script defer src=javascripts/ie_onload.js><"+"/script>");
		/*@end @*/
		/* for other browsers */
// moved following code to index.php in order to incorporate other JS - 9/21/2007 Paul Esling
	

function hourglass(status) {
	var hg1 = document.getElementById("hourglass1");
	var hg2 = document.getElementById("hourglass2");
	if (status=='stop') {
		hourglass_count = hourglass_count - 1;
		if (hourglass_count<1) {
			if (hg1) { hg1.style.display='none'; }
			if (hg2) { hg2.style.display='none'; }
			}
		}
	else if (status=='init') {
		hourglass_count = 0;
		if (hg1) { hg1.style.display='none'; }
		if (hg2) { hg2.style.display='none'; }
		}
	else {
		hourglass_count = hourglass_count + 1;
		if (hourglass_count<2) {
			if (hg1) { hg1.style.display='block'; }
			if (hg2) { hg2.style.display='block'; }
			}
		}
	}	

function getHTTPObject() {
  var xmlhttp;
/*@cc_on
  @if (@_jscript_version >= 5)
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  @else
    xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

