function menuControl()
{
	var numID = Math.floor(Math.random()*3) + 1;
	showOneSpan(numID);
}
function showOneSpan(obj)
{
	var s = "menu_" + obj;
	document.getElementById(s).className = "info_on";
}
function hiddenAllSpan()
{
	for(var i=1; i<=3; i++)
	{
		var s = "menu_" + i;
		document.getElementById(s).className = "info_off";
	}
}
function sel(val)
{
	document.getElementById("text0").value += val + "\n";
}

function LTrim(s)
{
	for(var i=0;i<s.length;i++)
		if(s.charAt(i)!=' ') return s.substring(i,s.length);
	return "";
}

function RTrim(s)
{
	for(var i=s.length-1;i>=0;i--)
		if(s.charAt(i)!=' ') return s.substring(0,i+1);
	return "";
}

function Trim(s)
{
	return RTrim(LTrim(s));
}


function check(theForm,sp)
{
	var str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./'[]{}`1234567890-=\~!@#$%^&*()_+|?><:";
	if(Trim(theForm.gbookuser.value) =="")
	{
		alert("请输入姓名");
		theForm.gbookuser.focus();
		return(false);
	}
	var c=theForm.gbookuser.value.substr(0,1);
	if(str.indexOf(c)>-1)
	{
		alert("姓名必须填写中文");
		theForm.gbookuser.focus();
		return(false);
	}
	if(Trim(theForm.tel.value)=="")
	{
		alert("请输入电话");
		theForm.tel.focus();
		return(false);
	}
	if(Trim(theForm.address.value)=="")
	{
		alert("请输入地址");
		theForm.address.focus();
		return(false);
	}
	if(sp == 1)
	{
		if(theForm.pcode.value == "")
		{
			alert("请输入邮编");
			theForm.pcode.focus();
			return(false);
		}
	}
	if(theForm.text0.value == "")
	{
		alert("请输入留言内容");
		theForm.text0.focus();
		return(false);
	}
}
function addBookmark(){
	var title = "";
	var url = document.referrer;
	if (window.sidebar)	{ 
		window.sidebar.addPanel(title, url, ""); 
	}
	else if( document.all ) {
		window.external.AddFavorite( url, title);
	}
	else if( window.opera && window.print ) {
		return true;
	}
}
