function checksub(objchk,key,check){
	if (objchk==null) return false;
	var i
	//select parent node then select all child node
    if (objchk.length==null){
		if(objchk.id.indexOf(key)==0){
			objchk.checked=check;
		}
	}	
    else{
		for(i=0; i<objchk.length; i++){
			if(objchk[i].id.indexOf(key)==0) {
				objchk[i].checked=check;
			}
		}
	}
	//if child is checked,then his parent must be also checked
    if (objchk.length!=null&&check){
		for(i=0; i<objchk.length; i++){
			if(key.indexOf(objchk[i].id)==0) {
				objchk[i].checked=check;
			}
		}
	}	
}	

function ShowDate(){
   var d, s ="";           // 声明变量。
   d = new Date();                           // 创建 Date 对象。
   s += d.getYear() + "-";  ;                // 获取年份。
   s += (d.getMonth() + 1) + "-";            // 获取月份。
   s += d.getDate() + " ";                   // 获取日。
   s += d.getHours()+":";   
      //获得分   
   s += d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes()+":"; ;   
   s += d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds();   

   return(s);                                // 返回日期。
}

function hidMenu() { 
//alert(parent.document.all("frmTitle"));
parent.document.all("LeftMenu").style.display=""
}

//全选
function checkall(objchk,check) {
	if (objchk==null) return false;
	var i;
    if (objchk.length>1)
	for(i=0; i<objchk.length; i++)
		{objchk[i].checked=check;}
    else
		objchk.checked=check;
}
//按钮提交
function openUrl(formname,url,status)
{
     eval(formname).target=status;
	 eval(formname).action=url;
	 eval(formname).submit(); 	
}
//层显示
function OnClickDiv(DivId)
     {
      if(document.all[DivId].style.display=='none')
        {document.all[DivId].style.display='';} 
      else
        {document.all[DivId].style.display='none';}
      return 0;
    }

function OnClickall(DivId)
{
 for (i = 0; i <=9; i++) {
   DivId1='D'+i;
   if (typeof(document.all[DivId1])=='object'){
   if(document.all[DivId1].style.display=='none')
    {document.all[DivId1].style.display='';} 
   else
    {document.all[DivId1].style.display='none';
    }
  }  
 }
return 0;
}

function openUrl(formname,url,status)
{
     eval(formname).target=status;
	 eval(formname).action=url;
	 eval(formname).submit(); 	
}

//层数据交换
function DivData(sUrl,divid)
	{
	var objAjax = new Ajax();
	objAjax.get(
				sUrl,
				function(sText){
					document.getElementById(divid).innerHTML = sText
					//alert(divid);
					objAjax = null;
				},
				"",
				"text"
				);
	}

//验证是否存在数据
function ReturnData(sUrl)
	{
	var objAjax = new Ajax();
	objAjax.tbget(
				sUrl,
				//alert(sUrl);
				function(sText){
						proessValue=sText;
						objAjax = null;
				},
				"",
				"text"
				);
				return this.proessValue;
	}

//session失效跳转Login.Asp
function checkParent(url){     
	if(window.parent.length>0){
		window.parent.location=url;
	}
}  

 function chkUserName(str,minN,maxN){
	if (checkLen(str,minN,maxN))
	{
		if(/^[a-zA-Z0-9]*$/g.test(str)){   
			//alert(11111);
 	 	return true;
 		}
		return false;
	}
 	 return false;
 }


//空值
 function checkNull(val){
	if (val=="")
	{
		return false;
	}else{
		return true;
	}
 }
//

function faceinsert(iNumber){
	document.GuestBook.elements['Content'].value += "[FACE="+iNumber+"]"
}
//字符串长度
function checkLen(st,minstr,maxstr){
	sl1=st.length;
	strLen=0;
	for(i=0;i<sl1;i++){
		if(st.charCodeAt(i)>255) strLen+=2;
	 else strLen++;
	}
	if (strLen=='' || strLen<minstr|| strLen>maxstr){return false;}
	else {return true;}
}

function checkMail(str){
	if (str==''|| !str.match(/^[\w\.\-]+@([\w\-]+\.)+[a-z]{2,4}$/ig)){return false;}
	else{return true;}
}


     




