/**
 * DOM ready
 * Re-maps the jQuery object
 */
$(function() {

	// Feature carousel

	var images = $('.feature').children().length;

	if (images > 1)
	{
		$('.feature-info').addClass('visible');
		$('.feature').cycle({
			fx: 'scrollHorz',
			prev: '.prev',
			next: '.next',
			pause:   1,
			after: function(curr,next,opts) {
				
				var caption_p = $('.feature').children('img:visible').attr('alt');
			
				var counter1 = (opts.currSlide +1) + '/' + opts.slideCount;
				$('.feature-nav .count').html(counter1);
				$('.caption p').html(caption_p);
			
			}			
		});
	}

});

function initMap(){

	var point = new google.maps.LatLng(51.549226,-0.100242);

	var myMapOptions = {
		zoom: 16,
		center: point,
		mapTypeControl: false,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		scrollwheel:false
	};

	var map = new google.maps.Map(document.getElementById("map"),myMapOptions);

	var image = new google.maps.MarkerImage(
		'http://www.everybody-s.com/assets/images/marker-images/image.png',
		new google.maps.Size(52,53),
		new google.maps.Point(0,0),
		new google.maps.Point(8,45)
	);

	var shadow = new google.maps.MarkerImage(
		'http://www.everybody-s.com/assets/images/marker-images/shadow.png',
		new google.maps.Size(82,53),
		new google.maps.Point(0,0),
		new google.maps.Point(8,45)
	);

	var shape = {
		coord: [28,0,33,1,36,2,38,3,39,4,41,5,42,6,43,7,44,8,45,9,46,10,47,11,47,12,48,13,48,14,49,15,49,16,50,17,50,18,50,19,51,20,51,21,51,22,51,23,51,24,51,25,51,26,51,27,51,28,51,29,51,30,51,31,51,32,50,33,50,34,50,35,49,36,49,37,48,38,48,39,47,40,47,41,46,42,45,43,44,44,43,45,42,46,41,47,40,48,38,49,36,50,33,51,29,52,22,52,18,51,15,50,13,49,4,48,4,47,5,46,5,45,5,44,5,43,5,42,4,41,4,40,3,39,3,38,2,37,2,36,1,35,1,34,1,33,0,32,0,31,0,30,0,29,0,28,0,27,0,26,0,25,0,24,0,23,0,22,0,21,0,20,1,19,1,18,1,17,2,16,2,15,3,14,3,13,4,12,4,11,5,10,6,9,7,8,8,7,9,6,10,5,12,4,13,3,15,2,18,1,23,0,28,0],
		type: 'poly'
	};

	var marker = new google.maps.Marker({
		draggable: false,
		raiseOnDrag: false,
		icon: image,
		shadow: shadow,
		shape: shape,
		map: map,
		position: point
	});

}
