function Menu(objn)
	{
		var obj = document.getElementById(objn);
		if(obj.style.display == 'none')
		{
			obj.style.display ='';
			
			MenuState(obj.id,"0");
			
		}
		else
		{
			obj.style.display ='none';
			
			MenuState(obj.id,"1");
		}
	}
	function SecondMenu(img,objn)
	{
		var ig = document.getElementById(img);
		var obj = document.getElementById(objn);
		if(obj.style.display == 'none')
		{
			ig.src="../images/member/jian.gif"
			obj.style.display = '';
			MenuState(obj.id,"0");
			
		} 
		else
		{
			ig.src="../images/member/jia.gif"
			obj.style.display ='none';
			MenuState(obj.id,"1");
			
		}
	}
	
	function MenuState(id,value)
	{
		
		var menu = MenuGetState("oleft");
		if(menu !=null)
		{
			if(menu.indexOf(id) == -1)
			{
				menu += id+":"+value + "/";
			}
			else
			{
				var rstr = id+":"+value;
				var str1 = id+":"+"0";
				var str2 = id+":"+"1";
				menu = menu.replace(str1,rstr);
				menu = menu.replace(str2,rstr);
			}
			
		}
		else
		{
			menu = id+":"+value + "/";
		}
		MenuSetState("oleft",menu);
	}
	try
	{
	    GetMenu();
	}
	catch(err)
	{	   
	    ClearMenu();
	}
	function GetMenu()
	{
		var menu = MenuGetState("oleft");
		
		if(menu != null)
		{
			var mtemp = menu.split('/');
			
			for(i=0;i<mtemp.length-1;i++)
			{
				var otemp = mtemp[i].split(':');
				if(otemp.length > 1)
				{
					var obj = document.getElementById( otemp[0] );
					if( obj != null)
					{
					    if(otemp[1] == "0")
					    {
						    obj.style.display = '';
						    if(otemp[0].length>2)
						    {
							    var img = "i"+otemp[0];
							    document.getElementById(img).src="../images/member/jian.gif"
						    }
					    }
					    else
					    {
						    obj.style.display = 'none';
						    if(otemp[0].length>2)
						    {
							    var img = "i"+otemp[0];
							    document.getElementById(img).src="../images/member/jia.gif"
						    }
					    }
					}				
				}
			}
			
		}
		MenuGetStyle();
	}
	function MenuSetStyle(obj)
	{
		MenuSetState("oleftstyle",obj.id);
	}
	
	function MenuGetStyle()
	{
		var objv = MenuGetState("oleftstyle");
		if(objv!=null)
		{
			var obj=document.getElementById(objv);
			if(obj !=null)
			{
				obj.className="leftnavon";
				if(obj.innerHTML=='投保单管理')
				{
				    document.getElementById('imgbx').display='none';
				}
				else
				{
				    obj.innerHTML = obj.innerHTML +">>>";
				}
			}
			
		}
	}
	
	function ClearMenu()
	{
		MenuSetState("oleft",'');
	}
	function MenuSetState(name, value)
	{
		var expdate = new Date();
		var argv = MenuSetState.arguments;
		var argc = MenuSetState.arguments.length;
		var expires = (argc > 2) ? argv[2] : null;
		var path = (argc > 3) ? argv[3] : null;
		var domain = (argc > 4) ? argv[4] : null;
		var secure = (argc > 5) ? argv[5] : false;
		if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000*60 ));//1000*60*60*24*365
		document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
			+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
			+((secure == true) ? "; secure" : "");
	}

	function MenuGetState(name)
	{
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen)
		{
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg)
			return GetStateVal (j);
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
		return null;
	}
	function GetStateVal(offset)	
	{
		var endstr = document.cookie.indexOf (";", offset);
		if (endstr == -1)
		endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}	



