<!--
  //function login(){                
	//		User.login('visitor','123',0,0,function(loginUser){					   
	//			});			
//}
  function replace(strText,findText,replaceText){
      var pos=0;
      var len=findText.length;
      pos=strText.indexOf(findText);
      while(pos!=-1){
         lString=strText.substring(0,pos);
         rString=strText.substring(pos+len,strText.length)
         strText=lString+replaceText+rString;
         pos=strText.indexOf(findText);
      }
      return strText;
 }
 function trim(strText){
      var len=strText.length;
      
      var a=strText.substring(0,1).charCodeAt(0);
      while(a==32){
          strText=strText.substring(1,len);
          a=strText.substring(0,1).charCodeAt(0);
      }

      len=strText.length;
      
      a=strText.substring(len-1,len).charCodeAt(0);
      while(a==32){
           strText=strText.substring(0,strText.length-1);
           a=strText.substring(strText.length-1,strText.length).charCodeAt(0);
      }
      return strText;
 }
 function NumberInput(lx,o,e){//????????
	sValue=o.value;
   if(isNaN(sValue)){e.keyCode=0;o.value="";return false;}
	switch(lx)
	{case 0: //????/??????/??????
		  if(e.keyCode==46){if(sValue.indexOf(".")!=-1){e.keyCode=0;return false;}}
		  else if(e.keyCode==45){if(sValue.indexOf("-")!=-1){e.keyCode=0;return false;}}
		  if((e.keyCode<48||e.keyCode>57) && e.keyCode!=8 && e.keyCode!=46 && e.keyCode!=45){e.keyCode=0;return false;}

	 case 1:   //????
	      if(e.keyCode==45){if(sValue.indexOf("-")!=-1||trim(sValue).length>0){e.keyCode=0;return false;}}
	      if((e.keyCode<48||e.keyCode>57) && e.keyCode!=8 && e.keyCode!=45){e.keyCode=0;return false; } break;
	 case 2:   //????????/????????
	      if(e.keyCode==46){if(sValue.indexOf(".")!=-1){e.keyCode=0;return false;}}
		  if((e.keyCode<48||e.keyCode>57) && e.keyCode!=8 && e.keyCode!=46){e.keyCode=0;return false;}break;}
 }
 function EnterBlank(e,str)
 {
     if(trim(e.value)==""){
       alert(str+"??????????????????")
       e.focus();
       if(e.type=='text'){
          e.select();
       }
       return false;
     }
     return true;
 }
 
function EnterTab(T,F,N){     //T ->this F->this.name N-> next.name
        var N1;
        if(T.type=="radio"){
           N1=replace(T.id,F,N);
        }else{
           N1=replace(T.name,F,N);
        }
        var N2=document.getElementById(N1)
        if(event.keyCode==13){
            if(N2!=null){
               N2.focus();
               if(N2.type=='text' || N2.type=='password')  N2.select();
            }
        }
}
 function	winshow(url,page,title){
       var width=0;
       var height=0;
      
       var  showx =167;
       var  showy =125;
       
       
       //if(page=='clerk1'){width=screen.availWidth;height=screen.availHeight;}
       if(page=='newContent')  {width=450;height=400;}
       if(page=='newRegister')  {width=450;height=200;}
       if(page=='newSort')  {width=450;height=240;}
       if(page=='linkField')  {width=420;height=300;}
       if(page=='Content')  {width=screen.availWidth-10-showx;height=screen.availHeight-30-showy;}
       else if(page=='clerk')  {width=550;height=400;}
       
       
       var r=window.showModalDialog("../sys/show.jsp?url="+url,[self,title==undefined?"":title],"dialogLeft:"+showx+";dialogTop:"+showy+";dialogWidth:"+width+"px;dialogHeight:"+height+"px; status:no;help:no");
      
   }

   function winopen(url){
       showW =screen.availWidth-11;
    	 showH =screen.availHeight-80;
        var w=window.open(url,"aa","status=yes,menubar=yes,toolbar=yes,resizable=yes,left=0,top=0,width="+showW+",height="+showH);

   }
function formatText(o)
{
  numVal=o.value;
  numVal=numVal+"";
  while(numVal.indexOf(",")>-1)
    numVal=numVal.replace(",","");
  if(numVal.indexOf(".")>-1)
  {
    o.value = formatNum(numVal.substring(0,numVal.indexOf(".")))+numVal.substring(numVal.indexOf("."),numVal.length)
  }
  else
    o.value = formatNum(numVal);
}

/*
 *?????????????????)
 *@param numVal
 */
function formatNum(numVal){
	var indexs = numVal.length - 3;
	//alert(numVal);
	if(indexs>0){
		if(indexs-3>0){
			return	formatNum(numVal.substring(0,indexs)) + "," + numVal.substr(indexs,3);
		}else{
			return numVal.substring(0,indexs) + "," + numVal.substr(indexs,3);
		}
	}else{
		return numVal;
	}
}
function onfocusNum(o){
	
	numVal=o.value;
	while(numVal.indexOf(",")>-1)
     numVal=numVal.replace(",","");
   o.value=numVal;
}
function winopen(url,page,x){
       var width=0;
       var height=0;
       if(page=='big')  {  if(x!="v"){width=750;height=500;}else{width=500;height=700;}}
       else if(page=='middle')  {if(x!="v"){width=500;height=350;}else{width=350;height=500;}}
       else if(page=='small')  {if(x!="v"){width=400;height=250;}else{width=250;height=400;}}
       else if(page=='tiny')  {if(x!="v"){width=200;height=150;}else{width=200;height=150;}}
       showx =(screen.availWidth-width)/2;
       showy =(screen.availHeight-10-height)/2;
       var r=window.open(url,"","height="+height+",width="+width+",top="+showy+",left="+showx+",status=yes,toolbar=no,menubar=no,location=no");
   }
   //????????
function onTr(i){
  var oSource = window.event.srcElement;
  if(oSource.tagName=='INPUT')
    return;
  var obj=document.getElementById('id'+i);
  
  if(obj.checked)
    obj.checked=false;
  else
    obj.checked=true;
}
function createElement(tagName,text1,value1){
	var e1=document.createElement(tagName);
	
	e1.text=trim(text1);	
	e1.value=trim(value1);
	return e1;
}
function removeAllOpt(sele){	
	while(sele.options.length>0){
		var el=sele.children(0);
		sele.removeChild(el);
	}
}
function onOver(o,v){
   o.style.background=v;
 
}
function onOut(o,v){
   o.style.background=v;
 
}

 
//-->

