this.hidePanel = function() {

  $("div.textpanel").animate({ 
    marginLeft: "-500px"
  }, 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);
 } );

}

this.showContent = function(node) {
    $("#scrollable").fadeOut("slow");
    $("div.textpanel").animate({ 
      marginLeft: "-372px"
    }, 1000, 0, function() {
      if(node.background != 'gallery') {
          var howmuch = "0px";
      } else {
          var howmuch = "-372px";
      }
      $("div.textpanel").animate({ 
         marginLeft: howmuch
      }, 1000, 0, function() {
         if(node.background != 'gallery') {
           $(".expand").hide(300);
           $(".hide").show(300);   
         } else {
           $(".expand").show(300);
           $(".hide").hide(300);           
         }
          div_scroll1.resetScroll();
        	$.getJSON(
        	"json.php?type=showarcticle&node="+node.id,
        	function(content){
            $("#scrollable").html(""); 
            $.each(content, function(j,child){
              $("#scrollable").append(child);
              $("#scrollable").fadeIn("fast");
            });
        	})        
      } );
      
    } );
  
}

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