    $.ajaxSetup ({  
        cache: false  
   	});  

$(document).ready(function() {
	$('#title_pic').cycle( {
		fx : 'fade',
		speed: 2000
	});
	
	$("#enquiry").validate({
	    rules: {
				first_name: {required: true},
				last_name: {required: true},
				email: {required: true,email:true},
				msg: {required: true}
	},
	
		messages: {
				first_name: " *First name is required",
				last_name: " *Last name is required",
				email: {
					required: " *Email is required",
				    email: " *Real email is required"
				},
				msg: " *Message is required"		    
	}});
	
	
	$("#feedback").validate({
	    rules: {
				first_name: {required: true},
				last_name: {required: true},
				email: {required: true,email:true},
				feedback: {required: true}
	},
	
		messages: {
				first_name: " *First name is required",
				last_name: " *Last name is required",
				email: {
					required: " *Email is required",
				    email: " *Real email is required"
				},
				feedback: " *Feedback message is required"		    
	}});
	
	/*$("div#gallery_show").slideViewerPro({ 
		thumbs: 5,  
        //thumbsPercentReduction: 10, 
        galBorderWidth: 2, 
        galBorderColor: "grey", 
        //thumbsTopMargin: 5, 
        //thumbsRightMargin: 5, 
        //thumbsBorderWidth: 5, 
        thumbsActiveBorderColor: "grey", 
        //thumbsActiveBorderOpacity: 0.5, 
        //thumbsBorderOpacity: 0.5,
        buttonsTextColor: "#707070", 
        leftButtonInner: "<img src='images/left.png' />", 
        rightButtonInner: "<img src='images/right.png' />", 
        autoslide: true,  
        typo: true,
        shuffle: true
        });*/
	
	$('#galleryShow').galleryView({
		panel_width: 700,
		panel_height: 500,
		frame_width: 60,
		frame_height: 50,
		transition_speed: 200,
		transition_interval: 4000,
		frame_gap:20

		//frame_width: 100,
		//frame_height: 100

	});
	
});






var map = null;
var geocoder = null;
var marker = null;

function initialize() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setMapType(G_NORMAL_MAP);
		//map.setCenter(new GLatLng(-36.890000,174.761200),11);   
		geocoder = new GClientGeocoder();
		map.addOverlay(showAddress('47 Balmoral Road, Mt Eden, Auckland'));
	}
}

function createMarker(point, title, html) {
	var marker = new GMarker(point);

	GEvent
			.addListener(
					marker,
					"click",
					function() {
						marker
								.openInfoWindowHtml('<b><br/>47 Balmoral Road <br/>Mt Eden<br/>Auckland<br/>New Zealand</b>');
					});

/*	GEvent
			.addListener(
					marker,
					"mouseover",
					function() {
						marker
								.openInfoWindowHtml('<b><br/>47 Balmoral Road <br/>Mt Eden<br/>Auckland<br/>New Zealand</b>');
					});*/
	return marker;
}

function showAddress(address) {
	if (geocoder) {
		geocoder
				.getLatLng(
						address,
						function(point) {
							if (!point) {
								alert(address
										+ " not found Or check your internet connection!");
							} else {
								if (marker) {
									map.removeOverlay(marker);
								}

								map.setCenter(point, 16);

								var title = "Mt Eden Motel";

								marker = createMarker(point, title, address);

								map.addOverlay(marker);

								marker
										.openInfoWindowHtml('<b><br/>47 Balmoral Road <br/>Mt Eden<br/>Auckland<br/>New Zealand</b>');
							}
						});
	}
}



