//实现全选功能
function CheckAll(form){
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
	}
}

//显示隐藏菜单
function showsubmenu(sid)
{
var obj1= "ss" + sid
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
document.all.item(obj1).src='image/hide.gif';
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
document.all.item(obj1).src='image/show.gif';
}
}

//显示信息
function popwininfodetail(id){		
  window.open("infodetail.asp?id="+id,"","height=450,width=650,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}

function popwinlydetail(id){		
  window.open("lydetail.asp?id="+id,"","height=450,width=650,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}

//显示用户详细信息
function popwinuserdetail(id){		
  window.open("userdetail.asp?id="+id,"","height=450,width=650,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}

//显示产品详细信息
function popwinproductdetail(id){		
  window.open("productdetail.asp?id="+id,"","height=450,width=650,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes");
}

//检测信息输入情况
function check1(){
if (info.info_title.value ==""){
alert("请输入标题");
info.info_title.focus();
return false;
}

if (info.info_title.value.length>40){
alert("标题内容不得超过40个字符");
info.info_title.focus();
return false;
}
if (info.info_detail.value ==""){
alert("请输入内容");
return false;
}
return true;
}



//检测注册表单的信息
function checkform(){
if(regform.username.value =="" || regform.password.value=="" || regform.e_mail.value=="" || regform.address.value=="" || regform.phone.value=="" ){
alert("对不起，应填写所有必填信息");
return false;
}
if(regform.username.value.length>20 || regform.password.value.length>20|| regform.e_mail.value.length>30|| regform.address.value.length>50|| regform.phone.value.length>20){
alert("对不起，数据长度超出规定，请重新填写");
return false;
}
return true;
}

//检测是否输入了小类别名称
function check2(){
  if(addcateform.value==""){
		alert("请输入小类别名称！");		
		return false;
	}
	return true;
}

//检测产品输入的数据有效性
function check3(){
if(pro.product_cate_id.value=="0"){
alert("请选择小类别");
return false;
}
if(pro.product_name.value=="" || pro.product_price.value=="" || pro.product_amount.value=="" || pro.product_home.value=="" || pro.product_detail.value==""){
alert("所有必填内容不得为空");
return false;
}

if (pro.product_name.value.length>30 || pro.product_home.value.length>30){
alert("所填内容超过字符限制！");
return false;
}
return true;
}

function check4(){
  if(Admininfo.Adminname.value=="" || Admininfo.Adminpassword.value==""){
		alert("请输入管理员名和密码！");		
		return false;
	}
	return true;
}

function checkpic(){
  if(form.file1.value==""){
		alert("no picture");		
		return false;
	}
	return true;
}
//检验数据是否为大于0的数
function isfloat(s)
{
    var p=/^\d+(\.\d+)?$/
    if (!p.test(s)){
			return false;
		}
    return true;
}
function isint(s)
{
    var p=/^\d+$/g;
    if (!p.test(s)){
			return false;
		}
    return true;
}




//检测筛选表单是否选择了小类别
function check5(){
  if(selectform.product_cate_id.value=="0"){
		alert("请选择小类别！");		
		return false;
	}
	return true;
}