/**
* Copyright 2004 massimocorner.com
* JavaScript library for the "hiermenu" ColdFusion custom tag
* @author      Massimo Foti (massimo@massimocorner.com)
* @version     1.0, 2004-10-12
 */
 
var tmt_allowHideHiermenu=true;
function tmt_showHiermenu(menuobj){
	tmt_allowHideHiermenu=false;
	if(document.all){
		var childMenus = menuobj.parentNode.childNodes;
		for(var i=0; i<childMenus.length; i++){	
			var obj = childMenus[i];
			if(obj.nodeName.toLowerCase() == "ul"){
				obj.style.display = "block";
				obj.attachEvent("onmouseover", function(){obj.style.display = "block";});
			}
		}
	}
}

function  tmt_hideHiermenu(menuobj) {
	if(document.all/* && tmt_allowHideHiermenu*/){
		var childMenus = menuobj.parentNode.childNodes;
		for(var i=0; i<childMenus.length; i++){	
			var obj = childMenus[i];
			if(obj.nodeName.toLowerCase() == "ul"){
				obj.style.display = "none";
				obj.attachEvent("onmouseout", function(){obj.style.display = "none";});
			}
		}
	}
}
/*
var tmt_hideHiermenu_menuobj, tmt_hideHiermenu_timeout=null;
function tmt_hideHiermenu(menuobj){
	tmt_allowHideHiermenu=true;
	tmt_hideHiermenu_menuobj=menuobj;
	clearTimeout(tmt_hideHiermenu_timeout);
	tmt_hideHiermenu_timeout=setTimeout("tmt_hideHiermenu_do(tmt_hideHiermenu_menuobj)",100);
}
*/



/**
* Ez a kattintgatós, maga alá nyílós menühöz kell, ha minden menünél becsukunk mindent.
*/
function tmt_showParentsHiermenu(menuobj,hideall) {
	if (!menuobj || !menuobj.parentNode){return false;}
	if (menuobj.parentNode.id==hideall){return true;}
	if (menuobj.parentNode.nodeName.toLowerCase() == "ul"){
		menuobj.parentNode.style.display = "block";
		if (getBrowserType('ie'))IExploreIDclassHack(menuobj.parentNode.id, menuobj.parentNode.className);
	}
	tmt_showParentsHiermenu(menuobj.parentNode,hideall);
}
var tmt_hideChildrenHiermenu_id=0;
function tmt_hideChildrenHiermenu(menuobj,dontallowhide,ahref) {
	if (!menuobj || !menuobj.childNodes || typeof menuobj.id=='undefined')return false;
	//kinyitni ahol vagyunk, ha minden szinten php oldalletöltésre megyünk
//if (isNaN(window.qwe))window.qwe=0;
//window.qwe++;
//if (window.qwe<10)alert(menuobj.href+"=="+ahref.replace(/\?&/,"?").replace(/\&&/,"&").replace(/&mid=\d+/,"").replace(/&price=[\d_]+/,"").replace(/&order=\w+/,""));
	if (typeof ahref!='undefined' && menuobj.nodeName.toLowerCase() == "a" && menuobj.href.replace(/\?&/,"?").replace(/\&&/,"&")==ahref.replace(/\?&/,"?").replace(/\&&/,"&").replace(/&mid=\d+/,"").replace(/&price=[\d_]+/,"").replace(/&order=\w+/,"")){
		tmt_showParentsHiermenu(menuobj,'tmtHierbar');
		tmt_showHiermenu3(menuobj);
		if (menuobj.parentNode)tmt_showHiermenuShowAllChild(menuobj.parentNode);
	}
 	if (!menuobj.id) {
        menuobj.id='tmt_hideChildrenHiermenu_id_'+tmt_hideChildrenHiermenu_id;
        tmt_hideChildrenHiermenu_id++;
    }
	if(menuobj.nodeName.toLowerCase() == "ul"){
		if (dontallowhide!=1)menuobj.style.display = "none";
	}
	for (var i=0;i<menuobj.childNodes.length;i++) {
		tmt_hideChildrenHiermenu(menuobj.childNodes[i],dontallowhide,ahref);
	}
}
function tmt_showHiermenuHideOther(menuobj,hideall) {//starts from outer obj!! forEx: div, not the UL itself
	if (hideall && document.getElementById(hideall)) var divobj=document.getElementById(hideall);
	tmt_hideChildrenHiermenu(divobj);
	//get parents and show
	tmt_showParentsHiermenu(menuobj,hideall);
	//get brothers and show
	tmt_showHiermenu3(menuobj);
	//get childs and show
	tmt_showHiermenuShowAllChild(menuobj);
}
function tmt_showHiermenu3(menuobj){
	if (menuobj && menuobj.parentNode) {
		var childMenus = menuobj.parentNode.childNodes;
		for(var i=0; i<childMenus.length; i++){
			var obj = childMenus[i];
			if(obj.nodeName.toLowerCase() == "ul"){
				obj.style.display = "block";
			}
		}
	}
}

function tmt_showHiermenuShowAllChild(menuobj){
	if (menuobj && menuobj.childNodes) {
		var childMenus = menuobj.childNodes;
		for(var i=0; i<childMenus.length; i++){
			var obj = childMenus[i];
			if(obj.nodeName.toLowerCase() == "ul" || obj.nodeName.toLowerCase() == "li"){
				obj.style.display = "block";
				tmt_showHiermenuShowAllChild(obj);
			}
		}
	}
}
/**/


