
// Meniu principal ------------------------------------------------------------------------

function showMenu(id) {
	document.getElementById('secundar_'+id).style.visibility = 'visible';
	}
function hideMenu(id) {
	document.getElementById('secundar_'+id).style.visibility = 'hidden';
	}
function showSubMenu(menu, id) {
	document.getElementById('secundar_'+menu+'_'+id).style.visibility = 'visible';
	}
function hideSubMenu(menu, id) {
	document.getElementById('secundar_'+menu+'_'+id).style.visibility = 'hidden';
	}
	
// Meniu expandabil ------------------------------------------------------------------------

currentSubCategory = "";  

function toggleSubCategory(futureSubCategory) {
	if (currentSubCategory) {	
		if (document.getElementById(currentSubCategory)) {	
			document.getElementById(currentSubCategory).style.display = 'none';	
		}
	}

	if(currentSubCategory==futureSubCategory) {
		document.getElementById(futureSubCategory).style.display = 'none';
		currentSubCategory = "";
	}else
	if (futureSubCategory) {	
		if (document.getElementById(futureSubCategory)) {
			document.getElementById(futureSubCategory).style.display = 'block';	
			currentSubCategory = futureSubCategory;	
		}
	}
}

// Meniu pentru filtrare ------------------------------------------------------------------------

function showMenuF(id) {
	document.getElementById('secundarF_'+id).style.visibility = 'visible';
	}

function hideMenuF(id) {
	document.getElementById('secundarF_'+id).style.visibility = 'hidden';
	}
	
// Harta site -----------------------------------------------------------------------------------

this.hartaSiteExpandabil = function(){
	var hartaSite = document.getElementById("hartaSite")
	if(hartaSite){

		this.listItem = function(li){
			if(li.getElementsByTagName("ul").length > 0){
				var ul = li.getElementsByTagName("ul")[0];
				ul.style.display = "none";
				var span = document.createElement("span");
				span.className = "inchis";
				span.style.cursor = "pointer";
				span.onclick = function(){
					ul.style.display = (ul.style.display == "none") ? "block" : "none";
					this.className = (ul.style.display == "none") ? "inchis" : "deschis";
				};
				li.appendChild(span);
			};
		};

		var items = hartaSite.getElementsByTagName("li");
		for(var i=0;i<items.length;i++){
			listItem(items[i]);
		};

	};	
};

window.onload = hartaSiteExpandabil;

// Cautare ------------------------------------------------------------------------------------------
function cautarebynar()
{
	document.cauta.action='/cauta-in-site/'+document.cauta.camp_produs.value+'/Categorie,toate/Stoc,toate/Pagina1';
}