(function($) {
    $.fn.vAlign = function() {
        return this.each(function(i) {
            var ah = $(this).height();
            var ph = $(this).parent().height();
            var mh = (ph - ah) / 2;
            $(this).css('margin-top', mh);
        });
    };
})(jQuery);

$(document).ready(function () {

    // Clear field value when clicked
    $(".has_default_value").focus(function () {
        if ($(this).val() == $(this).attr("title")) {
            $(this).val("");
        }
    });
    $(".has_default_value").blur(function () {
        if ($(this).val() == "") {
            $(this).val($(this).attr("title"));
        }
    });

    // Rollovers
    $(".rollover").hover(function () {
        this.src = this.src.replace("_off", "_on");
    },
	function () {
	    this.src = this.src.replace("_on", "_off");
	});
    $(".rollover").each(function () {
        rollover_src = $(this).attr("src");
        rollover_activate = rollover_src.replace(/_off/gi, "_on");
        $("<img>").attr("src", rollover_activate);
    });

    // Top banners...
    $('#divHomeBanner').hide();
    if ($('#divHomePage').val() != null) {
        $('#divMainBanner').hide();
    }

    // Hide/Reveal
    $(".divdrop").hide();

    $(".dropme").toggle(
	function () {
	    $(".divdrop").removeClass("hidden").slideUp("slow");
	    $(this).next(".divdrop").removeClass("hidden").slideDown("slow");
	},
	function () {
	    $(this).next(".divdrop").removeClass("hidden").slideUp("fast");
	});


    $(".divOpen").slideDown("slow");

    $('.vaIMG').vAlign();
});



   
