function popbox(el_id) {
	this.myPopbox = document.getElementById(el_id);
	this.windowWidth = 1024;
	this.windowHeight = 768;	
	
	this.getWindowSize = function()
	{
		if( typeof( window.innerWidth ) == 'number' ) {
			this.windowWidth = window.innerWidth;
			this.windowHeight = window.innerHeight;
		}
		else {
		    this.windowWidth = document.documentElement.clientWidth;
		    this.windowHeight = document.documentElement.clientHeight;
		}
	}
	
	function f_scrollTop() {
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}		

	this.centerPopbox = function() {
		this.getWindowSize();
		var x = (this.windowWidth - this.width)/2;
		var y = ((this.windowHeight - this.height)/2) + f_scrollTop();
		this.myPopbox.style.left = x + "px";
		this.myPopbox.style.top = y + "px";		
	}	
	
	this.closePopbox = function(args)
	{
		this.myPopbox.style.visibility = 'hidden';
		this.myPopbox.style.display = 'none';
				
		try {
			this.onCloseBox(args);
		} catch (e) {}
	}
	
	this.openPopboxUrl = function(url, outer_width, outer_height, width, height)
	{
		this.width = outer_width;
		this.height = outer_height;
		
		var pDiv = document.getElementById('popBoxper');
		pDiv.style.width = outer_width + "px";
		pDiv.style.height = outer_height+ "px";
		
		var f = document.getElementById('popFrame');
		f.style.width = width + "px";
		f.style.height = height+ "px";
						
		this.centerPopbox();				
		
		try {
			url = this.urlFunc();
		} catch (e) {}		
		
		f.src = url;
		
		this.myPopbox.style.display = 'block';
		this.myPopbox.style.visibility = 'visible';			
	}

	return this;
}