var speed = 700;
var mainPanelWidth = 150;

function closePanel(){
   jQuery('.subPanel').each(function(){
         jQuery(this).animate({left:'0'},200);
   }); 
}

jQuery(document).ready(function(){
   
   jQuery('#nav li a').click(function(event){
      jQuery('.subPanel').each(function(){
         jQuery(this).animate({left:'0'},200);
      });
      if (jQuery(this).hasClass('subLink')){
         panelID = jQuery(this).attr('href');
         try{
            jQuery(panelID).animate({left:mainPanelWidth + 'px'},speed);
            return false;
         }catch(err){
            return err.message;
         }
      }
   });
   
   jQuery('.close').click(function(){
      closePanel();
      return false;
   });
   
   
})



