var map;
var printcounter=0;
var centerLatitude = 25.862185;
var centerLongitude = -80.198959;
var startZoom = 12;
 

 var deselectCurrent = function() {};
 
function initializePoint(pointData) {
var point = new GLatLng(pointData.latitude, pointData.longitude);
//var icon = new GIcon();
		//icon.image = "http://www.sun-sentinel2.com/printmap/bulb.png";
		//icon.iconSize = new GSize(13, 30);
		//icon.shadowSize = new GSize(22, 20);
		//icon.iconAnchor = new GPoint(6, 20);
		//icon.infoWindowAnchor = new GPoint(5, 1);
var marker = new GMarker(point);
var mycheck = document.createElement('li');
var mychecklink = mycheck.appendChild(document.createElement('a'));
var spacer = document.createElement('li');
var spacerlink = spacer.appendChild(document.createElement('div'));
var listItem = document.createElement('li');
var listItemLink = listItem.appendChild(document.createElement('a'));
printcounter = printcounter + 1;
listItemLink.href = "#";
listItemLink.innerHTML = '';

mychecklink.innerHTML = '';
spacer.innerHTML = '<br/>';

 
var focusPoint = function() {
deselectCurrent();
listItem.className = 'current';
deselectCurrent = function() { listItem.className = ''; }
marker.openInfoWindowHtml(						  
 '<span style="font:arial"><table style="font:arial" width="300"><tr><font face="Arial"><td style="font:arial"><b>'  + pointData.name.toUpperCase()  + '</b><br/>' + pointData.address + '<br/>' + pointData.city + '<br/>' + 'Status: ' + pointData.status + '<br/>' + 'Discharge Date: ' + pointData.mydate + '<br/>' + 'Discharge Score: ' +  pointData.score + '<br/>' + 'Cleanup Program: ' +  pointData.program  + '<br/>' + '<a href="http://www.sun-sentinel2.com/poweroutage/printmap/details.php" target="_blank">' + 'Explanation of terms' + '</a></td></font></tr></font></table>');
map.panTo(point);
return false;
}
 
GEvent.addListener(marker, 'click', focusPoint);
listItemLink.onclick = focusPoint;
 
document.getElementById('sidebar-list').appendChild(listItem);
document.getElementById('sidebar-list').appendChild(mycheck);
document.getElementById('sidebar-list').appendChild(spacer);
 
map.addOverlay(marker);
}
 
function windowHeight() {
// Standard browsers (Mozilla, Safari, etc.)
if (self.innerHeight)
return self.innerHeight;
// IE 6
if (document.documentElement && document.documentElement.clientHeight)
return document.documentElement.clientHeight;
// IE 5
if (document.body)
return document.body.clientHeight;
// Just in case.
return 0;
}
 
function handleResize() {
var height = windowHeight() - document.getElementById('toolbar').offsetHeight - 30;
document.getElementById('map').style.height = height + 'px';
document.getElementById('sidebar').style.height = height + 'px';
}
 
function changeBodyClass(from, to) {
document.body.className = document.body.className.replace(from, to);
return false;
}
 
//function init() {
//document.getElementById('button-sidebar-hide').onclick = function() { return changeBodyClass('sidebar-right', 'nosidebar'); };
//document.getElementById('button-sidebar-show').onclick = function() { return changeBodyClass('nosidebar', 'sidebar-right'); };
//handleResize();
 
//map = new GMap(document.getElementById("map"));
//map.addControl(new GLargeMapControl());
//map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
 
//for(id in markers) {
//initializePoint(markers[id]);
//}
//changeBodyClass('loading', 'standby');
//}
 
//window.onresize = handleResize;
//window.onload = init;

function init() {
changeBodyClass('sidebar-right', 'nosidebar');
document.getElementById('button-sidebar-hide').onclick = function() { return changeBodyClass('sidebar-right', 'nosidebar'); };
document.getElementById('button-sidebar-show').onclick = function() { return changeBodyClass('nosidebar', 'sidebar-right'); };
handleResize();
	
	
	
	
//document.getElementById('button-sidebar-hide').onclick = function() { return changeBodyClass('sidebar-right', 'nosidebar'); };
//document.getElementById('button-sidebar-show').onclick = function() { return changeBodyClass('nosidebar', 'sidebar-right'); };
//handleResize();
 
map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
//search listings
map.enableGoogleBar();
//traffic
//map.addOverlay(new GTrafficOverlay());
var overlayControl = new GOverviewMapControl();
      map.addControl(overlayControl);
      var overmap = overlayControl.getOverviewMap();
      var overmapdiv = document.getElementById('map_overview');




map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
 
for(id in markers) {
initializePoint(markers[id]);
}
changeBodyClass('loading', 'standby');
}
 
window.onresize = handleResize;
window.onload = init;





