/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){
    var headerFade = setInterval(header_fade, 30 * 1000);

    fit_left_column();
});

var header_last_foto_index = 1;

function header_fade()
{
    var fotos = [
        'header_foto_1.png',
        'header_foto_2.png',
        'header_foto_3.png',
        'header_foto_4.png',
    ];

    header_last_foto_index++;
    if( header_last_foto_index >= fotos.length )
    {
        header_last_foto_index = 0;
    }

    if( $(".header_foto #header_foto_2").css('display') == 'block' )
    {
        $(".header_foto #header_foto_2").fadeOut(1000, function(){
            $(".header_foto #header_foto_2").css('background-image', 'url("../img/'+fotos[header_last_foto_index]+'")');
        });
    }else
    {
        $(".header_foto #header_foto_2").fadeIn(1000, function(){
            $(".header_foto #header_foto_1").css('background-image', 'url("../img/'+fotos[header_last_foto_index]+'")');
        });
        
    }
}

function fit_left_column()
{
    if( $('.main_wrapper .left').innerHeight() < $('.main_wrapper .right').innerHeight() )
    {
        //$(".main_wrapper .left .content_container").height( $(".main_wrapper .left .content_container").height() + ($('.main_wrapper .right').innerHeight() - $('.main_wrapper .left').innerHeight()) - 6 );
        $(".main_wrapper .left .content_container").css('min-height',
            ($(".main_wrapper .left .content_container").height() + ($('.main_wrapper .right').innerHeight() - $('.main_wrapper .left').innerHeight()) - 6)+'px'
        );
    }

}
