$(document).ready(function(){
            var bn = true;
            //onload
            /*$(".columns li img").each(function(){
                $(this).attr("src",$(this).attr("src").replace(".", "bn."));
            });*/
            //color copyright
            $("#cTatataSl").css("color","white");
            $("#avisoLegal").css("color","white");
            
            //FULLSCREENN Y OTROS ENLACES
            $("#fulls").click(function(){
                var jash = window.location.hash; //almaceno variable
                if( jash == '#full')
                {//si variable es = #full
                   window.close('fs');//cierro ventana
                }
                else
                {
                    //sino abro una nueva ventana
                    $("#jquery_jplayer_1").jPlayer("pause");
                    var urlactual = location.href+'#full';
                    var oSoWin = window.open(urlactual,"fs",'width='+window.screen.availWidth+',height='+window.screen.availHeight+', fullscreen=yes,scrollbars=1');
            	
                	if (oSoWin)
                	{
                		oSoWin.moveTo(0,0);
                		oSoWin.focus();
                	}
                }
      
            });
            $("#fulls img").attr("src", $("#fulls img").attr("src").replace(".","white."));
            
            //Cambio de imagenes bn
            /*$(".columns li img").hover(
                function(){
                     $(this).attr("src",$(this).attr("src").substring(0,$(this).attr("src").length-6)+ '.jpg');
                },function(){
                    $(this).attr("src",$(this).attr("src").substring(0,$(this).attr("src").length-4)+ 'bn.jpg');    
                }
            );*/
            $(".fp_thumbtoggle").css({'bottom':'0px'});
            //$("#tituloTatataPng").css('left', ($(".columns").offset().left)+10);
           /************* F L A S H **********************/
           function crearDiv(fichero){
        
            $("#contenedor").append('<div id="flash"></div>');
            $("#contenedor").append('<div id="cerrar"><div id="bajoCerrarBackground">'+VariableCerrarVideo+'</div></div>');
            //centro verticalmente el contenedor
            //desactivado temporalmente el centrado del #contenedor
            //centro el boton cerrar
            var mitadVentana = ($(window).width() - $("#cerrar").width())/2;
            $("#cerrar").css("left", mitadVentana);
            cargarFlash(fichero);
                $("#cerrar").click(function(){
                    $("#flash").fadeOut(500, function(){
                        $("#flash").remove();
                        
                        $("#ventana").fadeOut(1000);
                        $("#bajoVentana").fadeOut(1000);                                            
                    });
                    
                    $("#cerrar").remove().fadeOut(500);                   
                });   
            }
            function cargarFlash(ruta){
                
                var anchoContenedor = $("#contenedor").width();
                var altoContenedor = $("#contenedor").height();
                $('#flash').flash({
                    swf: ruta,
                    width: anchoContenedor,
                    height: altoContenedor,
                    scale: "noscale",
                    wmode: 'transparent'
                });
                                         
            }
        //FUNCION AL DAR CLICK SOBRE UNA IMAGEN MINIATURA
        $(".columns li a").bind("click",function(event){
            //miscript/images/articulos/flv/archivo.swf
            var ruta = $(this).attr("href");
            $("#ventana").fadeIn(2500);
            $("#bajoVentana").fadeIn(2500);
            crearDiv(ruta);                
            event.preventDefault();
        });
        $(".columns li a img").hover(
            function(){
                bn = false;
                $(this).parent().parent().append('<div class="info"><h2>'+$(this).attr("title")+'</h2><p>'+$(this).attr("longdesc")+'</p></div>');
                var rutaImg = $(this).attr('src').substring(0,$(this).attr("src").length-6)+ '.jpg';
                $(this).attr('src',rutaImg);
            },function(){
                if(bn==true)
                    var rutaImg = $(this).attr('src').substring(0,$(this).attr("src").length-6)+ 'bn.jpg';
                else
                {
                    bn = true;
                    var rutaImg = $(this).attr('src').substring(0,$(this).attr("src").length-4)+ 'bn.jpg';
                }
                $(this).attr('src',rutaImg);
            }
        );
        
    });//FIN DE READY
    $(window).resize(function() {
        //$("#tituloTatataPng").css('left', ($(".columns").offset().left)+10);
        //ajusto a la mitad la galeria de 9 imagenes
        var varmitad = ($(window).height() - $(".columns").height())/2;
        //$("ul.columns").css('margin-top', varmitad);
        //ajustarCentro();
        //on resize contenedor verde que tiene dentro el flash y al redimensionar pasamos variables al flash
        var anchoContenedor = $("#contenedor").width();
        var altoContenedor = $("#contenedor").height();
        $("#flash_tatata").width(anchoContenedor);
        $("#flash_tatata").height(altoContenedor);
        //centro el boton cerrar
        var mitadVentana = ($(window).width() - $("#cerrar").width())/2;
        $("#cerrar").css("left", mitadVentana);
    });
    /*click en botones*/
    /*$("#fp_thumbtoggleanterior").click(function(){
        window.location = $("#fp_thumbtoggleanterior_enlace a").attr("href");
    });
    $("#fp_thumbtoggle").click(function(){
        window.location = $("#fp_thumbtoggle_enlace a").attr("href");
    });
    $("#fp_thumbtoggleultimo").click(function(){
        window.location = $("#fp_thumbtoggleultimo_enlace a").attr("href");
    });*/
    $(window).load(function(){
        
    });
