/***
 * MAIN
 */
var App = {
  
  
  init: function() {
    App.setupAccordion();
    App.setupSmoothscroll();
	App.clipreload();
  },
  

  setupAccordion: function() {
	  
  	var accordion = new Accordion('div.project-title', 'div.project-content', {
		start:'all-closed',
		opacity: false,
		alwaysHide: true,
    	//onActive: function() {
			
		//},
		onBackground: function(togglers, stretchers) {
			stretchers.setStyle('height', stretchers.offsetHeight);
			//accordion2.display.delay(50, accordion2, -1);
			$$('div.makeofcontent').setStyle('height','0');
			$$('div.video-body').setStyle('height','0');
			$$('div.pro-player-container').setStyle('display','none');
	    }
	});
	var accordion1 = new Accordion('div.makeoftitle', 'div.makeofcontent', {
		start:'all-closed',
		opacity: false,
		alwaysHide: true,
		onActive: function(togglers, stretchers){
			togglers.getParent().getParent().getParent().getParent().setStyle('height','auto');
		},
		onBackground: function(togglers, stretchers){
			stretchers.setStyle('height',stretchers.offsetHeight);
		}
	});
	
	var accordion2 = new Accordion('div.video-head', 'div.video-body', {
		start:'all-closed',
		opacity: false,
		alwaysHide: true,
		onActive: function(togglers, stretchers){
			togglers.getParent().setStyle('height','auto');
			togglers.getParent().getParent().getParent().getParent().setStyle('height','auto');
		},
		onBackground: function(togglers, stretchers){
			stretchers.setStyle('height',stretchers.offsetHeight);
		}
	 	
    });
	  var accordionAB = new Accordion('div.about-title', 'div.about-content', {
		start: 0,
		opacity: false,
		alwaysHide: false,
	});
	   $$('div.clickabout').addEvent('click', function() {
           accordionAB.display.delay(10, accordionAB, 0);
       });
	   $$('div.clickeq').addEvent('click', function() {
           accordionAB.display.delay(10, accordionAB, 1);
       });
	   $$('div.clickauto').addEvent('click', function() {
           accordionAB.display.delay(10, accordionAB, 2);
       });

	},

	/** 
   * SCROLLER
   */
	setupSmoothscroll: function() {
	  var mySmoothScroll = new SmoothScroll({
      wheelStops: false,
    });
	},


	clipreload: function() {
       $$('div.project-title').addEvents({
		  'click': function() {
           $$('div.project-title').fireEvent('doitnow','', 500);
		  },
		  'doitnow': function() {
		   $$('div.pro-player-container').setStyle('display','');
		  }
       });
	},

  
};


function onLoaded(func) {
  window.addEvent('load', func);
}


onLoaded(App.init);
onLoaded(function() {
  $(document.body).addClass('js-enhanced');
});






