/*************** Class Methods **************/
Photo.startMap = function () {
	  setTimeout("new Effect.Fade('splash');", 3500);
		var mapElement = document.getElementById('map');
		var myLatLng = new google.maps.LatLng(39, -76);
	  Photo.map = new google.maps.Map(mapElement, {zoom: 3  , center: myLatLng, mapTypeId: google.maps.MapTypeId.TERRAIN});
    Photo.launch();
}

window.onload = Photo.startMap;

/*************** Instance Methods **************/

Photo.prototype.infoWindow = function() {
	
	var myInfoWindow = document.createElement('div');
	myInfoWindow.id = "infoWindow";
	myInfoWindow.appendChild(this.s_img);
  myInfoWindow.appendChild(document.createElement('br'));
  myInfoWindow.appendChild(document.createTextNode(this.p.place_name));
	
	return myInfoWindow;
}

Photo.prototype.display = function () {
  if (Photo.infoWindow) {
    Photo.infoWindow.close();
    Photo.marker.setMap(null);
  }
  Photo.marker = new google.maps.Marker({position: new google.maps.LatLng(this.p.latitude,this.p.longitude), title: this.p.place_name});
  Photo.infoWindow = new google.maps.InfoWindow({ content: this.infoWindow() });
	Photo.marker.setMap(Photo.map);
	Photo.infoWindow.open(Photo.map, Photo.marker);
}

Photo.prototype.sizeElements = function () {
  var zImg = $('zoomedPhoto');
  
  if (zImg) {
    var zw = parseFloat(zImg.width);
    var zh = parseFloat(zImg.height);
  
    var scaleW = 1.0;
    var scaleH = 1.0;
    if (zw>Photo.max.zw)
      scaleW = Photo.max.zw/parseFloat(zw);
    if (zh>Photo.max.zh)
      scaleH = Photo.max.zh/parseFloat(zh);
    var scaleFactor = Math.min(scaleH, scaleW);
    
    zImg.width = parseInt(zw*scaleFactor);
    zImg.height = parseInt(zh*scaleFactor);    
  }
}  

