/* WYC javascript */

search_block_status = "shown";

$(document).ready(function() {

	// png/opacity fixes
	if (!jQuery.support.opacity && !jQuery.browser.msie) {
		$('#left-bar').fadeTo(1, 0.2);
	}
	$('.img_png').pngFix();

	// textbox input hinting where title attribute is present
	$('input:text').hint();
	
	// setup correct active menu
	activateMenuWYCItems();
});


function toggleHmSrchImg(siteID) {
	var currentImg = $('#search_block_image').attr("src");
	if(currentImg.substring(currentImg.length - 8) == "plus.gif") {
		$('#search_block_image').attr("src","/content/" + siteID + "/images/minus.gif");
	} else {
		$('#search_block_image').attr("src","/content/" + siteID + "/images/plus.gif");
	}
	if(search_block_status == "shown") {
		$('#inventory_search_block_form').animate({ height:"hide" }, { queue:true, duration:500 });
		search_block_status = "hidden";
	} else {
		$('#inventory_search_block_form').animate({ height:"show" }, { queue:true, duration:500 });
		search_block_status = "shown";
	}
	return false;
}

// search left-side nav for correct active link for residence detail pages
function activateMenuWYCItems() {
	if(location.href.search(/new-homes\/castillo\/residence/) > -1 ) {
		$("#content_left a[href='/new-homes/castillo-tower']").addClass("active");
	} //bayfront estates
		else if (location.href.search(/new-homes\/bayfront-estates\//) > -1 ) {
		$("#content_left a[href='/new-homes/search/home-type/bayfront-estates']").addClass("active");
	} //boulevard
		else if (location.href.search(/new-homes\/boulevard-homes\//) > -1 ) {
		$("#content_left a[href='/new-homes/search/home-type/boulevard-homes']").addClass("active");
	} //single-family
		else if (location.href.search(/new-homes\/single-family\//) > -1 ) {
		$("#content_left a[href='/new-homes/search/home-type/single-family']").addClass("active");
	} //townhomes
		else if (location.href.search(/new-homes\/townhomes\//) > -1 ) {
		$("#content_left a[href='/new-homes/search/home-type/townhomes']").addClass("active");
	} //quick delivery
		else if (location.href.search(/new-homes\/inventory\//) > -1 ) {
		$("#content_left a[href='/new-homes/search/quick-delivery']").addClass("active");
	}

	return false;	
}

function trackPage(uri) {
	if (typeof(pageTracker) != "undefined") {
		pageTracker._trackPageview(uri);
	}
}


