// SWF Object Code (DISPLAYS FLASH)
var flashvars = {};
	var params = {
	  menu: "false",
	  wmode: "transparent",
	  quality: "high"
	};
	var attributes = {};
	
	swfobject.embedSWF("flash/map.swf", "map", "399", "412", "8.0.0","", flashvars, params, attributes);
	
	
	
	
//FANCYBOX
$(document).ready(function() {
						   
	$(".neighborhoodImgs a").fancybox({
	 'overlayShow' : false,
	 'zoomSpeedIn' : 600,
	 'zoomSpeedOut' : 500,
	 'easingIn' : 'easeOutBack',
	 'easingOut' : 'easeInBack'
	 });
	
	$(".testimonials a").fancybox({
	 'overlayShow' : false,
	 'zoomSpeedIn' : 600,
	 'zoomSpeedOut' : 500,
	 'easingIn' : 'easeOutBack',
	 'easingOut' : 'easeInBack',
	 'frameHeight' : 450
	 });
	
	//CYCLE -- Following code makes javacript run in a pre tag in the body
	$(function() {
		// run the code in the markup!
		$('pre').each(function() {
			eval($(this).text());
		});
	});




//FORM for sell us your land

	$('#form').submit(function(){
	
		 var action = $(this).attr('action');
	
			 $.post(action, {
					 name: $('#name').val(),
					 email: $('#email').val(),
					 comments: $('#comments').val()
				},
	
				 function(data){
				 //$('#cForm').fadeIn(1000);
				 //$('.response').fadeOut(500,function(){$(this).remove()});
				 var newdatas = data.split("|||||");
				 if(newdatas.length <= 1) {
					newdatas[1] = data;
					}
				 $('.response').remove()
				 $('#form').before('<div align="center"><div class="response" align="center">'+newdatas[1]+'</div></div>');
				 $('.response').slideDown()
					 if(newdatas[0]=='true') {
						 $('#form').slideUp();
					 }
	
				 }
		 );
	
	 return false;
	
	 });

//FORM for Contact 

	$('#contact').submit(function(){
	
		 var action = $(this).attr('action');
	
			 $.post(action, {
					 name: $('#name').val(),
					 address: $('#address').val(),
					 apartment: $('#apartment').val(),
					 city: $('#city').val(),
					 state: $('#state').val(),
					 zip: $('#zip').val(),
					 community: $('#community').val(),
					 email: $('#email').val(),
					 homephone: $('#homephone').val(),
					 workphone: $('#workphone').val(),
					 comments: $('#comments').val()
				},
					
				 function(data){
				 //$('#cForm').fadeIn(1000);
				 //$('.response').fadeOut(500,function(){$(this).remove()});
				 var newdatas = data.split("|||||");
				 if(newdatas.length <= 1) {
					newdatas[1] = data;
					}
				 $('.response').remove()
				 $('#contact').before('<div align="center"><div class="response" align="center">'+newdatas[1]+'</div></div>');
				 $('.response').slideDown()
					 if(newdatas[0]=='true') {
						 $('#contact').slideUp();
					 }
	
				 }
		 );
	
	 return false;
	
	 });
 });