/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$ruta_fija="";
$alt_fijo="";

$(function(){
    $('.img_galeria').Gallery();
});
$(function(){
    $('.img_detail').Detalle();
});
(
function($){
  $.fn.Gallery=function(){
    $(this).click($(this).GalleryClick);
    $(this).hover($(this).Galleryover,$(this).Galleryout);
    
  };
  $.fn.Galleryover=function(){
      
      
      $ruta=this.getAttribute("src");
      $alt=this.getAttribute("alt");
      
      $('.detalle').replaceWith('<div class="detalle"><div class="caja_detail"><img alt="'+$alt+'" title="'+$alt_fijo+'" class="img_detail" src="'+$ruta+'"/><br /><br />'+$alt+"</div></div>");
      $('.detalle').hide();
      $('.detalle').fadeIn(500);
  };
  $.fn.Galleryout=function(){
      if($ruta_fija!=""){
        //$(".caja_detail").remove();
        
        $('.detalle').replaceWith('<div class="detalle"><div class="caja_detail"><img alt="'+$alt_fijo+'" title="'+$alt_fijo+'" class="img_detail" src="'+$ruta_fija+'"/><br /><br />'+$alt_fijo+"</div></div>");
        $('.detalle').hide();
        $('.detalle').fadeIn(500);
      }//if
  };
  $.fn.GalleryClick=function(){
    $ruta_fija=this.getAttribute("src");
    $alt_fijo=this.getAttribute("alt");
  };
 
}

)(jQuery);
(
function($){
  $.fn.Detalle=function(){
    $(this).click($(this).DetalleClick);
  };
  $.fn.DetalleClick=function(){
    $src=this.getAttribute("src");
    $altura=window.height;
    $anchura=window.width;
    alert($altura);
    $galeria="<div style='height:"+$altura+";width:"+$anchura+";' class='fondo_galeria'><div class='detalle_galeria'><img src="+$src+"></img></div></div>";
    $(".galeria").append($galeria);
  };
}
)(jQuery);

