IWY.Photos = {
  /*
   *
   */
  showChip: function( o ) {
    var chip = $( 'photochip' );
    if( ! chip ) { return; }

    Event.observe( o.e, 'mouseout', IWY.Photos.hideChip, false );

    $( 'photochip-title' ).innerHTML = o.title;
    $( 'photochip-datetime' ).innerHTML = o.datetime;

    chip.setStyle( {
      left: Position.cumulativeOffset( o.e )[0] + 'px',
      top:  Position.cumulativeOffset( o.e )[1] - Element.getHeight( chip ) + 'px'
    } );
    chip.style.display = 'block';
  },
  hideChip: function( e ) {
    var chip = $( 'photochip' );
    chip.style.display = 'none';
  },


  alignThumbnailHeight: function( n ) {
    var thlist = $$('ul.photolist');
    for( var a = 0; a < thlist.length; a++ ) {
      var lis = thlist[a].getElementsByTagName( 'li' );
      var maxH = 0;
      for( var i = 0; i < lis.length; i++ ) {
        //var h = Element.getHeight( lis[i].getElementsByTagName( 'img' )[0] );
        var h = Element.getHeight( lis[i] );
        if( i % n == 0 ) { maxH = h; }
        else { if( h > maxH ) { maxH = h; } }

        if( i % n == n - 1 ) {
          for( var j = i - n + 1; j <= i; j++ ) {
            //lis[j].getElementsByTagName( 'img' )[0].style.height = maxH + 'px';
            lis[j].style.height = maxH + 'px';
          }
          //alert( a + ': ' + maxH );
        }
      }
    }
  }
};



IWY.Photos.Detail = {
  init: function() {
    this.latlng = G_LATLNG;
    this.gmap;
    this.marker;

    this.gmap = new GMap2( document.getElementById( 'location' ) );
    var p = new GLatLng( this.latlng.lat, this.latlng.lng );
    this.marker = new GMarker( p );
    this.gmap.setCenter( p, 14 );
    this.gmap.addOverlay( this.marker );

    //this.marker.openInfoWindowHtml( $( 'infowindow' ).innerHTML, {maxWidth:100} );
  }

};
