﻿//创建请求对象 
function getHTTPObject(){ 
     var xmlhttp = false; 
     if(window.XMLHttpRequest){ 
       xmlhttp = new XMLHttpRequest(); 
       if(xmlhttp.overrideMimeType){ 
         xmlhttp.overrideMimeType('text/xml'); } 
     }else{ 
       try{ 
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
       }catch(e){ 
         try{ 
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
           }
           catch(E){ xmlhttp = false; } 
            } 
     } 
     return xmlhttp; 
} 
//鼠标类
function Mouse()
{
    this.norightclick = norightclick;
    return this;
}
//键盘类
function Key()
{
    this.enterToTab = enterToTab;
    return this;
}
//窗体类
function Windows()
{
    this.openFullScreenWin = openFullScreenWin;
    this.openCenterWin = openCenterWin;
    this.openPositionWin = openPositionWin;
    this.openModalDialog = openModalDialog;
    this.openModelessDialog = openModelessDialog;
    return this;    
}
//对象
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//函数

//获取界面元素
function $(o)
{
    return document.getElementById(o);
}
//屏蔽右键弹出菜单
function nocontextmenu() 
{
	event.cancelBubble = true
	event.returnValue = false;
	return false;
}
//获取页内独立桢句柄
function IFrame(frameId){
    return window.parent.document.frames(frameId);
}

//函数
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//对象方法定义

//--------------------------------
//鼠标类
function norightclick(e) 
{
	if (window.Event) 
	{
		if (e.which == 2 || e.which == 3)
		return false;
	}
	else
		if (event.button == 2 || event.button == 3)
		{
			event.cancelBubble = true
			event.returnValue = false;
			return false;
		}
}
//鼠标类
//--------------------------------

//--------------------------------
//键盘类
//回车键转成Tab <body onkeydown="enterToTab()">
function enterToTab()
	{
	//alert(event.srcElement.type);
	//alert(event.KeyCode);		
	if(event.keyCode == 13) 
	if(event.srcElement.type =="text"||event.srcElement.type =="select-one"||event.srcElement.type =="check"||event.srcElement.type =="passwork")
		        event.keyCode = 9;
	}
//键盘类
//--------------------------------

//--------------------------------
//窗体类
//打开子窗口全屏显示window.open()
function openFullScreenWin(url)
{	
	var _width = window.screen.availWidth;
	var _height = window.screen.availHeight-30;
		childWin = window.open(url,"childWin","toolbar=no,directories=no,status=no,location=no,resizable=no,scrollbars=no,menubar=no,top=0px,left=0px,width="+_width+"px,height="+_height+"px");
}

//打开子窗口大小自定义、居中显示window.open()
function openCenterWin(url,width,height)
	{
	var _left = window.screen.availWidth/2-width/2;
	var _top = window.screen.availHeight/2-height/2-30;	
		childWin = window.open(url,"childWin","toolbar=no,directories=no,status=no,location=no,resizable=no,scrollbars=no,menubar=no,left="+_left+"px,top="+_top+"px,width="+width+"px,height="+height+"px");
	}

//打开子窗口大小自定义、鼠标位置显示window.open()
function openPositionWin(url,width,height)
	{
		var _left = event.screenX;		
		if((_left+width)>window.screen.availWidth)
			_left=window.screen.availWidth-width;			
		var _top = event.screenY;
		if((_top+height)>(window.screen.availHeight-30))
			_top=window.screen.availHeight-30-height;
		childWin = window.open(url,"childWin","toolbar=no,directories=no,status=no,location=no,resizable=no,scrollbars=no,menubar=no,left="+_left+"px,top="+_top+"px,width="+width+"px,height="+height+"px");
	}

function openModalDialog(url,width,height){
		childWin = window.showModalDialog(url,window,"dialogWidth="+width+"px;dialogHeight="+height+"px;center=yes;scroll=no;help=no;status=no");
		//子窗口使用dialogArguments直接访问父窗口的参数
		//父窗口使用childWin 设置子窗口的参数
		//子窗口要设置//<///
		//base target=//_self>
	}

function openModelessDialog(url,width,height)
{
		childWin = window.showModelessDialog(url,window,"dialogWidth="+width+"px;dialogHeight="+height+"px;center=yes;scroll=no;help=no;status=no");
		//子窗口使用dialogArguments直接访问父窗口的参数
		//父窗口使用childWin 设置子窗口的参数
		//子窗口要设置<base 
		//target=//_self>
}
//空格处理
function lTrim(s)
{
    return s.replace(/^\s*/,'');
}        
function rTrim(s)
{
    return s.replace(/\s*$/,'');
}        
function trim(s)
{
    return rTrim(lTrim(s));
}
//获取元素Y轴绝对坐标()
function $y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
} 
//获取元素X轴绝对坐标 
function $x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}
//对象方法定义
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
