// build the divs for the google map - these hold the content inside the pop up
var mittagong = '<div class="map_pop_up"><h5>Visitors Information Centre</h5><p><strong>Phone:</strong> (02) 4871 2888<br /><strong>Local Call:</strong> 1300 657 559<br /><strong>Fax:</strong> (02) 4871 3515</p></div>';
var bowral = '<div class="map_pop_up"><h5>Bradman Museum of Cricket</h5><p><strong>Phone:</strong> (02) 4862 1247<br /><strong>Fax:</strong> (02) 4861 2536<br /><strong>Email:</strong> <a href="mailto:info@bradman.com.au">info@bradman.com.au</a></p></div>';
var bundanoon = '<div class="map_pop_up"><h5>Bundanoon Motel</h5><p><strong>Phone:</strong> (02) 4883 6068<br /><strong>Email:</strong> <a href="mailto:admin@countryinn.com.au">admin@countryinn.com.au</a></p></div>';
var robertson = '<div class="map_pop_up"><h5>Robertson Cheese Factory</h5><p><strong>Phone:</strong> (02) 4885 1300<br /><strong>Fax:</strong> (02) 4887 7002<br /></p></div>';			


function check_form(frm) {
	var enquiry_type = $('#enq_type').val();
	var street_address = $('#street_address').val();
	var message = $('#message').val();
	var company_name = $('#conference_isset').val();
		
	var comments = '';					
	comments = 'Enquiry type: ' + enquiry_type;
	if(company_name.length > 0) comments += '. Company name: ' + company_name;
	comments += '. Street address: ' + street_address;
	comments += '. Message: ' + message;
	
	$('#txtComments').attr('value', comments);			
	$('#enquiry_form').attr('action', 'http://svc081.bookeasy.com/contact2_sendmail.asp');
				
	frm.submit();			
}

$(document).ready(function() {

	// general page functions
	
	$("#enquiry_form").validate();
	
	// hide and show an div depending on wether you clicked on a specific item in the drop down list
	$('option[value="conference"]').click(function() {
		$("p.conference_box").slideDown("fast");
		$("p.conference_box").removeClass("hidden");
		//$("div.conference_box").animate({ backgroundColor: "#fff7b4" }, 300);
		//$("div.conference_box").animate({ backgroundColor: "#FFFDED" }, 200);
	});
	
	// slide up the conference div if you click on another option
	$('option.list').click(function() {
		$("p.conference_box").slideUp("fast");
	});
	
	// slide the thank you and error messages
	$('.thankyou_message').css('cursor', 'pointer');
	$('.thankyou_message').click( function () {
		$('.thankyou_message').slideUp();
	});
	
	$('.error_message').css('cursor', 'pointer');
	$('.error_message').click( function () {
		$('.error_message').slideUp();
	});
});

// unload
$(window).load(function() {

	if(GBrowserIsCompatible()) {
		
		// custom icon
		var icon = new GIcon();
		icon.image = "http://www.southern-highlands.com.au/images/information_icon_small.png";
		icon.iconSize = new GSize(38, 36);
		icon.iconAnchor = new GPoint(23, 23);
		icon.infoWindowAnchor = new GPoint(31, 8);
		
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		
		map.setCenter(new GLatLng(-34.539856, 150.448988), 10);
	
		// start locations
		
		// mittagong
		var point = new GLatLng(-34.449737, 150.451627);
		var mmittagong = new GMarker(point, icon);
		map.addOverlay(mmittagong);
		GEvent.addListener(mmittagong, "click", function()
		{
			mmittagong.openInfoWindowHtml(mittagong);
		});
		
		// bowral
		var point = new GLatLng(-34.48354, 150.42331);
		var mbowral = new GMarker(point, icon);
		map.addOverlay(mbowral);
		GEvent.addListener(mbowral, "click", function()
		{
			mbowral.openInfoWindowHtml(bowral);
		});
		
		// bundanoon
		/*
		var point = new GLatLng(-34.656827, 150.298667);
		var mbundanoon = new GMarker(point, icon);
		map.addOverlay(mbundanoon);
		GEvent.addListener(mbundanoon, "click", function()
		{
			mbundanoon.openInfoWindowHtml(bundanoon);
		});
		*/
		
		// robertson
		var point = new GLatLng(-34.589349, 150.601289);
		var mrobertson = new GMarker(point, icon);
		map.addOverlay(mrobertson);
		GEvent.addListener(mrobertson, "click", function()
		{
			mrobertson.openInfoWindowHtml(robertson);
		});	
				
	}
}).unload( function () { GUnload; } );


