function init() {

logo = document.getElementById('logo');
logo.style.opacity ='0.5';



interval = null; secondinterval = null; thirdinterval = null;
logo.onmouseup = lightUp;
//logo.onmouse = function() {clearInterval(interval);clearInterval(secondinterval);clearInterval(thirdinterval);}
logo.onmouseover = halfLightUp;
startSection();
}
function halfLightUp(){ 
clearInterval(interval);
interval = setInterval('logo.style.opacity = goToValue(logo.style.opacity,0.7,0.15,interval,halfLightDown);', 50);

}

function halfLightDown(){
clearInterval(interval);
interval = setInterval('logo.style.opacity = goToValue(logo.style.opacity,0.3,0.3,interval,null);', 50);

}


function lightUp(){
dimSection();
clearInterval(interval);
interval = setInterval('logo.style.opacity = goToValue(logo.style.opacity,1,0.15,interval,lightDown);', 50);

}

function lightDown(){
clearInterval(interval);
nextSection();
interval = setInterval('logo.style.opacity = goToValue(logo.style.opacity,0.5,0.3,interval,null);', 50);

}

function goToValue(value,increase,time,inttostop,functiotostart)
{

	constant = (increase - parseFloat(value)) / (time * 15);
	
	
	if(!(constant > -0.0001 && constant < 0.01)) {
	
	
	string = parseFloat(value) + constant;
	
	return string +"";
	} else {
	clearInterval(inttostop);
	delete goToValue.counter;
	functiotostart();
	}
	
}

function nextSection(){
	got = nextItemToCatch();
	clearInterval(secondinterval);
	
	todisplay = document.getElementById(got);
	window.location.hash = got;
	todisplay.style.opacity = '0';
	todisplay.style.display = 'block';
	secondinterval = setInterval('todisplay.style.opacity = goToValue(todisplay.style.opacity,0.5,0.3,secondinterval,null);', 50);
	
}

function startSection(){
	if(hash = getHash()) {
	got = hash;
	
	todisplay = document.getElementById(got);
	window.location.hash = got;
	todisplay.style.opacity = '0';
	todisplay.style.display = 'block';
	secondinterval = setInterval('todisplay.style.opacity = goToValue(todisplay.style.opacity,0.5,0.3,secondinterval,null);', 50);
	}
	
}

function nextItemToCatch() {
if(hash = getHash()) {
var current = document.getElementById(hash);

while(current = current.nextSibling) {
	if(current.nodeType == 1) {
	if(current.getAttribute('class') == 'section') {
		return current.getAttribute('id');
	}
	}
}
}
return 'descriptio';
	
}

function dimSection(){
	if(hash = getHash()) {
		
	clearInterval(thirdinterval);
	todisplay = document.getElementById(hash);
	thirdinterval = setInterval('todisplay.style.opacity = goToValue(todisplay.style.opacity,0.0,0.2,thirdinterval,null);', 50);
	setTimeout("todisplay.style.display = 'none';",200);
	}
	
}

function getHash() {
  var hash = window.location.hash;
  return hash.substring(1);
}

window.onload = init;
 
