(function($) {
    function toggleLabel() {
        var input = $(this);
        setTimeout(function() {
            var def = input.attr('title');
            if (!input.val() || (input.val() == def)) {
                input.prev('label').css('visibility', '');
				input.css('background-color', 'transparent');
            } else {
                input.prev('label').css('visibility', 'hidden');
				input.css('background-color', '#fff');
            }
        }, 0);
    };

    function resetField() {
        var def = $(this).attr('title');
        if (!$(this).val() || ($(this).val() == def)) {
            $(this).val(def);
            $(this).prev('label').css('visibility', '');
        }
    };

    $('#mailinglist input').live('keydown', toggleLabel);
    $('#mailinglist input').live('paste', toggleLabel);

    $('#mailinglist input').live('focusin', function() {
        $(this).prev('label').css('color', '#ccc');
    });
    $('#mailinglist input').live('focusout', function() {
        $(this).prev('label').css('color', '#999');
    });

    $(function() {
        $('#mailinglist input').each(function() { toggleLabel.call(this); });
    });

})(jQuery);

$(document).ready(function() {
	$("#slider").easySlider({
		auto: true,
		continuous: true,
		numeric: true,
		speed: 2000
	});
	$(".sf-menu").superfish({
		onShow: function(){
			// IE fix - set links to full width of submenu (minus left and right padding)
			var w = $(this).width();
			$('a', this).width(w - 24);
		}
	});
	$(".sf-menu > li > ul > li:last-child").css("border-bottom", "0");
	$("#mainstreet").cycle({
		random: 1
	});
	$("#sponsors div").cycle({
		random: 1
	});
	
});



function equalWidth(group) {
    widest = 0;
    group.each(function() {
		// first, clear any css width setting
		$(this).css('width', 'auto');
		// then get the width of the widest element
        thisWidth = $(this).width();
        if(thisWidth > widest) {
            widest = thisWidth;
        }
    });
	// set all elements to that width
    group.width(widest);
}
