fassDiv = -1; //global
fassDiv_status = true; //global
search_block_status = "shown";
curr_index_img = 1;

$(document).ready(function() {
	$('input:text').hint();
	$('#thumb_images img').addClass("clickable");
	
	if(navigator.userAgent.search(/macintosh/i) == -1 || navigator.userAgent.search(/firefox/i) == -1) {
		$('#menu-img-one, #menu-img-two, #menu-img-three').fadeTo('fast', .5);
	}
	
	$('.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");
		}
	);
	
	$('#experience_menu').hover(
                function() {
                        $(this).children(".sub_menu").show();
                },
                function() {
                        $(this).children(".sub_menu").slideUp('fast', 
                        	function() {
                        		if (menu_active != 'experience') {
                        			$('#experience').attr({ src: '/content/80/images/nav_experience.jpg' });
                        		}
                        	}
                        );
                }
        );
	
	$('#new-homes_menu').hover(
                function() {
                        $(this).children(".sub_menu").show();
                },
                function() {
                        $(this).children(".sub_menu").slideUp('fast', 
                        	function() {
                        		if (menu_active != 'new-homes') {
                        			$('#new-homes').attr({ src: '/content/80/images/nav_new-homes.jpg' });
                        		}
                        	}
                        );
                }
        );
	
	$('#thelocation_menu').hover(
                function() {
                        $(this).children(".sub_menu").show();
                },
                function() {
                        $(this).children(".sub_menu").slideUp('fast', 
                        	function() {
                        		if (menu_active != 'thelocation') {
                        			$('#thelocation').attr({ src: '/content/80/images/nav_thelocation.jpg' });
                        		}
                        	}
                        );
                }
        );
	
	if(navigator.userAgent.search(/macintosh/i) == -1 || navigator.userAgent.search(/firefox/i) == -1) {
		$('#menu-img-one').hover(
			function() {
	                	$(this).fadeTo('fast', 1);
	                },
	                function() {
	                	$(this).fadeTo('fast', .5);
	                }
		);
		$('#menu-img-two').hover(
			function() {
	                	$(this).fadeTo('fast', 1);
			},
			function() {
	                	$(this).fadeTo('fast', .5);
			}
		);
		$('#menu-img-three').hover(
			function() {
	                	$(this).fadeTo('fast', 1);
			},
			function() {
	                	$(this).fadeTo('fast', .5);
	                }
		);
	}
		
	newImage('/content/80/images/nav_home-on.jpg');
	newImage('/content/80/images/nav_home-over.jpg');
	newImage('/content/80/images/nav_experience-on.jpg');
	newImage('/content/80/images/nav_experience-over.jpg');
	newImage('/content/80/images/nav_new-homes-on.jpg');
	newImage('/content/80/images/nav_new-homes-over.jpg');
	newImage('/content/80/images/nav_thelocation-on.jpg');
	newImage('/content/80/images/nav_thelocation-over.jpg');
	newImage('/content/80/images/nav_contact-on.jpg');
	newImage('/content/80/images/nav_contact-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");
}

