// JavaScript Document
var currentExp = null;
function setOpacity(value, obj) {
	obj.style.opacity = value/100;
	obj.style.filter = 'alpha(opacity=' + value + ')';
}
function collapseChildren(obj){
	for(var i in obj.children){
		if(obj.children[i].tagName!="LI"&&obj.children[i].tagName!="li")
		continue;
		
		var group = obj.children[i];
		group.style.overflow="hidden";
		group.style.height=(group.children[0].clientHeight+3)+"px";
		group.onmouseover=expand;
		group.onmouseout=collapse2;		
	}
}
function firstTag(obj,tag){
	var uls = obj.getElementsByTagName(tag);
	return uls[0];
} 
function expand(){
	if(currentExp)
	collapse(currentExp);
	currentExp=this;
	this.style.height=this.scrollHeight+"px";
}
function collapse2(){
	//this.onclick=expand;	
	if(currentExp==this)
	currentExp=null;
	this.style.height=(this.children[0].clientHeight+3)+"px";
}
function collapse(obj){
	//this.onclick=expand;	
	if(currentExp==obj)
	currentExp=null;
	obj.style.height=(obj.children[0].clientHeight+3)+"px";
}
collapseChildren(document.getElementById('nav_list'));
var mn = document.getElementById('main');
var bg = document.createElement('div');
bg.className="alpha_bg";
setOpacity(90, bg);
if(ie)
bg.style.height=mn.clientHeight+"px";
mn.appendChild(bg);

var ind=(location.protocol+"//"+location.hostname+"/vitae/");
var theURL = location.href==ind?ind+"index.php?v=dev":location.href;

var as = document.getElementsByTagName('a');
for(var i=0; i< as.length;i++){
	//alert(as[i].href);	
	if(as[i].href==theURL)
	as[i].className=as[i].className + " active";
}
//alert(mn);