
//----------------- OVERVIEW IMAGE SWAPPING -----------------------------//

	function show_photos() {
		$("div#video-thumbnails").css("display","none");
		$("div#photo-thumbnails").css("display","block");
		$("div#community-video").css("display","none");
		$("div#community-photo").css("display","block");
	}

	function remove_hovers () {
		$("*.thumbnail-hover-image").attr("src","/images/communities/thumbnails/blank.gif");
	}

	function thumbnail_click(number) {
		remove_hovers();
		var thumbnail_div = "div#image-thumbnail-" + number;
		$(thumbnail_div).find("a").find("img").attr("src","/images/communities/thumbnails/hover.gif");

		$("img#community-photo-img").remove();
		$("div#community-media-desc").html("&nbsp;");
		$('<img src="/images/communities/' + number + '.jpg" id="community-photo-img" width="413" height="261" />').prependTo("div#community-photo");
		$("img#community-photo-img").css("display","none");
		$("div#photo-loading").css("display","block");
		$("img#community-photo-img").load(function() {
			$("div#photo-loading").css("display","none");
			$("img#community-photo-img").css("display","block");
			$("div#community-media-desc").html($(thumbnail_div).find("a").attr("title"));
		});



	}

//----------------- AMENITY IMAGE SWAPPING -----------------------------//

	function remove_amenity_hovers (count) {
		$("div#amenity-" + count + " *.amenity-hover-image").attr("src","/images/communities/thumbnails/blank.gif");
	}

	function amenity_click(count,number) {
		remove_amenity_hovers(count);
		var thumbnail_div = "div#amenity-" + count + " div#amenity-thumbnail-" + number;
		$(thumbnail_div).find("a").find("img").attr("src","/images/communities/thumbnails/hover_small.gif");
		$("img#amenity-photo-" + count).attr("src","/images/communities/" + number + ".jpg");
		$("div#amenity-" + count + " div.amenity-desc").html($(thumbnail_div).find("a").attr("title"));
		$("div#amenity-" + count + " div.amenity-disc").html($(thumbnail_div).attr("title") || "");
	}

//----------------------------- THICKBOX ----------------------------------------//

		// contact us thickbox
		function show_driving_directions(community) {
			tb_show("Driving Directions","/communities/driving-directions.php?community_id=" + community + "&TB_iframe=true&height=500&width=710",0);
		}
		/* schedule a tour thickbox
		function show_schedule_tour(community,project) {
			tb_show("Schedule A Tour","/communities/schedule-a-tour.php?community_id=" + community + "&project_id=" + project + "&TB_iframe=true&height=500&width=710",0);
		}*/
		// schedule a tour thickbox
		function send_to_a_friend(community,project,floorplan) {
			tb_show("Send to a Friend","/communities/send-to-a-friend.php?community_name=" + community + "&project_name=" + project + "&floorplan_name=" + floorplan + "&TB_iframe=true&height=400&width=450",0);
		}

//----------------------------- TOOLTIPS ----------------------------------------//
$().ready(function() {

		$("#oneColumnNav #navProjects *").Tooltip({
			track: true,
			delay: 50,
			showURL: false
		});


//----------------------------- ROUNDED CORNERS ----------------------------------------//

		allcorners = {
			tl: { radius: 5 },
			tr: { radius: 5 },
			bl: { radius: 5 },
			br: { radius: 5 },
			antiAlias: true,
			autoPad: false
    	}

		// tooltip rounding
		var tooltip = document.getElementById("tooltip");
		var tooltipObj = new curvyCorners(allcorners, tooltip);
		tooltipObj.applyCornersToAll();

		// model titlebar
		var model_title = document.getElementById("model-title");
		if(model_title) {
			Nifty("div#model-title","normal,fixed-height");
		}

		// model titlebar
		var community_footer = document.getElementById("community-footer");
		if(community_footer) {
			Nifty("div#community-footer","normal");
		}

		// whats close headers
		var count = 1;
		while(document.getElementById("whats-close-"+count)) {
			Nifty("#whats-close-"+count,"normal,fixed-height");
			count++;
		}

	});