window.addEvent('domready', function() { 

	var el =  $('intro');
	var el2 = $('sxIntro');
	var el3 = $('txtIntro');
	var el4 = $('txtEntra');
	var tmp;
	var tmp2;
	intro();

	function intro() {
		var h = window.getHeight();
		el.removeClass('alt')
		el.setStyles({'height': h});
		
		var myFx = new Fx.Style(el2, 'opacity').set(0);
		var myFx = new Fx.Style(el3, 'opacity').set(0.99);
		viewBox.delay(750);

	}
	
	function viewBox() {
		var myFx = new Fx.Style(
			el2, 'opacity', {
				transition: Fx.Transitions.Quad.easeOut, 
				duration: 	1500
			}
		).start(0,0.99);
		tmp  = moveBox.delay(6000);
		tmp2 = hideTxt.delay(6000);
		
		
		el4.addEvent('click', function(){
			tmp  = $clear(tmp);
			tmp2 = $clear(tmp);
			moveBox();
			hideTxt();
		});
	}
	
	function moveBox() {
		var myFx = new Fx.Style(
			el2, 'left', {
				transition: Fx.Transitions.Expo.easeInOut,  
				duration: 	950
			}
		).start(255,0);
		hideBox.delay(950);
	}
	
	function hideTxt() {
		var myFx = new Fx.Style(
			el3, 'opacity', {
				transition: Fx.Transitions.Quad.easeOut, 
				duration: 950
			}
		).start(0.99,0);
	}

	function hideBox() {
		var myFx = new Fx.Style(
			el, 'opacity', {
				transition: Fx.Transitions.Quad.easeOut, 
				duration: 2500
			}
		).start(0.99,0);
		cancelBox.delay(2500);
	}
	function cancelBox() {
		el.setStyle('display', 'none'); 
	}
	
});
