function topmenu(rootid,menu_code_level1,menu_code_level2){
	try{document.execCommand('BackgroundImageCache', false, true);}catch(e){}
	var root=$(rootid);
	function replaceKeywords(str,keywords,newkey) {
		var re=new RegExp(eval("/"+keywords+"/g"));
		var value1=str.replace(re,newkey);
		return value1;
	}
	function hideall() {
		$("ul",root).each(function (){
			$(this).hide();
		})
	}
	function toggleimg(){
		$(">li>a>img",root).each(function (){
			$(this).attr('src',replaceKeywords($(this).attr('src'),"_.gif",".gif"));
		})
	}
	function sethover(num1,num2){
		hideall();
		toggleimg();
		$(">li>a",root).each(function (i){
			if(i==num1){
				$("ul",this.parentNode).show();
				$(">img",this).attr('src',replaceKeywords($(">img",this).attr('src'),".gif","_.gif"));
			}
		})
		$(">li>ul>li>a",root).each(function (i){
			if(i==num2){
				//$(this).addClass("hover");
			}
		})
	}
	$(">li>a",root).each(function (i){
		$(this).hover(function (i){
			hideall();
			$("ul",this.parentNode).show();
			toggleimg();
			$(">img",this).attr('src',replaceKeywords($(">img",this).attr('src'),".gif","_.gif"));
			return false;
		})
		$(this).focus(function (){
			hideall();
			$("ul",this.parentNode).show();
			toggleimg();
			$(">img",this).attr('src',replaceKeywords($(">img",this).attr('src'),".gif","_.gif"));
			return false;
		})
	})
	$("ul",root).hover(function (){},function (){
		sethover(menu_code_level1-1,menu_code_level2-1);
	})
	sethover(menu_code_level1-1,menu_code_level2-1);
}

