var Site = {
	init: function() {
		if ( $('liquid') )    Liquid.parseLiquids();
		if( $('GMap') )
		{
			window.addEvent( 'onunload', GUnload );
			GoogleMapsAPM.init();
		}
	}
};

var Liquid = {

	parseLiquids: function(){
		var liquids = $$('#liquid .liquid');
		var fx = new Fx.Elements(liquids, {wait: false, duration: 100, transition: Fx.Transitions.elasticOut});
		liquids.each(function(liquid, i)
		{
			liquid.addEvent('mouseover', function(e)
			{
				e = new Event(e).stop();
				var obj = {};
				obj[i] = { 'width': [liquid.getStyle('width').toInt(), 320] };

				liquids.each(function(other, j)
				{
					if (other != liquid)
					{
						var w = other.getStyle('width').toInt();
						if (w != 180) obj[j] = {'width': [w, 180]};
					}
				});
				fx.start(obj);
			});
		});

		document.addEvent('mouseover', function(e){
			e = new Event(e);
			var rel = e.relatedTarget;
			if (!rel) return;
			if (rel.hasClass && (rel.hasClass('liquids') || rel.hasClass('liquid') || rel.id == 'liquid')){
				var obj = {};
				liquids.each(function(other, j){
					obj[j] = {'width': [other.getStyle('width').toInt(), 226]};
				});
				fx.start(obj);
			};
		});
	}
};
	
var GoogleMapsAPM =
{
	init: function()
	{
		if (GBrowserIsCompatible()) 
		{
        	var map = new GMap2( $('GMap') );
			map.addControl(new GSmallMapControl());
			map.setCenter(new GLatLng(52.6396,-1.102409), 15);
	
		
			// Our info window content
			var infoTabs = [
		  		new GInfoWindowTab("Address", '<div id="GMapAddress"><span class="pink"><B>Soar Photographic</B></span><BR>The Studio<BR>20 Cottesmore Road<BR>Leicester LE5 3LJ</div>'),
		  		new GInfoWindowTab("Directions", '<div id="GMapDirections">Upon arrival, please ring our contact numbers...')
				];
		
			// Place a marker in the center of the map and open the info window
			// automatically
			var marker = new GMarker(map.getCenter());
			GEvent.addListener(marker, "click", function() {
			  marker.openInfoWindowTabsHtml(infoTabs);
			});
			map.addOverlay( marker );
			marker.openInfoWindowTabsHtml(infoTabs);
      	}
	}
};


window.onDomReady(Site.init);



