$(document).ready(function() {
	//Load facebox
	$('a[rel*=facebox]').facebox({
		loading_image : 'loading.gif',
		close_image   : 'closelabel.gif'
	});
	
	//Load Google map in facebox
	$(document).bind('reveal.facebox', function() {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("amap"));
			map.setCenter(new GLatLng(-33.797944,151.288369), 17);
			map.addControl(new GMapTypeControl());     // Map, Sat, Hybird
			map.addControl(new GLargeMapControl());    // Large Pan + Zoom
			map.addControl(new GScaleControl());       // Scale
			map.addControl(new GOverviewMapControl()); // Zoomed out Overlay
			var map2 = new GMap2(document.getElementById("nmap"));
			map2.setCenter(new GLatLng(-36.846599,174.767386), 17);
			map2.addControl(new GMapTypeControl());     // Map, Sat, Hybird
			map2.addControl(new GLargeMapControl());    // Large Pan + Zoom
			map2.addControl(new GScaleControl());       // Scale
			map2.addControl(new GOverviewMapControl()); // Zoomed out Overlay
			function createMarker(point, text) {
				var marker = new GMarker(point);
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(text);
				});
				return marker;
			}
			var point = new GLatLng(-33.798269,151.287151);
			map.addOverlay(createMarker(point, "<img src='images/map.jpg' style='float:left; padding:0 5px 5px 0;'>Level 4, 1a Rialto Lane,<br>Manly NSW 2095<br>T: +61 2 9976 6222<br>E: <a href='mailto:stephen.kulmar@retailoasis.com'>Email Retail Oasis</a>"));
			//var pointa = new GLatLng(-36.846672,174.767171);
			//map2.addOverlay(createMarker(pointa, "<img src='images/map.jpg' style='float:left; padding:0 5px 5px 0;'>18 Shortland Street,<br>Auckland City, 1140<br>T: +64 21 471 698<br>E: <a href='mailto:lindy.shuttleworth@retailoasis.com'>Email Retail Oasis</a>"));
		}
	});

	//Our people slider
	jQuery(window).bind("load", function() {
		jQuery("div#slider1").codaSlider()
			// jQuery("div#slider2").codaSlider()
		// etc, etc. Beware of cross-linking difficulties if using multiple sliders on one page.
	});

	//Close the error box for form pages
	$('a#error-link').click(function() {
		$('#error-box').slideUp('slow');
		return false;
	});

	//Text box hide text
	$('input[type="text"]').addClass("idleField");
	$('input[type="text"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
    });
});			