	//form validation	
			$(document).ready(function() {
				$("#validate").validate();
				$("#form").validate();
				$("#unitform").validate();
			});


	//homepage rounded corners
			$(function(){
				$('#home-content .text').corners();
			});


	//show inquiry other text field
			$(function(){
				$('.hearRadio').click(function(){
					$('#hearOtherText').hide();
				});
				$('.hearOther').click(function(){
					$('#hearOtherText').show();
				});
			});


	//commercial landing page search tabs
			$(function(){
				$('#search-tabs li').click(function(){
					var showtab = $(this).attr('id');
					var hidetab = $('#search-tabs li.active').attr('id');
					$('#search-tabs li').removeClass('active');
					$(this).addClass('active');
					$('#search-inner .'+hidetab).hide();
					$('#search-inner .'+showtab).show();
				});
			});


	//property detail photo gallery
			$(function(){
				$("#slider").easySlider();

				$('#gallery li:first').attr("class","active");
				$('#property-details ul#gallery li').click(function(){
					var id = $(this).attr('id');
					var img = $("#"+id+" img").attr('src').replace('/thumbs','/233x152');
					var alt = $("#"+id+" img").attr('alt');
					var link = $("#"+id+" img").attr('src').replace('/thumbs','');
					var caption = $("#"+id+" img").attr("title");
					$('p.caption').text(caption);
					$('img.main').attr('src',img);
					$('a.main_lb').attr('title',alt);
					$('a.main_lb').attr('href',link);
					$('#property-details .active').attr("class","images");
					$('#'+id).attr("class","active");
				});

				$('div.main_img').append($("<span>click to enlarge</span>"));


//				$('div.main_img').hover(
//					function () {
//						$(this).append($("<span>click to enlarge</span>"));
//					},
//					function () {
//						$(this).find("span:last").remove();
//					}
//				);
			});


	//property detail show/hide menu extras
			$(function(){
				//$('.property-details').hide();
				//$('.additional-info li.jq:first').css({"font-weight":"bold"});

				//$(showDetails).show();

				//$('.additional-info li.jq').click(function(){
				//	$('.property-details').hide();
				//	var show = $(this).attr('id');
				//		load();
				//	$('#'+show).show();
				//	$('.additional-info li.jq').css({"font-weight":"normal"});
				//	$(this).css({"font-weight":"bold"});
				//});

			});


	//commercial search select all check box
			$(function(){
				$('input.all').click(function(){
					var show = $(this).attr('id');
					if ($(this).attr('checked') == true){
						$('input.'+show).attr('checked',true);
					}
					else{
						$('input.'+show).attr('checked',false);
					}
				});
			});


	//residential search show/hide purchase/lease prices
			$(function(){
				$('#search-inner .purchase').hide();
				$('#search-inner .lease').hide();

				if(searchInner != '')
					$(searchInner).show();

				$('#search-inner input.contract').click(function(){
					var show = $(this).attr('value');
					if (show == '')
					{
						$('#search-inner .purchase').show();
						$('#search-inner .lease').show();
					}
					else
					{
						$('#search-inner .purchase').hide();
						$('#search-inner .lease').hide();
						$('#search-inner .'+show).show();
					}
				});
			});


	//residential search show/hide advanced options
			$(function(){

				$('.more-options').click(function(){

					$('#search-advanced').toggle("slow");
					var current = $('.more-options span').text();
					if(current == 'More Options'){
						$('.more-options span').text('Less Options');
						$('.more-options img').attr('src','/content/images/minus.gif');
					}
					else{
						$('.more-options span').text('More Options');
						$('.more-options img').attr('src','/content/images/plus.gif');
					}
				});
			});

	//commercial show/hide browse options
			$(function(){
				$('.com-more-options').click(function(){
					$('#commercial-search .com-browse-container').toggle('slow');
					var current = $('.com-more-options span').text();
					if(current == 'Show Options'){
						$('.com-more-options span').text('Hide Options');
						$('.com-more-options img').attr('src','/content/images/minus.gif');
					}
					else{
						$('.com-more-options span').text('Show Options');
						$('.com-more-options img').attr('src','/content/images/plus.gif');
					}
				});
			});

	//commercial search show/hide units
			$(function(){
				$('#availability .show-units').click(function(){
					var b = $(this).attr('id');
					var src = $(this).attr('src');

					//show available units
					$('#availability div#'+b).toggle(300);

					//change minus to plus
					if(src == '/content/images/gplus.gif'){
						$(this).attr('src','/content/images/gminus.gif');
					}
					else{
						$(this).attr('src','/content/images/gplus.gif');
					}
				});
			});

//google maps
if(address != ''){
	var map;
    var gdir;
    var geocoder = null;
    var addressMarker;
    var fromPoint;
    var toPoint;

	function load() {
		if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("mapcontainer"));
			var geocoder = new GClientGeocoder();
			showAddress(address);
			var mapControl = new GMapTypeControl();
			map.addControl(mapControl);
			map.addControl(new GLargeMapControl());
		}

		function showAddress(address) {
			geocoder.getLatLng(
		    	address,
		    	function(point) {
		    		if (!point) {
		    			//alert(address + " not found");
		    			$("p.google-map-not-found").remove();
		    			$("#map .form").append("<p class='google-map-not-found'>"+address+" not found.</p>")
		    		}
		    		else {
		    			map.setCenter(point, 13);
		    			var marker = new GMarker(point);
		    			map.addOverlay(marker);
		    			marker.openInfoWindowHtml(address);
		    			map.checkResize("mapcontainer");
		      		}
		    	}
		  	);
		}
	}


    function setDirections(fromAddress, toAddress) {
		document.getElementById('directions').innerHTML = '';
    	map = new GMap2(document.getElementById("mapcontainer"));
    	var mapControl = new GMapTypeControl();
		map.addControl(mapControl);
		map.addControl(new GLargeMapControl());
      	gdir = new GDirections(map, document.getElementById("directions"));
      	GEvent.addListener(gdir, "load", onGDirectionsLoad);
      	GEvent.addListener(gdir, "error", handleErrors);
		gdir.load("from: " + fromAddress + " to: " + toAddress);
		map.checkResize("mapcontainer");
    }

    function handleErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);

	   else alert("An unknown error occurred.");
	}

	function onGDirectionsLoad(){
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}
}
