// function awa(){
//	//公有属性
//	this.a=1;
//	//私有属性
//	var aa=0;
//	
//	//公有方法
//	this.b=function(){
//		alert("ab");
//	}
//	//私有方法
//	var bb =function(){
//		alert("bb");
//	}
//}
////公有方法
//awa.prototype.a=1;
////公有方法
//awa.prototype.b=function(){
//	alert("ab");
//}

/**
 * 类
 */
function Aua(){};
/**
 * 方法 计算当前窗口的宽度
 * @return 返回当前窗口的宽度
 */
Aua.prototype.pageWidth =function()
{
	 return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
};
/**
 * 计算当前窗口的高度
 * @return 返回当前窗口的高度
 */
Aua.prototype.pageHeight = function()
{
	 return window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
};
/**
 * 计算当前窗口上边的滚动条
 * @return 返回当前窗口上边滚动条的位置
 */
Aua.prototype.topPositon=function()
{
	 return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
};
/**
 * 计算当前窗口左边的滚动条
 * @return 返回窗口左边滚动条的位置
 */
Aua.prototype.leftPositon = function()
{
	 return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
};
/**
 * 获得元素的样式属性
 * @param element 元素 
 * @param name 属性名称
 * @return 返回属性的值
 */
Aua.prototype.getStyle = function(element,name){
	if(element.style[name])
		return element.style[name];
	else if(element.currentStyle)	//ie
		return element.currentStyle[name];
	else if(document.defaultView && document.defaultView.getComputedStyle){	//w3c
		name = name.replace(/([A-Z])/g,"-$1");
		name = name.toLowerCase();
		var s = document.defaultView.getComputedStyle(element,"");
		return s && s.getPropertyValue(name);
	} else
		return null;
};
/**
 * 获得屏幕可用工作区宽度
 * @return 工作区的宽度
 */
Aua.prototype.availWidth= function()
{
	return window.screen.availWidth;
};

/**
 *获得屏幕可用工作区的高度
 * @return 工作区的高度 
 */
Aua.prototype.availHeight = function(){
	return window.screen.availHeight;
};
/**
 * 获得网页正文高度
 * @return 网页正文高度
 */
Aua.prototype.srcollHeight = function ()
{
	return document.body.scrollHeight;
};
/**
 * 获得网页正文宽度
 * @return 网页正文宽度
 */
Aua.prototype.srcollWidth = function()
{
	 return document.body.scrollWidth;
};

/**
 *  内部类
 * @return 返回一个遮盖层对象
 */
Aua.prototype.initBackgroudDiv = function()
{
	   this.backgroudDiv =  document.getElementById("backgroudDiv");
	 
		    if(this.backgroudDiv) 
		    document.body.removeChild(this.backgroudDiv);
		     var width = this.availWidth();

		     var height = this.availHeight();
	
			    if(this.availHeight()< this.srcollHeight())
			    {
			        height = this.srcollHeight();
			    }
			    if(this.availWidth() <this.srcollWidth())
			    {
			        width = this.srcollWidth();
			    }
			    this.backgroudDiv = document.createElement("div");
			    with(this.backgroudDiv)
			    {
			     setAttribute('id', 'backgroudDiv');
		      	 style.position = "absolute";
			     style.zIndex = "1000";
			     style.left = "0px";
			     style.display = "none";
			     style.top = "0px";
			     style.width = width+"px";
			     style.height = height+"px";
			     style.padding="0px";
			     style.margin="0px";
			     style.background = "#777";
			     style.filter = "alpha(opacity=30)";
			     style.opacity = "0.3";
			    }
		     this.iframe=document.createElement("iframe");
		        with(this.iframe)
		        {
		        	frameBoder="no";
		        	style.padding=this.backgroudDiv.style.padding;
		        	style.margin=this.backgroudDiv.style.margin;
		        	style.top=this.backgroudDiv.style.top;
		        	style.left=this.backgroudDiv.style.left;
		        	style.background = "transparent";
		        	style.allowTransparency="true";
		        	style.position = "absolute";
		        	style.display = "block";
		         	style.filter = this.backgroudDiv.style.filter;
		        	style.opacity = this.backgroudDiv.style.opacity;
		        	style.width= this.backgroudDiv.style.width;
		        	style.zIndex =this.backgroudDiv.style.zIndex - 1;
		        	style.height=this.backgroudDiv.style.height;
		        }
		     document.body.appendChild(this.iframe);
		    
		     document.body.appendChild(this.backgroudDiv);  
	    };    
Aua.prototype.showBackgroudDiv = function()
 {
	if(this.backgroudDiv)
		    this.backgroudDiv.style.display="block";
};
Aua.prototype.hideBackgroudDiv = function(){
	    	if(this.backgroudDiv)
	    	     this.backgroudDiv.style.display="none";
};
 Aua.prototype.destoryBackgroudDiv= function(){
	if(this.backgroudDiv)
	{
		document.body.removeChild(this.backgroudDiv);
		delete this.backgroudDiv;
	}
	if(this.iframe)
	{
		document.body.removeChild(this.iframe);
		delete this.iframe;
	}
};



/**
 * 前景div的类
 * @param id 要打开DIV有id
 * @return 控制前段DIV的对象
 */
Aua.prototype.showFrontDiv = function(id){
    this.front = document.getElementById(id);
	this.initBackgroudDiv();
	this.showBackgroudDiv();
	 var front_w = $("#"+id).width();
	 var front_h =$("#"+id).height();
		
	 var width = this.pageWidth();
	
	 var height = this.pageHeight();
	 var left = this.leftPositon();
	 var top = this.topPositon();
	 this.front.style.top =  top + (height / 2) - (front_h / 2)+"px";  //计算上边距
	 this.front.style.left =  left + (width / 2) - (front_w / 2)+"px"; //计算左边距
	 this.front.style.zIndex=1001;
	 this.front.style.position="absolute";
	 this.front.style.display = "block";  //设置弹出div显示
 };
 Aua.prototype.moveFrontDiv = function(moveTitle,moveBody)
 {
	   if(document.getElementById(moveTitle)&&document.getElementById(moveBody)){
			Drag.init(document.getElementById(moveTitle), document.getElementById(moveBody));
		}
	 
 };
 
 Aua.prototype.scrollFrontDiv = function()
 {
//	 if(this.front)
//	 {
//		 var front_h = $("#"+this.front.id).height();
//		 var front_w =  $("#"+this.front.id).width();
//		 var width = this.pageWidth();
//		 var height = this.pageHeight();
//		 var left = this.leftPositon();
//		 var top = this.topPositon();
//		 this.front.style.top =  top + (height / 2) - (front_h / 2)+"px";  //计算上边距
//		 this.front.style.left =  left + (width / 2) - (front_w / 2)+"px"; //计算左边距
//	 }
 };
 Aua.prototype.hideFrontDiv = function()
 {

    if(this.front)
    {
		this.front.style.display = "none";  //设置弹出div显示
		this.hideBackgroudDiv();
		this.destoryBackgroudDiv();
		delete this.front;
    }
 };
 
 var aua = new Aua();





