var g_oPopupMenu = new SMPopupMenu("SMGlobalPopupMenu"), oItem = null;
with(g_oPopupMenu){
addItem("1001", "Biscotti_20alla_20Mandorla", "/pi1/index.html", 1, "", 1, "");
addItem("1002", "Biscotti_20ripieni", "/pi2/index.html", 1, "", 1, "");
addItem("1003", "Frollini", "/pi3/index.html", 1, "", 1, "");
addItem("1004", "Biscotti_20prima_20colazione", "/pi4/index.html", 1, "", 1, "");
addItem("1005", "Linea_20Biscotti", "/pi5/index.html", 1, "", 1, "");
addItem("1006", "Cannoli_20mit_20Ricottaf_C3_BCllung", "/pi6/index.html", 1, "", 1, "");
addItem("1007", "Cannoli_20Patisserie,_20Schokoladencr_C3_A8me", "/pi7/index.html", 1, "", 1, "");
addItem("1008", "halbfertig_20Produkte_20(semilavorati)", "/pi8/index.html", 1, "", 1, "");
addItem("10013", "Arancine_2030g", "/pi13/index.html", 1, "", 1, "");
addItem("10011", "Arancine_2080g", "/pi11/index.html", 1, "", 1, "");
addItem("10012", "Arancine_20180g", "/pi12/index.html", 1, "", 1, "");
};

var m_sSelectedOptionValue = '0';
function printCatnavDropdown(){
	document.write('<select id="catdropdown" style="width:100%"></select>');
	SMShop.base.addMember("CatnavDropdown");
};

function CatnavDropdown_windowOnLoad(args){
	var oItems = g_oPopupMenu.selectItems(0, true);
	var selCatDropDown = $('catdropdown'),oOption = null, sDepth = '';

	if(m_sSelectedOptionValue == '0'){
		oOption = selCatDropDown[selCatDropDown.length] = new Option();
		with(oOption){
			selected='selected';
			text='<Warengruppen>';
			value = '0';
		}
	};

	oItems.each(function(oItem) {
		sDepth = ''; for(var i=1;i<parseInt(oItem.depth);i++) sDepth += '-';
		oOption = selCatDropDown[selCatDropDown.length] = new Option();
		with(oOption){
			if(oItem.id == m_sSelectedOptionValue) selected = 'selected';
			text = sDepth + ' ' + oItem.caption;
			value = oItem.id;
		}}
	);

	selCatDropDown.onchange = function(){
		var oItem = g_oPopupMenu.selectSingleItem(this.value);
		
		location.href = SMOMAbsoluteRootURL + oItem.url;
		
	};
};