$(function() {
    Cufon.replace('#newsletter .intro,#newsletter button,#location-modal .button', { fontFamily: 'Knockout50 Welterweight' });
    Cufon.replace('#main-nav a', { fontFamily: 'Knockout29 Junior Lightweight' });
    Cufon.replace('#side-nav a', { fontFamily: 'Knockout29 Junior Lightweight' });
    Cufon.replace('h2:not(.no-cufon), legend', { fontFamily: 'Knockout49 Lightweight' });
    Cufon.replace('#pre-footer h3', { fontFamily: 'Knockout49 Lightweight' });
    Cufon.replace('#content .button', { fontFamily: 'Knockout49 Lightweight' });

    /* Allows the modal to fit to the viewport's height if the viewport is too short */
    $('.modal').bind('show', function() {
        if ($(window).height() < $(this).height()) {
            $(this).css({ height: ($(window).height() * .745) + 'px' });
        }
        $(this).css({ top: ($(window).height() * .025) + 'px' }).show();
    });
    $('.modal').bind('hide', function() { $(this).css({ height: 'auto' }); $(this).hide(); });

    $('#current-location .button').click(function() { $('#location-modal').trigger('show'); LoadMap(); $('#overlay').show(); return false; });
    $('#overlay, .cancel').click(function() { $('.modal').trigger('hide'); $('#overlay').hide(); return false; });

    $('#newsletter input').defaultVal('your-name@email.com');

    $('.slider').cycle({fx: 'fade',speed: 500,timeout: 9000});


});

jQuery.fn.defaultVal = function(value) {
    $(this).val(value);
  $(this).focus(
		function() { if ($(this).val() == value) $(this).val(''); }
	).blur(
		function() { if ($(this).val() == '') $(this).val(value); }
	);
}

//*SET DEFAULT BUTTONS*/
$(function() {
    if ($.browser.mozilla)
        $("#zipCode").keypress(checkForEnterContactUs);
    else
        $("#zipCode").keydown(checkForEnterContactUs);
});


function checkForEnterContactUs(event) {
    if (event.keyCode == 13) {
        $('#SubmitZipButton').click();
        event.preventDefault();
        return false;
    }
}


//*SET DEFAULT BUTTONS*/
$(function() {
    if ($.browser.mozilla)
        $("#EmailSignupRegistration").keypress(checkForEnterContactUs);
    else
        $("#EmailSignupRegistration").keydown(checkForEnterContactUs);
});


function checkForEnterContactUs(event) {
    if (event.keyCode == 13) {
        $('#SubscribeButton').click();
        event.preventDefault();
        return false;
    }
}




