﻿function do_overtext() {    
    // Overtext objects
    new OverText($$('#search'));
    new OverText($$('#username'));
    new OverText($$('#password'));
}


window.addEvent('domready', function() {
    if ($('carousel')) {
		var carousel = {
			unit: 284,
			current: 0,
			total: $$('#c-pane div.item').length,
			myFx: new Fx.Tween($('i-container')),
			next: function() {
				if (this.current > -(this.total - 3)) {
					this.myFx.start('left', (this.current * this.unit) + 'px', (this.current * this.unit) - this.unit + 'px');
					this.current--;
				} else {
					//alert('WRAP next()');
					this.current = 0;
					this.myFx.start('left',0);
				}
			},
			previous: function() {
				if (this.current < 0) {
					this.myFx.start('left', (this.current * this.unit) + 'px', (this.current * this.unit) + this.unit + 'px')
					this.current++;
				}
				else {
					//alert('WRAP prev');
					this.current = -(this.total-3);
					this.myFx.start('left',this.current*this.unit);
				}
			}
            
		};
		$('scrollRight').addEvent('click', function(event) {
			carousel.next();
		});

		$('scrollLeft').addEvent('click', function(event) {
			carousel.previous();
		});
 
 /**$$('#c-pane div.item').addEvent('click', function(event) {
        if ($$(event.target) == '[object HTMLDivElement]') {
            alert($$(event.target).get('innerHTML'));
        }
        
    });*/
    }

    // Accordion
    accordion = new Fx.Accordion($$('.event-toggle'), $$('.event-content'), {
        alwaysHide: true,
        show: -1,
        onActive: function(toggler, element) {
            toggler.setStyle('color', '#d32d28');
        },
        onBackground: function(toggler, element) {
            toggler.setStyle('color', '');
        }
    }); 
    setTimeout("do_overtext()", 400);
});
 
function toEnrollment(){
	window.location = "http://www.dips.no/?ID=733";
	return true;
} 


