// PAGE LOAD ANIMATION

window.addEvent('domready', function() {

var main_contentFadeFx = new Fx.Styles('main_content', {duration:1500, wait:false});
var top_navFx = new Fx.Styles ('bounce1', {duration: 1000, transition: Fx.Transitions.Bounce.easeOut,wait:false});
var sub_navFx = new Fx.Styles ('bounce2', {duration: 1000, transition: Fx.Transitions.Bounce.easeOut,wait:false})

top_navFx.start ({'opacity': [0, 1],'margin-top': [-40,0]}).chain(function(){
main_contentFadeFx.start ({'opacity':[0,1]}).chain(function(){
sub_navFx.start ({'opacity': [0, 1],'margin-top': [-40,0]});

});
});


$$('#main_content').each(function(el){
   el.setStyle('opacity', '0');
   el.setStyle('visibility', 'hidden');
});




$$('#top_nav #bounce1 li a').each(function(el) { 
   el.addEvent('mouseenter',function(){
   myEffect = el.effect('margin-top', {duration: 200,transition: Fx.Transitions.Back.easeOut, wait: false}).start('10','3');
   });
   
   el.addEvent('mouseleave',function(){
   myEffect = el.effect('margin-top', {duration: 600,transition: Fx.Transitions.Bounce.easeOut, wait: false}).start('3','10');
   });
});


$$('#sub_nav #bounce2 li a').each(function(el) { 

    el.addEvent('mouseenter',function(){
    myEffect = el.effect('background-color', {duration: 100,transition: Fx.Transitions.linear, wait: false}).start('#fff','#f00').chain(function(){
    myEffect = el.effect('padding-top', {duration: 200,transition: Fx.Transitions.Back.easeOut, wait: true}).start('5','0');
   });
    });
   
   el.addEvent('mouseleave',function(){
      myEffect = el.effect('background-color', {duration: 600,transition: Fx.Transitions.linear, wait: false}).start('#f00','#fff').chain(function(){
   myEffect = el.effect('padding-top', {duration: 600,transition: Fx.Transitions.Bounce.easeOut, wait: true}).start('0','5');


      });
   });
   
});



$$ ('h3.atStart').each(function(el) {
   el.addEvent('mouseenter',function(){
   el.setStyle('color', '#fff');
   el.setStyle('background', '#f00');
   });

   el.addEvent('mouseleave',function(){
   el.setStyle('color', '#fff');
   el.setStyle('background', '#654073');
   });
});








		
		

			
// PAGE CONTENT ACCORDION	





var accordion_page= new Accordion('h3.atStart', 'div.atStart', {
        opacity: false,
        alwaysHide:true,
 
 
        onActive: function(toggler, element){
            toggler.setStyle('color', '#f00');
            toggler.setStyle('background', '#fff');

        },
        onBackground: function(toggler, element){
            toggler.setStyle('color', '#999');
            toggler.setStyle('background', '#fff');
        }
}, $('accordion_page'));



	var accordion_main = new Accordion('div.stretchtoggle_main', 'div.stretcher_main', {
		opacity: true,
		alwaysHide:true,
        onActive: function(toggler, element){
            toggler.setStyle('color', '#f00');
            toggler.setStyle('background', '#eee');
            toggler.setStyle('background', 'url(images/btn_close.gif) no-repeat 0 0');

        },
        onBackground: function(toggler, element){
            toggler.setStyle('color', '#999');
            toggler.setStyle('background', '#eee');
            toggler.setStyle('background', 'url(images/btn_open.gif) no-repeat 0 0');
        }
}, $('accordion_main'));


});

