function navigateTo(url) {
    window.location.href = url;
}


var vsVal;
function resizeColorBoxOnVs(vsId) {
    setInterval(function () {
        var current = $("#" + vsId).html();
        if (vsVal != current) {
            $.fn.colorbox.resize();
        }
        vsVal = current;
    }, 100)
}


$(document).ready(function () {

    // Quick Search

    $("#expand").toggle(function () {
        $("#mapContainer").animate({ height: '376px' }, 500, function () {
            $("#expand").text('Hide').addClass('open');
            //var so = new SWFObject("flash/Map.swf", "flashmap", "390", "340", "8", "#fff");
            //so.write("mapContainerInner");
        });
        $('html,body').animate({ scrollTop: 150 }, 500);
    },
	function () {
	    $("#mapContainer").animate({ height: '20px' }, 500, function () {
	        $("#expand").text('Expand').removeClass('open');
	        //$("#mapContainerInner").html("");
	    });
	    $('html,body').animate({ scrollTop: 0 }, 500);
	});

    $(".tabs a").click(function () {
        $(".tabs a").removeClass("current");
        $(this).addClass("current");
    });

    var slideSpeed = 500;
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) slideSpeed = 0;

    $("#refineSearch").toggle(function () {
        $("#propertyHeader").css({ backgroundPosition: '0px -35px' });
        $("#quickSearch").slideDown(slideSpeed, function () { $("#refineSearch").text("Hide Options").addClass("open"); })
    }, function () {
        $("#quickSearch").slideUp(slideSpeed, function () { $("#refineSearch").text("Refine Search").removeClass("open"); $("#propertyHeader").css({ backgroundPosition: '0px 0px' }); })
    });

    // Optional form fields
    /*
    $(".optional").each(function () {
        $(this).val('(optional)');
    });

    $(".optional").focus(function () {
        $(this).addClass("focused");
        if (this.value == '(optional)') { this.value = ''; }
        $(this).select();
    });
    $(".optional").blur(function () {
        if (this.value == '') {
            this.value = '(optional)';
            $(this).removeClass("focused");
        }
    });
    */

    $('.nugget .inner').bind('mouseover', function () {
        $(this).css("cursor", "pointer");
    });

    $('.subsectionLink').bind('mouseover', function () {
        $(this).css("cursor", "pointer");
    });


});
