$(function() {
	$(window).scroll(function(){
		var scrollTop = $(window).scrollTop();
		if(scrollTop != 0)
			$('#topMenu').stop().animate({'opacity':'0.3'},400);
		else
			$('#topMenu').stop().animate({'opacity':'1'},400);
	});

	$('#topMenu').hover(
		function (e) {
			var scrollTop = $(window).scrollTop();
			if(scrollTop != 0){
				$('#topMenu').stop().animate({'opacity':'1'},400);
			}
		},
		function (e) {
			var scrollTop = $(window).scrollTop();
			if(scrollTop != 0){
				$('#topMenu').stop().animate({'opacity':'0.3'},400);
			}
		}
	);
});

$(function(){

    $('a[href*=#]').click(function() {
    
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
        
            var $target = $(this.hash);
            
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            
            if ($target.length) {
            
                var targetOffset = $target.offset().top;
                
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                    
                return false;
                
            }
            
        }
        
    });
    
});

$(document).ready(function(){

	$("h6").append('<em></em>')

	$(".thumbs a").click(function(){

	  var largePath = $(this).attr("href");
	  var largeAlt = $(this).attr("title");

	  $("#largeImg").attr({ src: largePath, alt: largeAlt });

	  $("h2 em").html(" (" + largeAlt + ")"); return false;
	});

});

$(function() {
    $("#map").gMap({ markers: [{ latitude: -32.721877,
                              longitude: 25.583489,
                              html: "<b>Blue Crane Bed and Breakfast</b><br />Somerset East<br />Eastern Cape<br />South Africa",
                              popup: true }] });
});


