// top menu fnc 
// by bianca 2008 代码放到文档流导航后面 通过图片onload控制defaule状态

var secondmenu = document.getElementById("second_menu");
var sm = secondmenu.getElementsByTagName("div");

var firstmenu = document.getElementById("first_menu");
var fm = firstmenu.getElementsByTagName("a");

	function show_top_menu(secondID,firstID)
	{		
		for(var i=0;i<fm.length;i++){
			fm[i].className = 'mouseout';
			if(fm[i].id==firstID){
				fm[i].className = firstID;
			}
		}
		show_sm(secondID);
	}

	function show_sm(objid){
		for(var i=0;i<sm.length;i++){
			sm[i].style.display='none';
			if(sm[i].id==objid){
				sm[i].style.display='block';
			}
		}
	}
	
	function defaultmenu()
	{
		var loc = window.location.href;
		if(loc=='http://www.bianca.net.cn' || loc=='http://www.bianca.net.cn/' || loc=='http://www.bianca.net.cn/index.php' || loc=='http://www.bianca.net.cn/index.php#'){
			fm[0].className = "fm1";
			style_smbg();	//装载仅首页样式
			show_sm("sm1");
		}else{
			for(var i=0;i<fm.length;i++){
				var pattern = new RegExp(fm[i].name,"i");  
				fm[i].className = '';
				if(pattern.test(loc)){
					if(fm[i].name=='toilette'){	//装载第二套样式
						style_topskin();
					}
					fm[i].className = fm[i].id;
					var defsm = fm[i].id.substr(1,2);
					var smid = "s"+defsm;
					show_sm(smid);
				}
			}
		}
		
		function style_smbg()
		{
			secondmenu.style.cssText = "padding-left:10px; height:25px; background-image:url(/images/menu/login_top_bg.gif); background-repeat:no-repeat; background-position:128px 0px;";
		}
		
		function style_topskin()
		{
			document.getElementById("top_skin_1").style.backgroundImage = "url(/images/top_bga2.gif)";
			var skin_first_menu = document.getElementById("first_menu");
			skin_first_menu.style.backgroundColor = "#ffc1dd";
			var skin_first_menu_a = skin_first_menu.childNodes;
			for(var i=0;i<skin_first_menu_a.length;i++){
				if(skin_first_menu_a[i].style){
					skin_first_menu_a[i].style.color = "#FFFFFF";
					skin_first_menu_a[i].style.backgroundColor = "#d95086";
				}
			}
		}
	}
