//DOMREADY.JS
	
	window.addEvent('domready', function() {
		
		$('clicker').style.visibility = 'hidden';
		
		var bgColor = new Fx.Morph('content', {link: 'ignore', duration: 'long', transition: Fx.Transitions.Quad.easeOut});
		var pamphlet = new Fx.Morph('about', {link: 'ignore', duration: 'long', transition: Fx.Transitions.Quad.easeOut});
		var shadow = new Fx.Morph('shadow', {link: 'ignore', duration: 'long', transition: Fx.Transitions.Quad.easeOut});
		var shadowfade = new Fx.Morph('shadow', {link: 'ignore', duration: 'short', transition: Fx.Transitions.linear});
		var shadowfadein = new Fx.Morph('shadow', {link: 'ignore', duration: 'long', transition: Fx.Transitions.Quad.easeIn});
		var becomepaler = new Fx.Morph('infotable', {link: 'ignore', duration: '10000', transition: Fx.Transitions.Quad.easeIn});
		var clickster = new Fx.Morph('clicker', {link: 'ignore', duration: '1500', transition: Fx.Transitions.Quint.easeOut});
		var construcsh = new Fx.Morph('construction', {link: 'ignore', duration: '1000', transition: Fx.Transitions.Quad.easeOut});
		var screen = new Fx.Morph('proj', {link: 'ignore', duration: '4000', transition: Fx.Transitions.Back.easeOut});
		var screenup = new Fx.Morph('proj', {link: 'ignore', duration: '1000', transition: Fx.Transitions.Back.easeIn});
		var gallery = new Fx.Morph('carousel', {link: 'ignore', duration: '1000', transition: Fx.Transitions.Bounce.easeOut});
		
		//Preformats text block
		ok.expedier();
		
		//Initializes background fade, pauses it
		bgColor.start({opacity: '0'});
		bgColor.pause();
		
		window.setTimeout(function() {
			$('content').innerHTML = 'RENDERING';
			window.setTimeout(function() {
				$('content').innerHTML = 'READY';
				$('logomain').style.backgroundImage =  'url(images/2across2.gif)';
				$('about').style.display = 'block';
				bgColor.resume();
			}, 1000);
		}, 1500);
		
		
		$('work').addEvent('mouseenter', function(e) {
		
			e.stop();
			
			$('work').removeEvents('mouseenter');
			
			$('clicker').style.visibility = 'visible';
			
			clickster.start({
				bottom: ['0px', '100px'],
				right: ['0px', '0px'],
				width: ['125px', '225px']
			});
			construcsh.start({
				opacity: ['1', '0']
			});
			screen.start({
				height: ['0px', '455px']
			});
			window.setTimeout(function() {
				gallery.start({
					opacity: ['0', '1']
				});
			//}, 4000);
			
				$('info').style.display = 'none';
				//$('mirror').style.display = 'none';
				$('closer').style.display = 'none';
				
				becomepaler.pause();
				$('infotable').style.backgroundColor = '#e0f0ff';
				
				pamphlet.start({
					bottom: '0px',
					borderWidth: '0px',
					right: '80px'
				});
				shadow.start({
					bottom: '35px',
					opacity: ['0', '1']
				});
				
				window.setTimeout(function() {
					$('about').style.cursor = 'pointer';		
					$('about').addEvent('mouseenter', function(e) {
						e.stop();
						$('about').removeEvents('mouseenter');
						pamphlet.start({
							bottom: ['0px', '70px'],
							borderWidth: ['0px', '20px'],
							right: ['80px', '60px']
						});
						shadow.start({
							bottom: ['35px', '-50px']
						});
						shadowfade.start({
							opacity: ['1', '0']
						});
						window.setTimeout(function() {
							$('info').style.display = 'block';
							$('closer').style.display = 'block';
							$('about').style.cursor = 'default';
							becomepaler.start({
								backgroundColor: '#f0f3f6'
							});
						}, 1250);
						$('content').style.display = 'none';
						
					});	
				}, 1250);
				
			}, 4000);
			
		});
		
		$('projcloser').addEvent('click', function(e) {
		
			e.stop();
			
			clickster.start({
				opacity: ['1', '0']
			});
			
			window.setTimeout(function() {
				//construcsh.start({
					//opacity: ['0', '1']
				//});
				screenup.start({
					height: ['455px', '0px']
				});
				gallery.start({
					opacity: ['1', '0']
			
				});
			}, 250);
			
			window.setTimeout(function() {
			
				$('work').addEvent('mouseenter', function(e) {
			
				e.stop();
				
				$('work').removeEvents('mouseenter');
				
				$('clicker').style.visibility = 'visible';
				
				clickster.start({
					opacity: ['0', '1'],
					bottom: ['0px', '100px'],
					right: ['0px', '0px'],
					width: ['125px', '225px']
				});
				screen.start({
					height: ['0px', '455px']
				});
				window.setTimeout(function() {
					gallery.start({
						opacity: ['0', '1']
					});
				//}, 4000);
				
					$('info').style.display = 'none';
					//$('mirror').style.display = 'none';
					$('closer').style.display = 'none';
					
					becomepaler.pause();
					$('infotable').style.backgroundColor = '#e0f0ff';
					
					pamphlet.start({
						bottom: '0px',
						borderWidth: '0px',
						right: '80px'
					});
					shadow.start({
						bottom: '35px',
						opacity: ['0', '1']
					});
					
					window.setTimeout(function() {
						$('about').style.cursor = 'pointer';		
						$('about').addEvent('mouseenter', function(e) {
							e.stop();
							$('about').removeEvents('mouseenter');
							pamphlet.start({
								bottom: ['0px', '70px'],
								borderWidth: ['0px', '20px'],
								right: ['80px', '60px']
							});
							shadow.start({
								bottom: ['35px', '-50px']
							});
							shadowfade.start({
								opacity: ['1', '0']
							});
							window.setTimeout(function() {
								$('info').style.display = 'block';
								$('closer').style.display = 'block';
								$('about').style.cursor = 'default';
								becomepaler.start({
									backgroundColor: '#f0f3f6'
								});
							}, 1250);
							$('content').style.display = 'none';
							
						});	
					}, 1250);
					
				}, 4000);
			
			}, 1250);
			
		});
			
		});
			
		
		var clickcount = 1;
		var clickA, clickB;
		
		$('advance').addEvent('click', function(e) {
			
			e.stop();
			
			clickcount += 1;
			
			if (clickcount > 6) {
				clickA = clickcount%6 || 6;
				if (clickcount > 37) {
					clickB = clickcount%37 || 37;
				} else {
					clickB = clickcount;
				}
			} else {
				clickA = clickcount;
				clickB = clickcount;
			}	
			
			var projector = $('carousel').childNodes[0];
			projector.src = 'images/proj' + clickA + '.png';
			$('carousel').style.backgroundImage = 'url(images/' + clickB + '.jpg)';
			//alert('Projector screen ' + clickA + ', portfolio image ' + clickB);
			
			var nextup = new Image();
			nextup.src = 'images/' + (clickB + 1) + '.jpg';
		
		});
		
		$('about').addEvent('mouseenter', function(e) {

			e.stop();

			$('about').removeEvents('mouseenter');

			pamphlet.start({
				bottom: ['0px', '70px'],
				borderWidth: ['0px', '20px'],
				right: ['80px', '60px']
			});
			shadow.start({
				bottom: ['35px', '-50px']
			});
			shadowfade.start({
				opacity: ['1', '0']
			});

			window.setTimeout(function() {
				$('info').style.display = 'block';
				$('closer').style.display = 'block';
				$('about').style.cursor = 'default';
				becomepaler.start({
					backgroundColor: '#f0f3f6'
				});
			}, 1250);
			
			$('content').style.display = 'none';
			
		});
		
		$('closer').addEvent('click', function(e) {
		
			e.stop();
			
			$('info').style.display = 'none';
			//$('mirror').style.display = 'none';
			$('closer').style.display = 'none';
			
			becomepaler.pause();
			$('infotable').style.backgroundColor = '#e0f0ff';
			
			pamphlet.start({
				bottom: '0px',
				borderWidth: '0px',
				right: '80px'
			});
			shadow.start({
				bottom: '35px',
				opacity: ['0', '1']
			});
			
			window.setTimeout(function() {
				$('about').style.cursor = 'pointer';		
				$('about').addEvent('mouseenter', function(e) {
					e.stop();
					$('about').removeEvents('mouseenter');
					pamphlet.start({
						bottom: ['0px', '70px'],
						borderWidth: ['0px', '20px'],
						right: ['80px', '60px']
					});
					shadow.start({
						bottom: ['35px', '-50px']
					});
					shadowfade.start({
						opacity: ['1', '0']
					});
					window.setTimeout(function() {
						$('info').style.display = 'block';
						$('closer').style.display = 'block';
						$('about').style.cursor = 'default';
						becomepaler.start({
							backgroundColor: '#f0f3f6'
						});
					}, 1250);
					$('content').style.display = 'none';
					
				});	
			}, 1250);
			
		});
	});