
var firstComplete = true;

// Init Jquery
$j(document).ready( init_document );

function init_document() {
  if( $j('#slider').length > 0 )
  {
    $j('#slider').movingBoxes({
  		// **** Appearance ****
      // start with this panel
      startPanel: 1,
      // overall width of movingBoxes
      width: 630,
      // current panel width adjusted to 50% of overall width
      panelWidth: 0.5,
      // non-current panel size: 80% of panel size
      reducedSize: 0.8,
      // if true, slider height set to max panel height; if false, height will auto adjust.
      fixedHeight: false,
      
      // **** Behaviour ****
      // animation time in milliseconds
      speed: 500,
      // if true, hash tags are enabled
      hashTags: true,
      // if true, the panel will "wrap" (it really rewinds/fast forwards) at the ends
      wrap: true,
      // if true, navigation links will be added
      buildNav: false,
      // function which returns the navigation text for each panel
      navFormatter: function(index, panel){ return "&#9679;" },
      // anything other than "linear" or "swing" requires the easing plugin
      easing: 'swing',
      
      // **** Selectors & classes ****
      // current panel class
      currentPanel: 'current',
      // added to the navigation, but the title attribute is blank unless the link text-indent is negative
      tooltipClass: 'tooltip',
      
      // **** Callbacks ****
      // e = event, slider = MovingBoxes Object, tar = current panel #
      // callback when MovingBoxes has completed initialization
      initialized: function(e, slider, tar){},
      // callback upon change panel initialization
      initChange: function(e, slider, tar){
                      // alert( 'Changing panels to #' + tar );
                  },
      // callback before any animation occurs
      beforeAnimation: function(e, slider, tar){},
      // callback after animation completes
      completed: function(e, slider, tar){
                      
                      if( firstComplete ){
                        $j('#sliderConteiner').css('height','auto');
                        $j('#sliderConteiner').css('visibility','visible');
                        //$j('#sliderConteiner').open();
                        firstComplete = false;
                      }
                      
                      /*
                      setTimeout(function() {
                        $j("#slider").data('movingBoxes').goForward();  // move to next slide.
                      }, 5000); // execute the given function after 5 seconds
                      */
                  }
  	});
  }	 
}
