var g_oPopupMenu = new SMPopupMenu("SMGlobalPopupMenu"), oItem = null;
with(g_oPopupMenu){
addItem("1006", "Weissweine", "/pi5/index.html", 1, "", 1, "");
addItem("1007", "Weissweine_20trocken", "/pi5/pi6/index.html", 2, "", 1, "");
addItem("1009", "Weissweine_20halbtrocken", "/pi5/pi8/index.html", 2, "", 1, "");
addItem("10010", "Weissweine_20lieblich", "/pi5/pi9/index.html", 2, "", 1, "");
addItem("1008", "Rotweine", "/pi7/index.html", 1, "", 1, "");
addItem("10011", "Rotweine_20trocken", "/pi7/pi10/index.html", 2, "", 1, "");
addItem("10012", "Rotweine_20halbtrocken", "/pi7/pi11/index.html", 2, "", 1, "");
addItem("10013", "Rotweine_20lieblich", "/pi7/pi12/index.html", 2, "", 1, "");
addItem("10014", "Rotweine_20Spezial", "/pi7/pi13/index.html", 2, "", 1, "");
addItem("10015", "Ros_C3_A9weine_20trocken", "/pi14/index.html", 1, "", 1, "");
addItem("10016", "Edels_C3_BC_C3_9Fe_20Tropfen", "/pi15/index.html", 1, "", 1, "");
addItem("10017", "Secco_60s_20aus_20der_20Pfalz", "/pi16/index.html", 1, "", 1, "");
addItem("10018", "Minibarflaschen", "/pi17/index.html", 1, "", 1, "");
addItem("10019", "Grappa_C2_B4s_20und_20Edelbr_C3_A4nde", "/pi18/index.html", 1, "", 1, "");
addItem("10020", "Magnum_20Flaschen", "/pi19/index.html", 1, "", 1, "");
addItem("10021", "Accessoires", "/pi20/index.html", 1, "", 1, "");
addItem("10022", "Weingeschenke", "/pi21/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;
		
	};
};