//Begin MAIN NAV
function Handle() {
	var t = this;
	t.load = [];
	t.unload = [];
	t.add = function(id,v) {
		t[id][t[id].length] = v;
	}
	t.exec = function(id) {
		for(var i=0; i<t[id].length; i++) {
			eval(t[id][i])
		}
	}
	window.onload = function() { 
		t.exec('load');
	}
	window.onunload = function() {
		t.exec('unload');
	}
}
var handle = new Handle();

function DropDown(v,id) {
	var t = this;
	t.last = null;
	t.parent = null;
	t.handle = function(e) {
		var s,a,b;
    if(!e) e = event;
		s = e.type;
		a = e[(window.Event)?((s=='mouseover')?'relatedTarget':'target'):'fromElement'];
		b = e[(window.Event)?((s!='mouseover')?'relatedTarget':'target'):'toElement'];
		if(s=='mouseover' && b) {
			if(b.nodeName.match(/(IMG|#text)/)) b = b.parentNode;
			if(b.className.match(/^dd-(btn|lnk)/)) {
				if(t.time) clearTimeout(t.time);
				if(!b.active) t.activate(b);
			}
		} else if(s=='mouseout' && a && b && a!=b) {
			if(b.nodeName.match(/(IMG|#text)/)) b = b.parentNode;
			if(b && !b.className.match(/dd\-/)) {
				t.wait();
			} else {
				if(a.nodeName.match(/(IMG|#text)/)) a = a.parentNode;
				if(b.nodeName == 'A') b = b.parentNode;
				if(a.nodeName == 'A') a = a.parentNode;
				if(b.className == 'dd-itm') b = b.parentNode;
				if(a != b && a.active && b.active) {
				  t.deactivate(a.activeItem);
				}
			}
		} else {
			t.wait();
		}
		e.cancelBubble = true;
		e.returnValue = false;
	}
	t.activate = function(o) {
		var p,s;
		if(!o.sibling) o.sibling = (o.id) ? document.getElementById(o.id+'-s') : null;
		p = (o.parentNode.className=='dd-itm') ? t.parent : o.parentNode;
		s = o.sibling;
		if(p.active) t.deactivate(p.activeItem);
		if(o.className.match(/dd-hlt/)) o.sticky = true;
		//if(!o.sticky && o.className.match(/^dd-btn/)) o.childNodes[0].src = o.childNodes[0].src.replace('_0.','_1.');
		if(o.href == 'javascript:void(0);') { o.style.cursor = 'default'; }
		if(s) {
			s.activeParent = p;
			o.className += ' dd-act';
			s.style.display = 'block';
		}
		if(t.last != p) t.last = p;
		p.activeItem = o;
		p.active = true;
		o.active = true;
	}	
	t.deactivate = function(o) {
		var p,s;
		p = o.parentNode;
		s = o.sibling;
		if(s) {
			if(s.active) t.deactivate(s.activeItem);
			s.style.display = 'none';
			if(o.className.indexOf(' dd-act')+1) {
				o.className = o.className.substring(0,o.className.indexOf(' dd-act'));
			}			
		}
		//if(!o.sticky && o.className.match(/^dd-btn/)) o.childNodes[0].src = o.childNodes[0].src.replace('_1.','_0.');
		p.activeItem = null;
		p.active = false;
		o.active = false;
	}
	t.time = null;
	t.wait = function() {
		if(t.last && t.last.active) t.deactivate(t.last.activeItem);
		if(t.time) clearTimeout(t.time);
		t.time = setTimeout(v+'.collapse()', 100);
	}
	t.collapse = function(i) {
		var o = t.last;
		while(o) {
			if(o.active) t.deactivate(o.activeItem);
			o = o.activeParent;
		}
	}
	t.load = function() {
		t.parent = document.getElementById(id);
		t.parent.onmouseover = t.parent.onmouseout = t.handle;
		t.parent.onselectstart = function() { return false; }
	}
	t.unload = function() {
		t.parent = null;
		t.last = null;
		t = null;
	}
	handle.add('load',v+'.load()');
	handle.add('unload',v+'.unload()');
}
var dropdown = new DropDown('dropdown','dd');
//var language = new DropDown('language','lg');

//END MAIN NAV

//BEGIN LANGAUGE NAV

function startList() {
if (document.all && document.getElementById) {
navRoot1 = document.getElementById("language");
mnuNode = document.getElementById("lang-menu");
  if (mnuNode.nodeName=="UL") {
	    navRoot1.onmouseover=function() {		   
		   mnuNode.style.display="block";
	    }
	    navRoot1.onmouseout=function() {
		    mnuNode.style.display="none";
		    //mnuNode.style.display=this.style.display.replace
		   //("block", "none");
	    }
   }

 }
}



//END LANGUAGE NAV
