this.hidePanel = function() {

  $("div.textpanel").animate({ 
    marginLeft: "-372px"
  }, 1000, 0, function() {
    $(".expand").show(300);
    $(".hide").hide(300);
  } );
  
  $("#scrollable").fadeOut(200);
}

this.showPanel = function() {
  $("div.textpanel").animate({ 
     marginLeft: "0px"
  }, 1000, 0, function() {
     $(".expand").hide(300);
     $(".hide").show(300); 
     $("#scrollable").fadeIn(200);
 } );


}
showGallery = function() {
  
  $("#gallery").animate({ 
     right: "0px"
  }, 500); 
  $(".caption_with_gal").animate({ 
     bottom: "0px"
  }, 500); 
  $("#scrollarea").fadeIn("fast");
  $(".imagetitle").fadeIn("fast");
}

showCaption = function() {
  $(".caption_normal").animate({ 
     bottom: "0px"
  }, 500);   
  $(".imagetitle").fadeIn("fast");
}

hideGallery = function() {
  $(".imagetitle").fadeOut("fast");
  $("#gallery").animate({ 
     right: "-104px"
  }, 500); 
  $(".caption_with_gal").animate({ 
     bottom: "-35px"
  }, 500); 
  $(".caption_normal").animate({ 
     bottom: "-35px"
  }, 500);   
  $("#scrollarea").fadeOut("fast");
}


$(document).ready(function(){
 
  $("#vari_back").fadeOut(); 
  
  $(".textpanel .rel .btn_expand").css({'visibility' : 'visible'});
  $(".txt_scroll").css({'visibility' : 'visible'});
  $("#vari_back").css({'visibility' : 'visible'});
    //IMAGES
   
 
 $(".expand").hide();
 $("img")
   .filter(".hide")
     .click(function(){
      hidePanel();
    })
   .end()  
   .filter(".expand")
     .click(function(){
      showPanel();
    })
   .end()   
  
  
});
