/*

	eclipse-creative.com
	20110201	tomc
	
	GO GREEN RENTAL COMMON LAYOUT
	
*/
var rootPath = '';

// -----------------------------------------------------------------------------
/*
	SITE MENU
*/
// -----------------------------------------------------------------------------
window.addEvent("domready",function(){
	var menuEl = document.getElement(".page-head .menu");
	$$(".page-head .menu a").each(function(a){
		
		var pos = a.getCoordinates(menuEl);

		var span = new Element('span',{
			styles:{
				position	:'absolute',
				top			:pos.top,
				left		:pos.left,
				zIndex		:-1,
				width		:pos.width,
				height		:pos.height,
				opacity		:0,
				backgroundImage		:'url(' + rootPath + 'grx/portal-layout/menu-bg-over-938x38.gif' + ')',
				backgroundPosition	:'-' + pos.left + 'px -' + pos.top + 'px'
			}
		}).inject(menuEl,'top');
		
		a.addEvents({
			mouseenter:function(){
				span.fade(1);
			},
			mouseleave:function(){
				span.fade(0);
			}
		});
	});
});


// -----------------------------------------------------------------------------
/*
	LOCATION DROP DOWN
*/
// -----------------------------------------------------------------------------
window.addEvent("domready",function(){
	$$(".location-drop").each(function(ul){
		ul.addEvents({
			mouseenter:function(){
				//this.morph({height: (this.getElements('li').length*20)  });
				this.morph({height: (12*20)  });
				this.setStyles({overflow:'scroll'});
			},
			mouseleave:function(){
				this.morph({height:20});
				this.setStyles({overflow:'hidden'});
			}
		});
	});
});



// -----------------------------------------------------------------------------
/*
	MAP 'SqueezeBox'
*/
// -----------------------------------------------------------------------------
window.addEvent("domready",function(){
	SqueezeBox.assign($$('a.map-lightbox'), {
		parse: 'rel'
	});
	$$("a.map-lightbox").addEvents({
		click:function(){
			_gaq.push(['_trackEvent', 'Map-View', 'Map-View']);
		}
	}).addClass("skip-tracking");
	$$("form.arnoldclark-booking").addEvents({
		submit	:function(){
			_gaq.push(['_trackEvent', 'Submit-Booking-Form', 'Submit-Booking-Form']);
		}
	});
	$$("a[href^=http://]").addEvents({
		click:function(e){
			if(this.hasClass("skip-tracking")){
				return;
			}
			_gaq.push(['_trackEvent', 'External-Link', this.getProperty("href")]);
		}
	});
});








