
/*---script: Scroller.jsdescription: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.license: MIT-style licenseauthors:- Valerio Proiettirequires:- core:1.2.4/Events- core:1.2.4/Options- core:1.2.4/Element.Event- core:1.2.4/Element.Dimensionsprovides: [Scroller]...*/var Scroller = new Class({	Implements: [Events, Options],	options: {		area: 20,		velocity: 1,		onChange: function(x, y){			this.element.scrollTo(x, y);		},		fps: 50	},	initialize: function(element, options){		this.setOptions(options);		this.element = document.id(element);		this.docBody = document.id(this.element.getDocument().body);		this.listener = ($type(this.element) != 'element') ?  this.docBody : this.element;		this.timer = null;		this.bound = {			attach: this.attach.bind(this),			detach: this.detach.bind(this),			getCoords: this.getCoords.bind(this)		};	},	start: function(){		this.listener.addEvents({			mouseover: this.bound.attach,			mouseout: this.bound.detach		});	},	stop: function(){		this.listener.removeEvents({			mouseover: this.bound.attach,			mouseout: this.bound.detach		});		this.detach();		this.timer = $clear(this.timer);	},	attach: function(){		this.listener.addEvent('mousemove', this.bound.getCoords);	},	detach: function(){		this.listener.removeEvent('mousemove', this.bound.getCoords);		this.timer = $clear(this.timer);	},	getCoords: function(event){		this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;		if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);	},	scroll: function(){		var size = this.element.getSize(), 			scroll = this.element.getScroll(), 			pos = this.element != this.docBody ? this.element.getOffsets() : {x: 0, y:0}, 			scrollSize = this.element.getScrollSize(), 			change = {x: 0, y: 0};		for (var z in this.page){			if (this.page[z] < (this.options.area + pos[z]) && scroll[z] != 0) {				change[z] = (this.page[z] - this.options.area - pos[z]) * this.options.velocity;			} else if (this.page[z] + this.options.area > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]) {				change[z] = (this.page[z] - size[z] + this.options.area - pos[z]) * this.options.velocity;			}		}		if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);	}});


window.addEvent('domready', function() {

//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'div.slide_trigger', 'div.slide', {
		opacity: false,
		onActive: function(slide_trigger, slide){
		},
		onBackground: function(slide_trigger, slide){
		},
		display: -1
	// ,show: 2 // Startitem
	// ,initialDisplayFx: true
	});

var startpage = function(){
	window.location.href = "index.php";
	}

var fadenav = function(){
	

	
	$('navb').set('tween', {
		transition: Fx.Transitions.Quint.easeOut
		}); 
	
	$('modalOverlay').get('tween').cancel();	
	$('navb').get('tween').cancel();	
	$('header').get('tween').cancel();	
	
	$('header').setStyle('opacity','1');
	$('header').setStyle('opacity','1');
	
	$('header').setStyle('opacity','1');
	
	
	$('navb').tween('opacity', '0');
	$('header').get('tween').cancel();
	$('header').setStyle('opacity','1');
	$('homeindex').removeEvent('click', startpage);
	$('modalOverlay').set('tween', {duration:300}); 
	$('modalOverlay').tween('opacity','0');

	};

/* vorn index link */
var setindexlink = function(){
	$('homeindex').addEvent('click', startpage);
	};

var hoverFunction = function(){
	$('homeindex').addEvent('click', function(event){
		event.stop();
		});
	
var bodyclass = $$('body').get('class');
	if (bodyclass == 'nav5'){
		vornlayer= '#333';
		} else {
		vornlayer='#FFF';
		}
				$('navb').setStyle('opacity','0');
				$('navb').setStyle('display','block');
				$('navb').setStyle('z-index','3000');
				$('navb').addEvent('mouseleave',fadenav);
			
		var navshow = new Fx.Tween($('navb'), {
				duration: 600,
				transition: Fx.Transitions.Quint.easeIn,
				onComplete: setindexlink.delay(1500)
				});	
				navshow.start('opacity', 1);

				$('header').set('tween', {duration:300});
				$('header').tween('opacity','0');
		
				new Modalizer().modalShow({
					  modalStyle:{
					    'background-color':vornlayer
					   // 'opacity':0.9
					  },
					onModalHide:fadenav
				});
		};

var buttons = $('headerhover');
	buttons.addEvent('mouseenter', hoverFunction);

});// end
