window.addEvent('domready',function() {
	/* settings */
	
  if ($('contentslider')) {
    var showDuration = 5000;
  	var container = $('contentslider');
  	var elements = container.getElements('div.csc-default');
  	var currentIndex = 0;
  	var interval;
  	/* opacity and fade */
  	elements.each(function(el,i){ 
  		if(i > 0) {
  			el.set('opacity',0);
  		}
  	});
  	/* worker */
  	var show = function() {
  		elements[currentIndex].fade('out');
  		elements[currentIndex = currentIndex < elements.length - 1 ? currentIndex+1 : 0].fade('in');
  	};
  	/* start once the page is finished loading */
  	window.addEvent('load',function(){
  		interval = show.periodical(showDuration);
  	});
	}
	


	
	
	
	
 

     $('info').set('tween',{
        onComplete:function(){
            if ($('info').getStyle('opacity') == 0) {
                $('info').setStyle('display','none');
            }
        },
        onStart: function() {
            if ($('info').getStyle('opacity') == 0) {
                $('info').setStyle('display','block');
            }
        }
    }).setStyle('opacity',0);
    $$('.infobutton').addEvent('click', function(){
        $('info').fade('toggle');
    });

//
// SqueezeBox
//
//

    /**
     * Set default options, overrideable from later calls.
     */
    if (window.SqueezeBox) {
   	var windowSize = {
		width: window.innerWidth || document.body.clientWidth,
       		height: window.innerHeight || document.body.clientHeight
	}
	squeezeWidth = 646;
	squeezeHeight = 696;
	if(squeezeHeight > windowSize.height){
		squeezeHeight = windowSize.height- 30;
		squeezeWidth = squeezeWidth + 30;
	}
	if(squeezeWidth > windowSize.width){
		squeezeWidth = windowSize.width - 30;
	}
	
	SqueezeBox.initialize({
        	size: {x: squeezeWidth, y: squeezeHeight}
    	});
 
    /**
     * Assign SqueezeBox to all links with rel="boxed" attribute, the class then reads the "href".
     */
    SqueezeBox.assign($$('a[rel=boxed]'));
    }
    
    
    $$('.csc-subheader').setStyle('display','none');
    
      	// The same as before: adding events
  	$$('.csc-header').addEvents({
  		'mouseenter': function(){
  			// Always sets the duration of the tween to 1000 ms and a bouncing transition
  			// And then tweens the height of the element
  			$$('.csc-subheader').setStyle('display','block')
  		},
  		'mouseleave': function(){
  			// Resets the tween and changes the element back to its original size
  			$$('.csc-subheader').setStyle('display','none');
  		}
  	}); 
});
