jQuery(function($){
				
				
		function loadGMap() {
			var map = new GMap2(document.getElementById("google-map"));
			var centre = new GLatLng(51.498736, -0.195424);				// Make sure you change the coordinates!
			map.setCenter(centre, 15);
			
			var cIcon = new GIcon();
			cIcon.image = "images/map-icon.png";
			cIcon.shadow = "http://www.cockandhen.com/images/map-icon-shadow.png";
			cIcon.iconSize = new GSize(100, 88);
			cIcon.shadowSize = new GSize(44, 65);
			cIcon.iconAnchor = new GPoint(50, 88);
			
			map.addControl(new GSmallMapControl());
			map.addOverlay(new GMarker(centre, {icon:cIcon}));
		}

		$('#show-hide').stop(true,true).delay(2000).fadeIn(1000);
		$('#show-hide-wrapper').stop(true,true).delay(2000).fadeIn(1000, function(){
			checkSize();
			
			var url = window.location.href;
			var to = url.length;
			var from = url.lastIndexOf("/");
		
			var final = url.substring(from,to);
			
			if(final == '/contact.php')
			{
				loadGMap();
			}
			
			else
			{
				return false;	
			}

		});
		
		$(window).load(function(){
				checkSize();
			})
			$(window).bind('resize',checkSize);
			function checkSize() {
				if($(window).height()> ($('#wrapper-top').height() +  $('#wrapper-middle').height()+ 200 +  $('#wrapper-footer').height())) {
					$('#wrapper-footer').css({
						'bottom':0, 
						'left':0, 
						'position':'absolute'
					})
				} else {
					$('#wrapper-footer').css({
						'bottom':0, 
						'left':0, 
						'position':'relative'
					})
				}
				

			}
		
		$('#show-btn').click(function () {
			//$('#wrapper-middle')
			$('#show-hide-wrapper').stop(true,true).fadeOut(function(){
				checkSize();
			});
			$('#wrapper-footer').stop(true,true).fadeOut();
			$('#hide-btn').show();
			$('#show-btn').hide();
			//$('#wrapper-footer').css({'position': 'absolute'});
			return false;
		});
		
		$('#hide-btn').click(function () {
			$('#show-hide-wrapper').stop(true,true).fadeIn(function(){
				checkSize();
			});
			$('#wrapper-footer').stop(true,true).fadeIn();
			$('#show-btn').show();
			$('#hide-btn').hide();
			return false;
		});

		$('#booking-form-btn').fancybox({
			'width'			: 	920,
			'height'		: 	405,
			'type'			: 'iframe',
			'transitionIn'	: 'fade',
			'transitionOut'	: 'fade'
		});		
});
