function FadingMenu(ULElement, ULBase){
	
	this.collectSubItems = function(element, itemType){
		this.itemList = new Array();
		try{
			for(this.iCnt = 0; this.iCnt < element.childNodes.length; this.iCnt++){
				if(element.childNodes[this.iCnt].nodeName == itemType){
					this.itemList[this.itemList.length] = element.childNodes[this.iCnt];
				}
			}
		}catch(ex1){alert('FadingMenu_1 - ' + ex1);}
		
		return this.itemList;
	}

	try{
		this.baseUL = ULElement;
		if(ULBase == null){ULBase = this.baseUL;}

		this.LIElements = this.collectSubItems(this.baseUL, 'LI');
		
		for(this.zCnt = 0; this.zCnt < this.LIElements.length; this.zCnt++){
			this.subULList = this.collectSubItems(this.LIElements[this.zCnt], 'UL');
			
			if(this.subULList.length > 0){
				try{
					this.subAList = this.collectSubItems(this.LIElements[this.zCnt], 'A');
					this.LIElements[this.zCnt].subA = this.subAList[0];
					
					this.LIElements[this.zCnt].subUL = this.subULList[0];
					this.LIElements[this.zCnt].subUL.opac = 0;
					this.LIElements[this.zCnt].subUL.subULVisible = false;
					
// HANDLING LI EVENTS
					this.LIElements[this.zCnt].onmouseover = function(){
						try{
							if(this.subUL.style.display != 'block'){this.subUL.subULVisible = false;}
							
							if(!this.subUL.subULVisible){
								this.subUL.subULVisible = true;
								this.subLeft = 0;
								this.subTop = 0;
								this.subWidth = 0;
	
								if(ULElement.id == ULBase.id){
									this.parentObj = this;
									this.subWidth = this.offsetWidth;
//									do {this.subTop += this.parentObj.offsetTop;}while (this.parentObj = this.parentObj.offsetParent);
									this.subTop = this.parentObj.offsetTop;
									this.parentObj = this;
//									do {this.subLeft += this.parentObj.offsetLeft;}while (this.parentObj = this.parentObj.offsetParent);
								}else{
									this.subTop = this.offsetTop;
									this.subLeft = this.offsetLeft;
									this.subWidth = this.offsetWidth;
								}
								
								this.subUL.style.zIndex = '10';
								this.subUL.style.left = parseInt(this.subLeft + this.subWidth) + 'px';
								this.subUL.style.top = this.subTop + 'px';

							    this.subUL.style.filter = 'alpha(opacity = ' + (this.subUL.opac * 100) + ')';
								this.subUL.style.opacity = this.subUL.opac;

								this.subUL.style.position = 'absolute';
								this.subUL.style.display = 'block';

								fadeIn(this.subUL.id, 25);
							}
						}catch(ex){alert('FadingMenu_li.onmouseover - ' + ex);}
					}

					this.LIElements[this.zCnt].onmouseout = function(){
						try{
							if(this.subUL.style.display == 'block'){
								this.subUL.subULVisible = false;
								this.subUL.style.zIndex = '9';
								initFadeOut(this.subUL.id, 25);
							}
						}catch(ex){alert('FadingMenu_li.onmouseout - ' + ex);}
					}

// HANDLING ANCHOR EVENTS
/*					this.LIElements[this.zCnt].subA.onmouseover = function(){
						try{
							this.parentNode.subUL.subULVisible = true;
						}catch(ex){alert('a.onmouseover - ' + ex);}
					}


					this.LIElements[this.zCnt].subA.onmouseout = function(){
						try{
							this.parentNode.subUL.style.zIndex = '9';
							this.parentNode.subUL.subULVisible = true;
						}catch(ex){alert('a.onmouseout - ' + ex);}
					}
*/
// HANDLING UL EVENTS
					
					this.LIElements[this.zCnt].subUL.onmouseover = function(){
						try{
							this.subULVisible = true;
							if(this.opac < 1){
								fadeIn(this.id, 25);
							}
						}catch(ex){alert('FadingMenu_ul.onmouseover - ' + ex);}
					}

					this.LIElements[this.zCnt].subUL.onmouseout = function(){
//						alert('subUl');
						try{
							if(this.style.display == 'block'){
								this.style.zIndex = '9';
								this.subULVisible = false;
								initFadeOut(this.id, 25);
							}
						}catch(ex){alert('FadingMenu_ul.onmouseout - ' + ex);}
					}

					this.LIElements[this.zCnt].subUL.FadingMenu = new FadingMenu(this.LIElements[this.zCnt].subUL, ULBase);

				}catch(ex3){alert('3 - ' + ex3);}
			}
		}
				
	}catch(ex2){alert('2 - ' + ex2);}
	ULElement.FadingMenu = this;
}

function FadingMenuLeftDir(ULElement, ULBase){
	this.collectSubItems = function(element, itemType){
		this.itemList = new Array();
		try{
			for(this.iCnt = 0; this.iCnt < element.childNodes.length; this.iCnt++){
				if(element.childNodes[this.iCnt].nodeName == itemType){
					this.itemList[this.itemList.length] = element.childNodes[this.iCnt];
				}
			}
		}catch(ex1){alert('FadingMenu_1 - ' + ex1);}
		
		return this.itemList;
	}

	try{
		this.baseUL = ULElement;
		if(ULBase == null){ULBase = this.baseUL;}

		this.LIElements = this.collectSubItems(this.baseUL, 'LI');
		
		for(this.zCnt = 0; this.zCnt < this.LIElements.length; this.zCnt++){
			this.subULList = this.collectSubItems(this.LIElements[this.zCnt], 'UL');
			
			if(this.subULList.length > 0){
				try{
					this.subAList = this.collectSubItems(this.LIElements[this.zCnt], 'A');
					this.LIElements[this.zCnt].subA = this.subAList[0];
					
					this.LIElements[this.zCnt].subUL = this.subULList[0];
					this.LIElements[this.zCnt].subUL.opac = 0;
					this.LIElements[this.zCnt].subUL.subULVisible = false;
					
// HANDLING LI EVENTS
					this.LIElements[this.zCnt].onmouseover = function(){
						try{
							if(this.subUL.style.display != 'block'){this.subUL.subULVisible = false;}
							
							if(!this.subUL.subULVisible){
								this.subUL.subULVisible = true;
								this.subLeft = 0;
								this.subRight = 0;
								this.subTop = 0;
								this.subWidth = 0;
	
								if(ULElement.id == ULBase.id){
									this.parentObj = this;
									this.subWidth = this.offsetWidth;
									do {this.subTop += this.parentObj.offsetTop;}while (this.parentObj = this.parentObj.offsetParent);
									this.parentObj = this;
//									alert(this.parentObj.offsetLeft);
									this.subLeft = this.parentObj.offsetLeft;
									do {this.subLeft += (this.parentObj.offsetLeft);}while (this.parentObj = this.parentObj.offsetParent);
								}else{
									this.subTop = this.offsetTop;
									this.subLeft = this.offsetLeft;
									this.subWidth = this.offsetWidth;
								}
								
								this.subUL.style.zIndex = '10';
								this.subUL.style.left = parseInt(this.subLeft - this.subWidth) + 'px';
								this.subUL.style.top = this.subTop + 'px';

							    this.subUL.style.filter = 'alpha(opacity = ' + (this.subUL.opac * 100) + ')';
								this.subUL.style.opacity = this.subUL.opac;

								this.subUL.style.position = 'absolute';
								this.subUL.style.display = 'block';

								fadeIn(this.subUL.id, 25);
							}
						}catch(ex){alert('FadingMenu_li.onmouseover - ' + ex);}
					}

					this.LIElements[this.zCnt].onmouseout = function(){
						try{
							if(this.subUL.style.display == 'block'){
								this.subUL.subULVisible = false;
								this.subUL.style.zIndex = '9';
								initFadeOut(this.subUL.id, 25);
							}
						}catch(ex){alert('FadingMenu_li.onmouseout - ' + ex);}
					}

// HANDLING ANCHOR EVENTS
/*					this.LIElements[this.zCnt].subA.onmouseover = function(){
						try{
							this.parentNode.subUL.subULVisible = true;
						}catch(ex){alert('a.onmouseover - ' + ex);}
					}


					this.LIElements[this.zCnt].subA.onmouseout = function(){
						try{
							this.parentNode.subUL.style.zIndex = '9';
							this.parentNode.subUL.subULVisible = true;
						}catch(ex){alert('a.onmouseout - ' + ex);}
					}
*/
// HANDLING UL EVENTS
					
					this.LIElements[this.zCnt].subUL.onmouseover = function(){
						try{
							this.subULVisible = true;
							if(this.opac < 1){
								fadeIn(this.id, 25);
							}
						}catch(ex){alert('FadingMenu_ul.onmouseover - ' + ex);}
					}

					this.LIElements[this.zCnt].subUL.onmouseout = function(){
//						alert('subUl');
						try{
							if(this.style.display == 'block'){
								this.style.zIndex = '9';
								this.subULVisible = false;
								initFadeOut(this.id, 25);
							}
						}catch(ex){alert('FadingMenu_ul.onmouseout - ' + ex);}
					}

					this.LIElements[this.zCnt].subUL.FadingMenu = new FadingMenuLeftDir(this.LIElements[this.zCnt].subUL, ULBase);

				}catch(ex3){alert('3 - ' + ex3);}
			}
		}
				
	}catch(ex2){alert('2 - ' + ex2);}
	ULElement.FadingMenu = this;
}


function fadeIn(eid, delay){
	try{
		if(document.getElementById(eid).subULVisible){
			this.subUL = document.getElementById(eid);
			this.subUL.opac = this.subUL.opac + 0.1;
			this.subUL.style.filter = 'alpha(opacity = ' + (this.subUL.opac * 100) + ')';
			this.subUL.style.opacity = this.subUL.opac;
		
			if(this.subUL.opac < 1){
				window.setTimeout('fadeIn(\'' + eid + '\', ' + delay + ')', delay);
			}else{
				this.subUL.opac = 1;
				this.subUL.style.opacity = this.subUL.opac;
				this.subUL.style.filter = 'none';
			}
		}
	}catch(ex){alert('FadingMenu_fadeIn - ' + ex);}
}

function initFadeOut(elemenetId, fadeDelay){
	try{
		this.subUL = document.getElementById(elemenetId);
		if(this.subUL.style.display == 'block' && !this.subUL.subULVisible){
			window.setTimeout('fadeOut(\'' + this.subUL.id + '\', ' + fadeDelay + ')', fadeDelay);
		}
	}catch(ex){alert('FadingMenu_initFadeOut - ' + ex);}
}

function fadeOut(eid, delay){
	try{
		if(!document.getElementById(eid).subULVisible){
			this.subUL = document.getElementById(eid);
			this.subUL.opac = this.subUL.opac - 0.1;
			this.subUL.style.filter = 'alpha(opacity = ' + (this.subUL.opac * 100) + ')';
			this.subUL.style.opacity = this.subUL.opac;

			if(this.subUL.opac > 0){
				window.setTimeout('fadeOut(\'' + this.subUL.id + '\', ' + delay + ')',delay);
			}else{
				this.subUL.opac = 0;
				this.subUL.style.opacity = this.subUL.opac;
				this.subUL.style.display = 'none';
				this.subUL.style.filter = 'none';
/*				try{
					for(this.iCnt = 0; this.iCnt < this.subUL.FadingMenu.LIElements.length; this.iCnt++){
						try{
							for(this.zCnt = 0; this.zCnt < this.subUL.FadingMenu.LIElements[this.iCnt].subUL.FadingMenu.LIElements.length; this.zCnt++){
								try{
									this.subUL.FadingMenu.LIElements[this.iCnt].subUL.FadingMenu.LIElements[this.zCnt].subUL.opac = 0;
									this.subUL.FadingMenu.LIElements[this.iCnt].subUL.FadingMenu.LIElements[this.zCnt].subUL.style.opacity = this.subUL.opac;
									this.subUL.FadingMenu.LIElements[this.iCnt].subUL.FadingMenu.LIElements[this.zCnt].subUL.style.display = 'none';
									this.subUL.FadingMenu.LIElements[this.iCnt].subUL.FadingMenu.LIElements[this.zCnt].subUL.style.filter = 'none';
								}catch(ex){}
							}
						}catch(ex){}
					}
				}catch(ex){}
*/			}
		}
	}catch(ex){alert('FadingMenu_fadeOut_1 - ' + ex);}
}