
//	--	Instantiate just one jQuery object
jQuery.root = jQuery( document );



//	--	Make Rocket Go Now
jQuery.root.ready( function( $ ) {

	//	--	Define head and body elements
	head = $.root.find( 'head' );
	body = $.root.find( 'body' );

	//	--	Add "js" class to body for styling
	body.addClass( 'js' );

	//	--	Invoke plugins, yo..
	body.find( '.home_services li' ).bigTarget();
	body.find( '.thumb_list li'    ).bigTarget();
	body.find( '.google_map'       ).googleMap();

});
//	--



//	--	Custom Plugins
(function( $ ) {

	//	BIG clickable targets on list items
	$.fn.bigTarget = function() {
		return this.bind( 'click', function() {
			window.location = $( this ).find( 'a' ).attr( 'href' );
		});
	};



	//	Google Maps
	$.fn.googleMap = function() {
		return this.each( function() {
			map_wrap = $( this );

			if ( GBrowserIsCompatible() ) {
				map_data = map_wrap.data();

				map = new GMap( map_wrap[0] );

				map.addControl( new GLargeMapControl() );
				map.centerAndZoom( new GPoint( map_data.longitude, map_data.latitude ), 2 );

				var point = new GPoint( map_data.longitude, map_data.latitude );

				var map_html = '<div class="map_html">';
					map_html+= '<h2>' + map_data.title + '</h2>';
					map_html+= '<p>' + map_data.address + '</p>';
					map_html+= '</div>';

				var marker = new GMarker( point );

				GEvent.addListener( marker, 'click', function() {
					marker.openInfoWindowHtml( map_html );
				});

				map.addOverlay( marker );
				marker.openInfoWindowHtml( map_html );
			} else {
				map_wrap.html( '<p>Your Browser is not compatible with Google Maps</p>' );
			}
		});
	};

})( jQuery );
//	--



//	--	Third-party plugins

//	Log
;(function($){$.fn.log=function(message){console.log("%s: %o",message,this);return this}})(jQuery);

