$(document).ready(function(){
													 
	// Email protect
	$("span.safemail").each(function(){
		exp = $(this).text().search(/\((.*?)\)/) != -1 ? new RegExp(/(.*?) \((.*?)\)/) : new RegExp(/.*/);
		match = exp.exec($(this).text());
		addr = match[1] ? match[1].replace(/ at /,"@").replace(/ dot /g,".") : match[0].replace(/ at /,"@").replace(/ dot /g,".");
		link = match[2] ? match[2] : addr;
		subject = $(this).attr('title') ? "?subject="+$(this).attr('title').replace(/ /g,"%20") : "";
		$(this).after('<a href="mailto:'+addr+subject+'">'+ link + '</a>');
		$(this).remove();
	});
	
	// JQUERY Input rollover
	$('input.send[type = "submit"]').css('font-size', '0px');
	$('input.send[type = "submit"]').css('text-indent', '-9999em');
	$('form.baseform input.send').css('cursor', 'pointer').hover(function() {$(this).addClass('sendhover');}, function() {$(this).removeClass('sendhover');});
	
	
	
	// Drop down menu
	$("#navigation ul li#land").hover(function(){
		$(this).find('ul').slideDown('fast');
		return false;
		},function(){
		$(this).find('ul').slideUp('fast');
	});


	// Navigation Active
	$("#navigation ul li ul").hover(function(){
		$(this).parent().addClass("active");
		},function(){
		$(this).parent().removeClass("active");
	});

	
	// Map rollover
$('#release').maphilight({fill: true, fillColor: '9ceb70', fillOpacity: 0.5, stroke: true, strokeColor: 'ffffff', strokeOpacity: 0, strokeWidth: 0, fade: true, alwaysOn: false});
	// Map rollover
$('#release #releasesold').maphilight({fill: true, fillColor: 'ff2e1d', fillOpacity: 0.5, stroke: true, strokeColor: 'ffffff', strokeOpacity: 0, strokeWidth: 0, fade: true, alwaysOn: false});
	
	// Open links in new window when rel="external" is applyed to a tag										 
	$('a[rel$="external"]').click(function(){this.target="_blank";});
	

	
	//	Logo link
	$('#header h1').css('cursor', 'pointer').click( function(){window.location = './';});
		
	// Slideshow (fade in/out)
	$('#image').cycle({ 
		fx:    'fade', 
		speed:  4000
	 });

	$("#map").gMap({ 
		controls: false,
		scrollwheel: false,
		markers: [{ latitude: -32.0603398,
		longitude: 115.7490936,
		html: "<strong>Terranovis Pty Ltd</strong><br />Licensed Real Estate Agent<br />Level 1, 1 Howard Street<br />Fremantle<br />Western Australia 6160",
		popup: true }],
		zoom: 16
	});

	
	
	
	// Form active
	$("input, textarea").addClass("idle");
	$("input, textarea").focus(function(){
		$(this).addClass("activefield").removeClass("idle");
	}).blur(function(){
		$(this).removeClass("activefield").addClass("idle");
	});
	
	
	

});
