// prototype and Scriptaculous are required here.
// console.log('entered custommap.js');
var init = function() {
	bldginit();
	cmap.initialize();

	// $('zoomcontrol').toggle();
	custommap.setPosition();
}


addLoadEvent(init);


addLoadEvent(bldgURL);

custommap = { 
	setPosition: function() {
		var active = bldg.findAll( function(b) {
			return $(b.id.toLowerCase()).style.display == '';
		});
		
		var xMin = 1000;
		var yMin = 1000;
		//console.log(active);
		active.each( function(b) {
			//console.log( 'testing ' + b.X[0] +', '+  b.Y[0] + ' against ' + xMin+', '+ yMin);
			if ( b.X[0] < xMin ) {
				xMin = b.X[0];
				
			}
			if ( b.Y[0] < yMin ) {
				yMin = b.Y[0];
			}
		});
		cmap.moveTo(-xMin + 25, -yMin + 25);
	}

}