
///////AutoScroll Functions
	var currentpos, timer;
	function initialize(){ //initialize the timer
	if(event.srcElement.tagName=='INPUT' || event.srcElement.tagName=='TEXTAREA' || window.name!='main')return false;
	 timer = setInterval("scrollwindow()", 1);
	}
	function sc(){
	 clearInterval(timer);
	}
	function scrollwindow(){ //auto scroll the window

	}

	function enabledmouse()
	{
	self.event.returnValue=true
	}	
	function  hiderightmouse()//filter ContextMenu
	{
		event.returnValue=false
	}
	
	function  disableselect()//filter SelectAction
	{
		if(event.srcElement.tagName!='INPUT' && event.srcElement.tagName!='TEXTAREA'  ) event.returnValue=false  
	}
	document.onmousedown = sc;
	
	document.ondblclick = initialize;
	
	window.onresize=MM_changeProp;
	window.onscroll=MM_changeProp;
	
	window.onerror = killErrors;	
	
	
	
//////////////////////////////////////
	function killErrors() 
	{
	return true;
	}
	
	
	function checkkey()//filter un-number input
	{	//var c=event.keyCode
		//if((c>=0x30) && (c<=0x39) || (c==8) || (c==46) || (c==37) || (c==39)  || (c==189)  || (c==190)  ) 
			event.returnValue=true;
		//else 
		//	event.returnValue=false;
	
	};

	function gonext(obj)//check enter and focus next object
	{
		if(event.keyCode==13) document.all(obj).focus();
	};

	function disable(obj,flag)//hide or show an object
	{
		if(flag)
		{
			obj.style.visibility=''; 
		}
		else 
		{
			obj.style.visibility='hidden'; 
		}
	
	};

	function readonly(obj,flag)//set Readonly or un-Readonly to an object
	{	if(flag)
		{
			obj.readOnly=false;
		}
		else 
		{
			obj.readOnly=true; 
		}
	
	};
	function disabled(obj,flag)//Disabled or Enabled An Object
	{	if(flag)
		{
			obj.disabled=false;
		}
		else 
		{
			obj.disabled=true; 
		}
	
	};
	
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0,Form Checked,modify from Dreamweaver4.0
  var i,p,q,nm,test,num,min,max,objfocus='',errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) {nm="□ 〖"+val.id+"〗"; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+=nm+' 必须是有效的E-mail地址.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+=nm+' 必须是数字.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=parseInt(test.substring(8,p)); max=parseInt(test.substring(p+1));
          if (val<parseInt(min) || max<parseInt(val)) errors+=nm+' 必须是从 '+min+' 到 '+max+' 之间的数字.\n';
    } } } else if (test.charAt(0) == 'R') errors +=nm+' 是必须填写的项目.\n'; }
   /////////////////////////2002年8月7日更新，加入聚焦功能
    if(objfocus=='' && errors)
	{	objfocus=args[i];
		if(document.all(objfocus).type=='hidden')objfocus='Composition';
	}
  	//////////////////
  }
  
  if (errors) {
  alert( '在您的表格中发现以下问题:\n----------------------------------------------------------------------\n'+errors);
	//alert(objfocus);
   document.all[objfocus].focus();
   if( objfocus=="Composition") Composition.focus();
 }
  document.MM_returnValue = (errors == '');
  return (errors == '');
}	

/////////////Filter HTML Code
function rphtml() {
  var args=rphtml.arguments;
  for (i=0; i<(args.length); i++) 
  { val=MM_findObj(args[i]);
  	var re=/</g
  	val.value=val.value.toString().replace(re,'&lt;')
	re=/>/g
  	val.value=val.value.toString().replace(re,'&gt;');
  }

}

/////////Opreate Event onMouseOver
	function ov(a)
	{
		a.bgColor=hotcolor;
	}

/////////Opreate Event onMouseOut
	function mo(a)
	{
		a.bgColor=vcolcolor;
	}
	
	
	
/////////Print the document
	function doprint(){
	//WebBrowser1.ExecWB(6,1);
	window.print();
	}
	
/////////Relocate the background-image
	function MM_changeProp() 
	{
		if(typeof(bg)=="object")
		{
		
		document.all.bg.style.left=document.body.clientWidth-375+document.body.scrollLeft
		document.all.bg.style.top=document.body.clientHeight-300+document.body.scrollTop
		}
		//if(document.body.scrollLeft>0 ) document.all.bg.style.left=document.body.clientWidth-390+document.body.scrollLeft
		//if(document.body.scrollTop>0 ) document.all.bg.style.top=document.body.clientHeight-315+document.body.scrollTop
	}



function setvalue(ifrom,ito)
{
document.all(ito).value=document.all(ifrom).value

}

function IEVer()
{
var str=navigator.appVersion
var loca=str.indexOf('MSIE') +5
return parseInt(str.substr(loca))

}