$(document).ready(function(){
$(".iframer").colorbox({width:"1024px", height:"700px", iframe:true});


$(".view_all").click(function()				
			{
				var checked_status = this.checked;
				$(".suburbCheckbox").each(function()
				{
					this.checked = checked_status;
				});
			});		

	$('.showsub').bind('click', function() {
		
		$('.success').remove();
		$('.submitting').remove();
		
		$('#showform').fadeIn();
			return false;
		});
		
		$('#email_address').bind('focus', function() {
			if($(this).val() == "email address") {
                $(this).val(''); 
                }
				return false;
			});

	$('#email_address').bind('blur', function() {
			if($(this).val() == "") {
                $(this).val('email address'); 
                }
				return false;
			});

	$("#submit").click(function(){
	//	$(".error").hide();
		var hasError = false;
		var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var emailToVal = $("#email_address").val();
		if(emailToVal == '') {
			$("#error").after('<span class="error">Please enter an email address</span>');
			hasError = true;
		} else if(!emailReg.test(emailToVal)) {
			$("#error").after('<span class="error">The email address entered, isn\'t valid</span>');
			hasError = true;
		}

		if(hasError == false) {
		$('.emailsub').hide();
			$(".emailsub").after('<div class="submitting">Sending subscription, please wait.</div>');
			}

		if(hasError == false) {
		var email_address = $("#email_address").val();
		$.post("/includes/subscribe.php",
		   { email_address: email_address},
		   	function(data){
				$(".submitting").fadeOut("normal", function() {
					$(".emailsub").after('<div class=\'success\'><h1>Thank you</h1><p>Subscription complete</p></div>');
					//$("#error").after('<h1>Success</h1><p>Your email was sent.</p>');
					});
				}
			);
		
			return false;
	}

	return false;


	});

	});


	function getproperty(id){
			
	var docHeight = $(document).height();

   $("body").append("<div id='overlay'></div>");

   $("#overlay")
      .height(docHeight)
      .css({
         'opacity' : 0.8,
         'position': 'absolute',
         'top': 0,
         'left': 0,
         'background-color': 'black',
         'width': '100%',
         'z-index': 10
      });	
			
			
		$('#ajaxwindow').fadeIn().load('/pages/components/'+id+'/get_property.php');
		window.scrollTo(0, $('#top').position().top);
		}

		function closeproperty(){
		
		$('#ajaxwindow').fadeOut();
		$("#ajaxwindow").html("");
		$("#overlay").remove();
			}
		
		function switch_image(turnthison){
			$('.heroes').hide();
			$('#image_'+turnthison).fadeIn();
		}
		
	/*
$(function()
	{
		$("#map").gMap({ markers: [{ address: "174 Peel Street, Windsor, Melbourne"
									   }],
									   zoom: 16 });
	});
*/
function open_popup (link, event)
	{
		var popup;

		popup = window.open (link.href);
		if ('focus' in popup) {
			popup.focus ();
		}
		if ('preventDefault' in event) {
			event.preventDefault ();
		} else if ('returnValue' in event) {
			event.returnValue = false;
		}
	}

