function checksearch(fe){
	if (fe.search.value.length < 2){
		$("#search_error").html('Please enter at least 2 characters for the search.').slideDown();
		fe.search.style.background = '#FFDDDD';
		fe.search.focus();
		setTimeout('$("#search_error").slideUp();', 5000);
		return false;
	}

	return true;
}


$(document).ready(function(){
	$("#extended_search_hide").hide();

	$("#extended_search_trigger").click(function(){
		$("#extended_search").slideDown();
		$("#extended_search_trigger").hide();
		$("#extended_search_hide").show();
		return false;
	});

	$("#extended_search_hide").click(function(){
		$("#extended_search").slideUp();
		$("#extended_search_hide").hide();
		$("#extended_search_trigger").show();
		return false;
	});

	$("#unfold_search_trigger").click(function(){
		$("#searchForm").slideDown();
		$(this).parent().hide();
		return false;
	});


	$("#search").click(function(){
		if (this.value == "Enter City & State, Lake Name or Zip Code") this.value="";
		$(this).css("color", "#000000");
	}).blur(function(){
		if (this.value==""){
			this.value = "Enter City & State, Lake Name or Zip Code";
			$(this).css("color", "#cccccc");
		}
	});


    $('a.lightbox').lightBox({
      	imageLoading: '/_style/images/lightbox-ico-loading.gif',
      	imageBtnClose: '/_style/images/lightbox-btn-close.gif',
      	imageBtnPrev: '/_style/images/lightbox-btn-prev.gif',
      	imageBtnNext: '/_style/images/lightbox-btn-next.gif'
	});


    $('.featured').hover(
        function(){
            $('.popup', $(this)).removeClass('hide');
        },
        function(){
            $('.popup', $(this)).addClass('hide');
        }
    );


	$("#send_message").click(function(){
		error = '';

		if ($("input[name=name]").val() == ''){
			error += "- Your name\n";
		}

		if ($("input[name=email]").val() == ''){
			error += "- Your email address\n";
		}

		if (error.length > 0){
			alert("Mandatory information is missing\n\n" + error);
			return false;
		}
	});


	$("#send_lfdc_contact").click(function(){
		error = '';

		if ($("input[name=email]").val() == ''){
			error += "- Your email address\n";
		}

		if (error.length > 0){
			alert("Mandatory information is missing\n\n" + error);
			return false;
		}
	});


	$(".pimages a").hover(
		function(){
			$(".property_image_main").hide();
			$("#property_image_holder").append('<img class="preview" src="'+WEB_ROOT+'_thumb.php?pic='+$(this).attr("rel")+'&amp;maxw=300&amp;maxh=195" alt="" />');
		},

		function(){
			$("#property_image_holder .preview").remove();
			$(".property_image_main").show();

		}
	);
});




// helper for counting characters in textbox
function cnt_chars(id, max){
	var text = $("#"+id).val();
	var len = (text) ? text.length : '0';

	if (len > max){
		st = document.getElementById(id).scrollTop;
		$("#"+id).val(text.substr(0, max));
		document.getElementById(id).scrollTop = st;
		len = max;
	}
}

