
/*********************************************************************
File Name:	ddmenu.js
File Info:	Javascript
Author:		WEB DESIGN LAB
		http://webdlab.com/
Last Modified:	10.01.2009
*********************************************************************/

/*--------------------------------------------------------------------
Script
--------------------------------------------------------------------*/

function ddRoll() {
	var ddImg = document.getElementsByTagName("img");
	for(var i=0; i<ddImg.length; i++) {
	if(ddImg[i].className == "on") {
	var iFle = ddImg[i].getAttribute("src");
	var iFit = iFle.substring(iFle.lastIndexOf("."), iFle.length);
	var iRep = iFle.replace(iFit, "_on" +iFit);
	ddImg[i].setAttribute("iRep", iRep);
		ddImg[i].onmouseover = function() {
			this.setAttribute("src", this.getAttribute("iRep"));
		}
		ddImg[i].onmouseout = function() {
			this.setAttribute("src", this.getAttribute("src").replace("_on" +iFit, iFit));
		}
	}
	}
}

function ddMenu(){
	if(document.getElementById){
	var ddm = document.getElementById('ddR1');
	for(var i=0; i<ddm.childNodes.length; i++){
	if(ddm.childNodes[i].className == 'ddList'){
		ddm.childNodes[i].onmouseover = function(){
		expand(this);
	}
		ddm.childNodes[i].onmouseout = function(){
		contract(this);
	}
	}
	}
	}
}

function expand(ddm){
	for(var i=0; i<ddm.childNodes.length; i++)
	if(ddm.childNodes[i].className == 'ddR2')
	ddm.childNodes[i].style.display = ddm.childNodes[i].style.display = 'block';
}

function contract(ddm){
	for(var i=0; i<ddm.childNodes.length; i++)
	if(ddm.childNodes[i].className == 'ddR2')
	ddm.childNodes[i].style.display = ddm.childNodes[i].style.display = 'none';
}

function addEvent(init) {
	if (window.addEventListener) {
		window.addEventListener("load",init, false);
	} else if (window.attachEvent) {
		window.attachEvent("onload",init);
	}
}

addEvent(function(){ ddRoll(); ddMenu(); });

