$(function() {
    initOverlay();
    
    if ($('html').hasClass('ie')) {
        initPlaceholders();
    }
});


////////////////////////
// INPUT PLACEHOLDERS //
////////////////////////

function initPlaceholders() {
    // (FF and Safari use the attribute "placeholder" on text inputs and have
    // built-in behavior -- this approximates the behavior for IE.)
    
    $('input[placeholder]').each(function() {
        text = $(this).attr('placeholder');
        $(this).val(text);
    });
    
    $('input[placeholder]').focus(function() {
        if ($(this).val() == $(this).attr('placeholder')) {
            $(this).val("");
        }
    }).click(function() {
        if ($(this).val() == $(this).attr('placeholder')) {
            $(this).val("");
        }
    });
    
    $('input[placeholder]').blur(function() {
        if ($(this).val() == "") {
            text = $(this).attr('placeholder');
            $(this).val(text);
        };
    });
};


//////////////
// OVERLAYS //
//////////////

function initOverlay() {
    // hide on init
    $('#overlay').hide();

	
	
    // click funcs
    $('.close-overlay, #overlay-bg').click(function(e) {
        e.preventDefault();
        hideOverlay();
    });
    
    $("#video a").click(function() {
        showOverlay();
    })
    
}

function showOverlay() {
    $('#overlay').fadeIn(300);
}

function hideOverlay() {
    $('#overlay').fadeOut(300);
}
