﻿$(document).ready(function() {
    $('a[rel*=facebox]').facebox(); 
    $.facebox.settings.opacity = 0.8
});

$(document).bind('afterReveal.facebox', function() {  
    var windowHeight = $(window).height();  
    var faceboxHeight = $('#facebox').height();  
    if(faceboxHeight < windowHeight) {  
        $('#facebox').css('top', (Math.floor((windowHeight - faceboxHeight) / 2) + $(window).scrollTop()) );  
    }
});

$(function() {
    var $alert = $('#alert');
    if ($alert.html().length) {
        var alerttimer = window.setTimeout(function() {
            $alert.trigger('click');
        }, 3000);
        $alert.animate({ height: $alert.css('line-height') || '50px' }, 200)
		.click(function() {
		    window.clearTimeout(alerttimer);
		    $alert.animate({ height: '0' }, 200);
		});
    }
}); 

