$(document).ready(function(){

  // Simple? Yes. Effective? Quite.

  $(".left, .right").hide();
  
  var init = true;

  $(".aboutControl").click(function(){
     if(init) {$(".left, .right").show();init = false;}
     else {closeAll();init = false;}
     $("#aboutL").animate( { left:"0px" }, 0 );
     $("#aboutR").animate( { right:"0px" }, 0 );
  });
    
  $(".contactControl").click(function(){
     if(init) {$(".left, .right").show();init = false;}
     else {closeAll();init = false;}
     $("#contactL").animate( { left:"0px" }, 0 );
     $("#contactR").animate( { right:"0px" }, 0 );
  });
    
  $(".readControl").click(function(){
     if(init) {$(".left, .right").show();init = false;}
     else {closeAll();init = false;}
     $("#readL").animate( { left:"0px" }, 0 );
     $("#readR").animate( { right:"0px" }, 0 );
  });

  $(".closeControl").click(function(){
     $(".slideL").animate( { left:"270px" }, 0 );
     $(".slideR").animate( { right:"270px" }, 0, function(){$(".left, .right").hide();} );
     init = true;
  });

  function closeAll() {
     $(".slideL").animate( { left:"270px" }, 0 );
     $(".slideR").animate( { right:"270px" }, 0, function(){$(".left, .right").show();} );
  }

  $(".readboxTxt").hover(
      function () {
        $(this).parent().css("background-color","#E1DFB7");
        var txtID = "#"+((this.id).substr(0,2))+"R";
        $(txtID).parent().css("background-color","#E1DFB7");
        $(txtID).animate( { paddingRight:"200px" }, { queue:false, duration:444 } );
        $(this).animate( { paddingLeft:"144px" }, { queue:false, duration:444 } );
      },
      function () {
        $(this).parent().css("background-color","transparent");
        var txtID = "#"+((this.id).substr(0,2))+"R";
        $(txtID).parent().css("background-color","transparent");
        $(txtID).animate( { paddingRight:"74px" }, { queue:false, duration:444 } );
        $(this).animate( { paddingLeft:"74px" }, { queue:false, duration:444 } );
      }
   );

   $(".readboxImg").hover(
      function () {
        $(this).parent().css("background-color","#E1DFB7");
        var txtID = "#"+((this.id).substr(0,2))+"L";
        $(txtID).parent().css("background-color","#E1DFB7"); 
        $(txtID).animate( { paddingLeft:"144px" }, { queue:false, duration:444 } );
        $(this).animate( { paddingRight:"200px" }, { queue:false, duration:444 } );
      }, 
      function () {
        $(this).parent().css("background-color","transparent");
        var txtID = "#"+((this.id).substr(0,2))+"L";
        $(txtID).parent().css("background-color","transparent");
        $(txtID).animate( { paddingLeft:"74px" }, { queue:false, duration:444 } );
        $(this).animate( { paddingRight:"74px" }, { queue:false, duration:444 } );
      }
   );


});