/* Author: 

*/

 function initialize() {
    var latlng = new google.maps.LatLng(51.460761,-0.163477);
	var Centlatlng = new google.maps.LatLng(51.460826,-0.14750); 
    var myOptions = {
      zoom: 16,
      center: Centlatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("google-map"),
        myOptions);

	var image = new google.maps.MarkerImage('img/map-icon.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(40, 57),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(20, 56));
      
	var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: image
    });

    //$('#full-screen-image').css('position','absolute');
  }

  jQuery(function($){
  	if ($('#contact').size()>0) {
  		initialize();
  	};
	
	var originalSize = $('#content-container').height();
	
	function checkWindow() {
		if(originalSize < $(window).height()){
			$('#column-left, #column-right, #buttons-holder, #img, #full-screen-image').height($(document).height());			
		}			
	}
	checkWindow();
	$(window).bind('resize', checkWindow);

  })
  
$('#showimage').click(function(){
	$('#buttons-holder').fadeOut(500);
	$('#column-right').fadeOut(500,  function(){
		$('#img').animate({'width':'100%'}, 500);  
	});
	$('#showimage').fadeOut(250, function (){
		$('#showtext').fadeIn(250);										   
	});
});

$('#showtext').click(function(){
	$('#img').animate({'width':'385px'}, 500, function(){
		$('#column-right').fadeIn(500);
		$('#buttons-holder').fadeIn(500);
	});
	$('#showtext').fadeOut(250, function(){
		$('#showimage').fadeIn(250);										 
	});
});

$('#button-join').click(function(){
	$('#join-holder').animate({'left':'0px'}, 250);
});

$('#button-join-close').click(function(){
	$('#join-holder').animate({'left':'421px'}, 250);
});

$('#button-book, .bookit').click(function(){
	$('#book-holder').animate({'left':'0px'}, 250);
});

$('#button-book-close').click(function(){
	$('#book-holder').animate({'left':'421px'}, 250);
});

$('.img-selector').click(function(){
	var imagename = $(this).attr('id').replace('selector-', 'img-');
	var selectorname = $(this).attr('id');
	$('.img-selector-button').attr('src', 'img/img-not-selected.png');
	$('#'+selectorname+'-img').attr('src', 'img/img-selected.png');
	$('.img-images').fadeOut();
	$('#'+imagename).fadeIn();
});

$('#the-bar').mouseenter(function(){
	$('.floorplan:visible').fadeOut(250, function(){
		$('#floorplan-bar-img').fadeIn(250);
		$('#floorplan-bar-title').fadeIn(250);								 
	});
})

$('#the-restaurant').mouseenter(function(){
	$('.floorplan:visible').fadeOut(250, function(){
		$('#floorplan-restaurant-img').fadeIn(250);
		$('#floorplan-restaurant-title').fadeIn(250);								 
	});
})

$('#the-private').mouseenter(function(){
	$('.floorplan:visible').fadeOut(250, function(){
		$('#floorplan-private-img').fadeIn(250);
		$('#floorplan-private-title').fadeIn(250);								 
	});
})
