$(function() {
	//messagebar
	$('#messageflash').hide();
	$('#messageflash').slideDown('slow').delay(5000).slideUp('slow');

	//showhide recaptcha
	if (!($('#errormessage').children().size() > 0 )){
  		$("#recaptcha_area").hide();
  	}

  	$("form input").change(function(){
		$("#recaptcha_area:hidden").show("slow");
  	});


	if (!$.browser.webkit ) {
/*		$(".bucket1 img").rotate(-3);
		$(".bucket2 img").rotate(3);
		$(".bucket3 img").rotate(-2);
		$(".bucket4 img").rotate(1);
		*/
		
		$(".bucket img").hide();
		$("#buckets").css('background-image', 'url(/images/layout/bucketsbg-full.jpg)');
		
	}
	
	
	//product fancybox
	$(".gallery a").fancybox({
		'titlePosition': 'over',
		'autoScale': 'true'
	});
	
	//news fancybox
	$("#newsright a").fancybox({
		'titlePosition': 'over',
		'autoScale': 'true'
	});

	//googlemaps
	if ($('#map').length>0){
		initialize();
	}

});

//google maps function
function initialize() {
    var centerlatlng = new google.maps.LatLng(53.743225,-0.358059);
    var pinlatlng = new google.maps.LatLng(53.741313,-0.3576);
	var myOptions = {
    	zoom: 15,
    	center: centerlatlng,
    	mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map"), myOptions);

 	var contentString = '<div id="mapcontent">'+
        '<h3>House of Light</h3>' +
        '<p><b>Address</b><br/>' +
		'House of Light<br/>'+
		'c/o Living Hope Christian Church<br/>'+
		'Linnaeus Street<br/>'+
		'Hull<br/>'+
		'HU3 2QA</p>'+
		'<p><b>Telephone</b><br/>0800 043 2031</p>'+
		'<p><a target="_blank" href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=HU3+2QA&aq=&sll=53.768658,-0.315193&sspn=0.321426,0.530777&ie=UTF8&hq=&hnear=Hull,+North+Humberside+HU3+2QA,+United+Kingdom&z=16">Get Directions</a></p>'+
        '</div>';

	var infowindow = new google.maps.InfoWindow({
	   	content: contentString
	});
	 
    var marker = new google.maps.Marker({
	   	position: pinlatlng,
	   	map: map,
	   	title: 'House of Light'
	});
	
	google.maps.event.addListener(marker, 'click', function() {
       infowindow.open(map,marker);
    });
}
