function tag(name,win){
	if(win){obj = frames[win].document;}
	else{obj = document;}
	if(!document.getElementById){
	 if(document.all){document.getElementById=function(){if(typeof document.all[name]!="undefined"){return document.all[arguments[0]];}else{return null;}}}
	 else if(document.layers){document.getElementById=function(){if(typeof document[name]!="undefined"){return document[arguments[0]];}else{return null;}}}
	}
	return obj.getElementById(name);
}

function dynamicMenu(div_id,menu,actived){
	if(!menu){
		for(fx=1;fx<Cat.length;fx++){
			splitted = Cat[fx].split("|");
			for(fy=0;fy<splitted[1];fy++){
				obj = tag(fx +'|'+ fy);
				if(obj.href == location.href){menu = fx;actived = 'off';}
			}
		}
	}
	
	content = '';
	for(fx=1;fx<Cat.length;fx++){
		
		
		actived_tmp = 'off';
		img_menu = img_off;
		splitted = Cat[fx].split("|");
		if(menu && menu == fx && actived != 'on'){img_menu = img_on;actived_tmp = 'on';}
		
		href = '';
		cat = tag(fx +'|0').title;
		if(splitted[0] == cat){href = 'href="'+ tag(fx +'|0').href +'"';}
				
		target = '';
		if(tag(fx +'|0').target){target = ' target="'+ tag(fx +'|0').target +'"';}
		
		content += '<tr><td class=\"'+ div_id +'_elcat\"><a href="javascript:dynamicMenu(\''+ div_id +'\','+ fx +',\''+ actived_tmp +'\');"><img border="0" src="'+ dir_img + img_menu +'"></a></td><td class=\"'+ div_id +'_cat\"><a class=\"'+ div_id +'_cat\"'+ href +''+ target +'>'+ splitted[0] +'</a></td></tr>';
		if(menu && menu == fx){
			if(actived == 'off'){
				content_ = '';
				for(fy=0;fy<splitted[1];fy++){
					obj = tag(menu +'|'+ fy);
					if(obj.title != splitted[0]){
						target = '';
						if(obj.target){target = ' target="'+ obj.target +'"';}
						content_ += '<tr><td class=\"'+ div_id +'_scat\"><a class=\"'+ div_id +'_scat\" href="'+ obj.href +'"'+ target +'>'+ obj.title +'</a></td></tr>';
					}
				}
				content += '<tr><td colspan=\"2\" class=\"'+ div_id +'_global_scat\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">'+ content_ +'</table></td></tr>';
			}
		}
		content += '<tr><td colspan=\"2\" style=\"font-size:5px;\">&#160;</td></tr>';
	}
	content = '<table class=\"menu\" cellspacing=\"0\" cellpadding=\"0\">'+ content +'</table>';
	tag(div_id).innerHTML = content;
	
}

