$(document).ready(function() { 

    $(".align").center();
    $("#contentLegal").load("./es/legal.html");

    $("span.emerge").click(function() {
        $("div.hidden").center();
        $("div#legal").show();
    });

    $(".roll").each(function() { 
        rollsrc = $(this).attr("src"); 
        rollON = rollsrc.replace(/.png$/ig, "_over.png"); 
        $("<img>").attr("src", rollON); 
    }); 


    $(".roll").mouseover(function() { 
        imgsrc = $(this).attr("src"); 
        matches = imgsrc.match(/_over/); 
        if (!matches) { 
            imgsrcON = imgsrc.replace(/.png$/ig, "_over.png");  
            $(this).attr("src", imgsrcON); 
        } 
    }); 

    $(".roll").mouseout(function() { 
        $(this).attr("src", imgsrc); 
    });


    $("div.closeLayer").click(function(){
        $(this).parent().parent().parent().parent().hide();
    });

});


jQuery.getFlash = function() {

    var flashArray = ["./images/flash/anima_gato.swf", "./images/flash/anima_gui.swf", "./images/flash/anima_tropa.swf"];

    aleat = parseInt(Math.round(Math.random() * (flashArray.length - 1)));
    $("#miniFlash").attr('data', flashArray[aleat]);
    $("#miniFlash2").attr('value', flashArray[aleat]);
}
