  $(document).ready(function(){ 
		 
		var postcode_map_id = document.getElementById("postcode_geomap").value;
		
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(54.622978,-2.592773), 5, G_HYBRID_MAP);
		usePointFromPostcode(postcode_map_id, setCenterToPoint);
		usePointFromPostcode(postcode_map_id, placeMarkerAtPoint);
		
		// PNG Fix Implementation
		//$(document).pngFix(); 
		
		
		// Accordian Panel
		$(".content").hide();
		$('<img src="/_images/_icons/arrow-down.png" class="arrow" />').insertAfter('a h1'); 				   
		$("a h1").click(function(){
			if($(this).is(".active")) {
			 $(this).toggleClass("active");
			 $('.arrow.active').attr('src','/_images/_icons/arrow-down.png'); // change the image src of the current ACTIVE image to have an INACTIVE state.
			 $(this).parent().next(".content").slideToggle();
			
			 return false;
			} else {
				$(".content:visible").slideUp("slow"); // close all visible divs with the class of .content
				$("h1.active").removeClass("active");  // remove the class active from all h1's with the class of .active
				$(this).toggleClass("active");
				$('.arrow.active').attr('src','/_images/_icons/arrow-down.png'); // change the image src of the current ACTIVE image to have an INACTIVE state.
				$(".arrow").addClass('active');
				$(this).siblings('.arrow.active').attr('src','/_images/_icons/arrow-up.png'); // change the image src of the new active image to have an active state.
				$(this).parent().next(".content").slideToggle();
				
	
				
				return false;
			}
		});
		
		$("#submit").click(function(){					   				   
		
			$(".error").hide();
			
			var hasError = false;
			
			
			var fnameVal = $("#fname").val();
			var telFromVal = $("#emailFrom").val();
			messageVal = fnameVal + ' has requested a callback on ' + telFromVal + ' whilst viewing the property at http://www.propertymanagement.co.uk'+ window.location.pathname + '\n\n';
			messageVal = messageVal + 'Property Information\n\n';
			messageVal = messageVal + 'Name: '+PropertyTitle+'\n\n';
			messageVal = messageVal + 'Type: '+PropertyType+'\n\n';
			messageVal = messageVal + 'Area: '+PropertyArea+'\n\n';
			messageVal = messageVal + 'Postcode: '+PropertyPostcode+'\n\n';
			messageVal = messageVal + 'Bedrooms: '+PropertyBedrooms+'\n\n';
			messageVal = messageVal + 'Price: '+PropertyValue+'\n\n';
			
			
			
			if(fnameVal == '') {
				$("#fname").css('border-color', '#be1f25');
				$("#fname").after('<div class="error">Please enter your name.</div>');
				hasError = true;
				} else	if(telFromVal == '') {
				
					$("#emailFrom").css('border-color', '#be1f25');
					$("#emailFrom").after('<div class="error">Please enter your phone number.</div>');
					hasError = true;
				
					} 
			
			if(hasError == false) {
				$(this).hide();
				
				
				$.post("/sendemail.php",
					{ emailTo: 'enquiries@propertymanagement.co.uk', emailFrom: 'support@propertymanagement.co.uk', subject: 'Requested Callback', message: messageVal },
						function(data){
							$("#sendEmail").slideUp("normal", function() {				   
								
								$("#sendEmail").before('<span class="success">Callback Requested</style><br /><p class="formLabel">A member of our team will call you shortly.</p>');											
							});
						}
					 );
			}
			
			return false;
		});		
    }); 
	
