fassDiv = -1; //global
fassDiv_status = true; //global
search_block_status = "shown";
curr_index_img = 1;

$(document).ready(function() {

	$("#bg-exp").fadeTo("fast", .75);
	$("#wmk-logo").pngFix();
	$("#weather-icon").pngFix();
	$('input:text').hint();
	
	$('#menu1 div.menu1-top').hover(
		function() {
			var menu_img = $(this).children('a').children('img');
			if(menu_active != $(menu_img).attr('id')) {
				if ($(menu_img).attr("src").search(/-over/) == -1) {
					$(menu_img).attr({ src: $(menu_img).attr('src').replace(/.jpg/,'-over.jpg')});
				}
			}
			$(this).children('.sub_menu').show();
		},
		function() {
			var menu_img = $(this).children('a').children('img');
			if($(this).children('.sub_menu').length > 0) {
				$(this).children('.sub_menu').fadeOut('fast',
					function() {
						if(menu_active != $(menu_img).attr('id')) {
							$(menu_img).attr({ src: $(menu_img).attr('src').replace(/-over/,'')});
						}
					}
				);
			} else {
				if(menu_active != $(menu_img).attr('id')) {
					$(menu_img).attr({ src: $(menu_img).attr('src').replace(/-over/,'')});
				}
			}
		}
	);
	
	$('.sub_menu div.sub_menu_div_off').hover(
		function() {
			$(this).removeClass("sub_menu_div_off").addClass("sub_menu_div_over");
			$(this).children("a").addClass("sub_menu_div_over_a");
		}, 
		function() {
			$(this).removeClass("sub_menu_div_over").addClass("sub_menu_div_off");
			$(this).children("a").removeClass("sub_menu_div_over_a");
		}
	);
	
	newImage('/content/79/images/nav_home-on.jpg');
	newImage('/content/79/images/nav_home-over.jpg');
	newImage('/content/79/images/nav_experience-on.jpg');
	newImage('/content/79/images/nav_experience-over.jpg');
	newImage('/content/79/images/nav_new-homes-on.jpg');
	newImage('/content/79/images/nav_new-homes-over.jpg');
	newImage('/content/79/images/nav_thelocation-on.jpg');
	newImage('/content/79/images/nav_thelocation-over.jpg');
	newImage('/content/79/images/nav_contact-on.jpg');
	newImage('/content/79/images/nav_contact-over.jpg');
	newImage('/content/79/images/dropdown_on.jpg');
	newImage('/content/79/images/dropdown_over.jpg');
});

function toggleHmSrchImg(siteID) {
	var currentImg = $('#search_block_image').attr("src");
	if(currentImg.substring(currentImg.length - 8) == "plus.jpg") {
		$('#search_block_image').attr("src","/content/" + siteID + "/images/minus.jpg");
	} else {
		$('#search_block_image').attr("src","/content/" + siteID + "/images/plus.jpg");
	}
	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;
}

function trackPage(uri) {
	pageTracker._trackPageview(uri);
}

function selectMenuItem(nhood) {
	$(".menu li a[href*='" + nhood + "']").addClass("active");
}

