/*
	*@author k.ward 	
	* Ext JS Library 2.2
*/

Ext.onReady(function(){		
	
	var win;
	var windowID;
	var windowTitle;
	var windowWebAddress;
	var button1 = Ext.get('map-sunbury');	
	var button2 = Ext.get('map-heritagepark');
	var button3 = Ext.get('map-soberscomplex');
	var button4 = Ext.get('map-thecrane');
	var button5 = Ext.get('map-illarocourt');
	var button6 = Ext.get('map-farleyhill1');
	var button7 = Ext.get('map-farleyhill2');
	
	button1.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Sunbury Plantation House";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=46";
		createWindow();
	})
	
	button2.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Heritage Park/The Rum Factory";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=107";
		createWindow();
	})
	
	button3.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Garfield Sobers Complex";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=80";
		createWindow();
	})
	
	button4.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "The Crane Resort & Residences";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=200";
		createWindow();
	})
	
	button5.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Illaro Court";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=104";
		createWindow();
	})
	
	button6.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Farley Hill National Park";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=51";
		createWindow();
	})
	
	button7.on('click', function(){
		windowOpen = true;
		windowID = "mapWindow";
		windowTitle = "Farley Hill National Park";
		windowWebAddress = "http://barbados.org/maps_google.htm?mapPoint=51";
		createWindow();
	})
	
	
	
	
	/*
	* ================  Bookable Ads At Work Popup Window  =======================
	*/
	function createWindow(){
		// create the window on the first click and reuse on subsequent clicks
	
		win = new Ext.Window({
			id			: windowID,
			title		: windowTitle,
			layout  	: 'fit',
			width   	: 810,
			height		: 550,
			closeAction	:'close',
			plain		: true,
			maximizable	: true,
			modal		: true,
			autoLoad	: '../bookable-ads/iframe.htm?webAddress=' + windowWebAddress			
		});
		
	    win.show();
	}

	
	Ext.QuickTips.init();
});