$(function() {
    /*
    // Seteamos el flipbox
    $('.flipBox').quickFlip();
    
    // Corregimos el problema del bubbling
    $('.quickFlipCta').click(function(event){
        event.stopPropagation();
    });*/
    
    $('#rambla').hover(
        function(event) { $('#panel1Rambla').fadeOut('fast'); },
        function(event) { $('#panel1Rambla').fadeIn('fast'); }
    );
    $('#suites').hover(
        function(event) { $('#panel1Suites').fadeOut('fast'); },
        function(event) { $('#panel1Suites').fadeIn('fast'); }
    );
    $('#golf').hover(
        function(event) { $('#panel1Golf').fadeOut('fast'); },
        function(event) { $('#panel1Golf').fadeIn('fast'); }
    );
    $('#zonamerica').hover(
        function(event) { $('#panel1Zonamerica').fadeOut('fast'); },
        function(event) { $('#panel1Zonamerica').fadeIn('fast'); }
    );
    
    
    // Botones
    $('.accion-izquierda').click(function(event){
        var div = "div_"+$(this).attr("id");
        
        // Verificamos que la misma cortina no este baja ya
        if($("#"+div).css('display')=="none"){
            
            // Preguntamos si hay alguna cortina baja
            if( $('#div_contacto').css('display') != "none" || $('#div_quienes_somos').css('display') != "none")
            {
                // Subimos las cortinas actuales
                $('.subir-cortinas').fadeOut('slow');
                // Bajamos las cortinas
                $("#"+div).fadeIn('slow');
            }else{
                // Bajamos las cortinas
                $("#cortina").fadeIn('slow');
                setTimeout(function(){$("#"+div).fadeIn('slow');},500);
            }
        }
    });
    $('.subir-cortinas').click(function(event){
        // Subimos las cortinas
        $('.subir-cortinas').fadeOut('slow');
        setTimeout(function(){$("#cortina").fadeOut('slow');},500);
    }); 
    
// Seteamos los click handlers para los divs
    $('#rambla').click(function(event){window.open("http://www.regencyrambla.com.uy/","RegencyRambla");});
    $('#suites').click(function(event){window.open("http://www.regencysuites.com.uy/","RegencySuites");});
    $('#golf').click(function(event){window.open("http://www.regencygolf.com.uy/","RegencyGolf");});
    $('#zonamerica').click(function(event){window.open("http://www.regencyzonamerica.com.uy/","RegencyZonamerica");});

    
});
