function NVIQuickModal(){
	/* 
	* This is a class constructor, not a function. You 
	* will have to use the 'new' operator.
	*/

	var _height = 0 ; 
	var _width = 0 ; 
	var _content ;
	var _overlay ;
	var _contentId ;
	var _overlayStyle = 'myNVIQuickModalOverlay' ; // Should create a method to overwrite this for each instance...
	var _contentStyle = 'myNVIQuickModalContent' ; // Should create a method to overwrite this for each instance...
	var _doc = document.all && document.compatMode == 'BackCompat' ? document.body : document.documentElement ;
	var _cachedSize = { width : 0 , height : 0 } ;
	
	this.setContentId = function( contentId ){
		if( typeof contentId == 'string' ) _contentId = contentId ;
	}
	
	this.registerDimension = function( width , height ){
		if( !isNaN( width ) ) _width = width ;
		if( !isNaN( height ) ) _height = height ;
	}
	
	function setStyle( target , property , value ){
		if( typeof target[ property ] != 'undefined' ){
			target[ property ] = value ;
		}else{
			if( typeof target.style[ property ] != 'undefined' ) target.style[ property ] = value ;
		}
	}
	
	function setDimension( target , width , height ){
		void setStyle( target , 'width' , width + "px" ) ;
		void setStyle( target , 'height' , height + "px" ) ;
	}

	function setPosition( target , x , y ){
		void setStyle( target , 'left' , x + "px" ) ;
		void setStyle( target , 'top' , y + "px" ) ;	
	}
	
	function bringToFront( target ){
		void setStyle( target , 'zIndex' , 999999 ) ;	
	}	
	
	function getBodySize(){
		return { 
			width : _doc.scrollWidth , 
			height : _doc.scrollHeight 
		} ;
	}
	function getWindowSize(){
		var result = null ;
		if( typeof window.innerWidth != 'undefined' && window.innerWidth != null ){
			result = { width : window.innerWidth , height:window.innerHeight } ;
		}else{
			result = { width : _doc.clientWidth , height : _doc.clientHeight } ;
		}
		return result ;
	}
	
	function createOverlay(){
		_overlay = document.createElement( 'div' ) ;
		_overlay.className = _overlayStyle ;
		document.body.appendChild( _overlay ) ;
	}
	
	function resizeToWindow(){
		void setDimension( _overlay , 1 , 1 ) ;
		var bProps = getBodySize() ;
		var wProps = getWindowSize() ;
		var width = bProps.width > wProps.width ? bProps.width : wProps.width ;		
		var height = bProps.height > wProps.height ? bProps.height : wProps.height ;
		void setDimension( _overlay , width , height ) ;
	}
	
	function centerContent(){
		var window_dimension = getWindowSize() ;		
		var scrollOffset = getScrollOffset() ;
		var x = 0 , y = 0 ;
		if( _width < window_dimension.width ){
			x = Math.floor( ( window_dimension.width / 2 ) - ( _width / 2 ) ) ;
			if( x < 0 ) x = 0 ;
			x = x + scrollOffset.x ;
		}
		if( _height < window_dimension.height ){
			y = Math.floor( ( window_dimension.height / 2 ) - ( _height / 2 ) ) ;
			if( y < 0 ) y = 0 ;
			y = y + scrollOffset.y ;
		}		
		void setPosition( _content , x , y ) ;
	}
	
	function getScrollOffset(){
		var isIE = document.all || false ;
		var doc = !isIE ? window : document.compatMode !='BackCompat' ? document.documentElement : document.body ;
		return { 
			x : doc[ isIE ? 'scrollLeft' : 'pageXOffset' ] , 
			y : doc[ isIE ? 'scrollTop' : 'pageYOffset' ] 
		} ;	
	}
	
	function addContent(){
		if( typeof _content == 'undefined' || _content == null ){
			try{
				_content = document.getElementById( _contentId ).cloneNode( true ) ;
				_content.id = '' ;
				document.body.appendChild( _content ) ;
			}catch( error ){}
		}
	}
	
	function removeNode( node ){
		try{
			node.removeNode( true ) ; 
		}catch( error ){
			try{ 
				node.parentNode.removeChild( node ) ; 
			}catch( error ){}
		}	
	}
	
	function addEventListener( target , eventName , callBack ){
		try{ target.attachEvent( 'on' + eventName , callBack ) ; }
		catch( error ){
			try{ target.addEventListener( eventName , callBack , false ) ; }catch( error ){}
		}
	}
	this.addEventListener = addEventListener ;

	function removeEventListener( target , eventName , callBack ){
		try{ target.detachEvent( 'on' + eventName , callBack ) ; }
		catch( error ){
			try{ target.removeEventListener( eventName , callBack , false ) ; }catch( error ){}
		}	
	}
	this.removeEventListener = removeEventListener ;
	
	this.open = function(){
		void createOverlay() ;
		void resizeToWindow() ;
		void setPosition( _overlay , 0 , 0 ) ;
		void addContent() ;
		void setDimension( _content , _width , _height ) ;		
		void setStyle( _content , 'display' , 'block' ) ;
		void centerContent() ;
		void bringToFront( _overlay ) ;
		void bringToFront( _content ) ;
		void addEventListener( window , 'scroll' , centerContent ) ;
		void addEventListener( window , 'resize' , centerContent ) ; 
		void addEventListener( window , 'resize' , resizeToWindow ) ; 
	}
	this.close = function(){
		void removeEventListener( window , 'scroll' , centerContent ) ;
		void removeEventListener( window , 'resize' , centerContent ) ; 
		void removeEventListener( window , 'resize' , resizeToWindow ) ; 
		void removeNode( _overlay ) ;
		void removeNode( _content ) ;
		_overlay = null ;
		_content = null ;
		_cachedSize = { width : 0 , height : 0 } ;
	}				
}
