(function($) {//tip message
 SlideBox=$.fn.slideBox=function(params) {
 
    params=$.extend({firstOpen:false,Trigger:"click",slideUp_callback:function() {} },params);
	
	
	  
      var currentSlideContent;
	

   
 return  this.each(function(i) {
   
     $t=$(this);
	 
	
	
	  
	 $t.children(".slide-button").bind(params.Trigger,function(i) {
		 
     
	   
	   var slideContent=$(this).next();
	   
	   
	    
	   if(!$(this).parent().hasClass("collapsible-on")) {  // start of if
		  
		  		
		  hideAllTabContent($(this).parent());
				
		 $(this).parent().addClass("collapsible-on");
	

	   	
	   if($(this).parent().parent()[0].currentSlideContent) {
				   $($(this).parent().parent()[0].currentSlideContent).slideUp(); 
	   }// end of if($(this).parent().parent()[0].currentSlideContent) {
	   
	   slideContent.slideDown('slow',function() {   //------ start of function
		   
		   if(!slideContent.hasClass('done')) {
		   
             //put new init here....
			 $(this).find('.carousel').jcarousel({
	             initCallback: function (carousel, state) {	
                        var leftBtn=carousel.container.find('.left-btn');
						var rightBtn=carousel.container.find('.right-btn');
	                    carousel.buttonPrev.appendTo(leftBtn);
	                    carousel.buttonNext.appendTo(rightBtn);
             } 
	        }); // end of jcarousel
							 			 
	        slideContent.addClass('done');
		   } //end of if

		     params.slideUp_callback();
		});                             //--------- end of function
	
	   $(this).parent().parent()[0].currentSlideContent=slideContent;	   
	  }	  
	  else {
	     hideAllTabContent($(this).parent());

		 $($(this).parent().parent()[0].currentSlideContent).slideUp();   
	  } // end of if
	 });    //----click function
	 
	  if(params.firstOpen && i==0)	{
        $t.find(".slide-button").trigger(params.Trigger); 
	  } 	 	
	  
	      
   });
 /* end of return---*/
 
  
   
    function hideAllTabContent($collapsible) {	
	    $collapsible.parent().children('.collapsible').removeClass('collapsible-on');	    
		//$('.collapsible').removeClass("collapsible-on");
	};
	
 
   
  
};
  SlideBox.openDiv=function(id) { 	     
        $("#"+id).trigger("click"); 		
	}

})(jQuery)
