var Goaze = window.Goaze || {};

Goaze.ControlCenter = function(elementName){

		this.elName = elementName;
		this.el = null;
}

Goaze.ControlCenter.prototype = {

		init: function(){
				/* setup div and maps etc */
				
				var container = document.getElementById(this.elName);
				this.panel = new YAHOO.widget.Panel(container, 
					{ fixedcenter: true, 
						visible:true, 
						modal: true,
						width:"900px",
						height:"500px" } );
					// this.panel.setBody("control center<div id='gMap'>map</div>");
					this.panel.render();
					this.initMaps();
		},
			
		initMaps: function(){
			if (GBrowserIsCompatible()) {
				this.gmap = new GMap2(document.getElementById("gMap"));
				this.gmap.setCenter(new GLatLng(37.4419, -122.1419), 16);
				var mapControl = new GMapTypeControl();
				this.gmap.addControl(mapControl);
				this.gmap.addControl(new GLargeMapControl());
			}				
		},
		
		show: function(){
			this.init();			
			this.panel.show();
		}
};

Goaze.fixSideBar = function(){
	/* 
	 * the sidebar on the left doesn't extend 'till the footer when the main content
	 * is longer. This will fix this.
	 * Firefox (1.5 / 2.0) shows a 1 pixel gap, so 2px are added to the height.
	 */
	 
	var mainContainer = YAHOO.util.Dom.get('yui-main');
	var sideBar = YAHOO.util.Dom.get('sidebar');
	if(mainContainer && sideBar){
		if(mainContainer.offsetHeight > sideBar.offsetHeight){
			YAHOO.util.Dom.setStyle(sideBar,'height', (mainContainer.offsetHeight+2) + 'px');
		}
	};
};

Goaze.setupPanoramio = function(){
	for(var i=0; i<Goaze.config.panoramio.length; i++){
		Goaze.config.panoramio[i].getPictures();
	}
}

var test;

function initialize(){
	
	var oMenuBar = new YAHOO.widget.MenuBar("selectorMenu", { 
		autosubmenudisplay: true, 
		hidedelay: 250, 
		lazyload: true });
	oMenuBar.iframe = true; 
	oMenuBar.render();
	Goaze.fixSideBar();
	
	Goaze.setupPanoramio();
};                                                            	

YAHOO.util.Event.on(window, 'load', initialize);
