var path = window.location.pathname;
var pagina = path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.'));

//alert(pagina);

function InitButtons() {
	InitBut("main");
	InitBut("bio");
	InitBut("book");
	InitBut("celebrities");
	InitBut("blog");
	InitBut("contact");
}

function StartMOver() {
	var o;
	if(window.event) {
		o = document.getElementById(window.event.srcElement.id); 
		//alert(window.event.srcElement.id);
	}
	else
		o = this;

	if(o.style.filter || o.style.filter=='')
		o.style.filter = 'alpha ( opacity = 60) ';
	else
		o.style.opacity = .60;

}

function EndMOver() {
	var o;
	if(window.event) {
		o = document.getElementById(window.event.srcElement.id); 
//alert(window.event.srcElement.id);
	}
	else
		o = this;
	if(o.style.filter || o.style.filter=='')
		o.style.filter = 'alpha ( opacity = 30) ';
	else
		o.style.opacity = .30;

}

function InitBut(id) {
	var o = document.getElementById(id);

	if(id==pagina) {
		if(o.style.filter || o.style.filter=='') {
		   o.style.filter = 'alpha ( opacity = 90) ';
		}
		else
			o.style.opacity = .90;
		
	}
	else {
		if(o.style.filter || o.style.filter=='')
   		o.style.filter = 'alpha ( opacity = 30) ';
	   else
			o.style.opacity = .30;
		
		if( o.addEventListener ) {
			o.addEventListener('mouseover', StartMOver, false);
			o.addEventListener('mouseout', EndMOver, false);
		} else if( o.attachEvent ) {
			o.attachEvent( 'onmouseover', StartMOver );
			o.attachEvent( 'onmouseout', EndMOver );
		}
	}
//	alert(document.getElementById(id).style.opacity);
}

if( window.addEventListener ) {
	window.addEventListener('load', InitButtons, false);
} else if( document.addEventListener ) {
	document.addEventListener('load', InitButtons, false);
} else if( window.attachEvent ) {
	window.attachEvent( 'onload', InitButtons );
}
