function IsUpdateProduct(thefrm)
{
	if(Trim(thefrm.ProductTitle.value)=="")
	{
		alert("产品名称是......");
		thefrm.ProductTitle.focus();
		return false;		
	}
	if(Trim(thefrm.ProductPic.value)=="")
	{
		alert("产品图片是......");
		thefrm.ProductPic.focus();
		return false;		
	}
	if(Trim(thefrm.ProductTime.value)=="")
	{
		alert("产品时间是......");
		thefrm.ProductTime.focus();
		return false;		
	}
	else
	{
		if(!PDDate(Trim(thefrm.ProductTime.value)))
		{
			alert("产品时间输入有误！");
			thefrm.ProductTime.focus();
			return false;
		}
		}
}

function IsLog(thefrm)
{
	if (Trim(thefrm.UserId.value)=="")
	{
		alert("帐号是......");
		thefrm.UserId.focus();
		return false;
	}
	if (Trim(thefrm.UserPwd.value)=="")
	{
		alert("密码是......");
		thefrm.UserPwd.focus();
		return false;
	}
	
}

function ModPwd(UserId,UserPwd)
{
	div1.style.display='';
	frmM1.UserId.value=UserId;
	frmM1.UserPwd.value=UserPwd;	
}

function IsUpdateNews(thefrm)
{
	if(Trim(thefrm.NewsTitle.value)=="")
	{
		alert("新闻标题是......");
		thefrm.NewsTitle.focus();
		return false;		
	}
	if(Trim(thefrm.NewsTime.value)=="")
	{
		alert("新闻时间是......");
		thefrm.NewsTime.focus();
		return false;		
	}
	else
	{
		if(!PDDate(Trim(thefrm.NewsTime.value)))
		{
			alert("新闻时间输入有误！");
			thefrm.NewsTime.focus();
			return false;
		}
		}
}


function DelRecord(strHref)
{
	if(confirm("删除操作不可恢复，您确认要删除该记录吗？"))
	{
		window.location.href=strHref;	
	}	
}
function WinOpen(strHref,strName,strFeather)
{
	window.open(strHref,strName,strFeather);	
}
function IsSubmit(thefrm)
{
	if(Trim(thefrm.UserName.value)=="")
	{
		alert("您的姓名是......");
		thefrm.UserName.focus();
		return false;		
	}
	if(Trim(thefrm.UserEmail.value)=="")
	{
		alert("电子邮件是......");
		thefrm.UserEmail.focus();
		return false;		
	}
	else
	{
		  val=thefrm.UserEmail.value;
		  p=val.indexOf('@');
		  p1=val.indexOf('.');
       		  if (p<1 || p==(val.length-1)||p1<1 || p1==(val.length-1)) 
       		  { 
       		  	alert("输入的电子邮件格式不正确！");
			thefrm.UserEmail.focus();
			return false;
       		  }
		}
	if(Trim(thefrm.UserTitle.value)=="")
	{
		alert("标题是......");
		thefrm.UserTitle.focus();
		return false;		
	}
	if(Trim(thefrm.UserContent.value)=="")
	{
		alert("内容是......");
		thefrm.UserContent.focus();
		return false;		
	}
}

function LTrim(string) 
{
  for (i=0; i<string.length; i++) {
    if (string.charAt(i) != " ") {
       string = string.substring(i,string.length)
       return(string);
    }
  }
  return("");
}

function RTrim(string) 
{
  for (i=string.length; i>0; i--) {
    if (string.charAt(i-1) != " ") {
       string = string.substring(0,i)
       return(string);
    }
  }
  return("");
}

function Trim(string) {
	S1 = LTrim(string);
	S2 = RTrim(S1);
    return(S2);
}
