	var DOMPopup = function(obj){
		if(!obj || !obj['id']) return false;
		if(obj['unique'] && document.getElementById(obj['id'])) return false;
		this.obj = obj;
		this.init();
		this.create();
	};
	DOMPopup.prototype.init = function(){
		this.target = this.obj['target'] 
			? this.obj['target'] 
			: document.body ;
		this.id = this.obj['id'] 
			? this.obj['id'] 
			: 'DOMPopup' ;
		this.title = this.obj['title'] 
			? this.obj['title'] 
			: '&bsp;' ;
		this.size = this.obj['size'] 
			? this.obj['size'] 
			: {} ;
		this.size['width'] = this.obj['size'] && this.obj['size'][0] 
			? this.obj['size'][0] 
			: 0;
		this.size['height'] = this.obj['size'] && this.obj['size'][1] 
			? this.obj['size'][1] 
			: 0;
		this.marg = this.obj['margin'] 
			? this.obj['margin'] 
			: '' ;
		this.unique = this.obj['unique'] 
			? this.obj['unique'] 
			: false ;
		this.move = this.obj['move']
			? this.obj['move']
			: false ;
		this.resize = this.obj['resize']
			? this.obj['resize']
			: false ;
		this.savepos = this.obj['savePosition'] 
			? this.obj['savePosition'] 
			: false ;
		this.html = this.obj['html'] 
			? this.obj['html'] 
			: '' ;
		this.containerClass = this.obj['containerClass']
			? this.obj['containerClass']
			: '' ;
		this.captionClass = this.obj['captionClass']
			? this.obj['captionClass']
			: '' ;
		this.closeButtonClass = this.obj['closeButtonClass']
			? this.obj['closeButtonClass']
			: '' ;
		this.closeButtonHTML = this.obj['closeButtonHTML']
			? this.obj['closeButtonHTML']
			: 'x' ;
		this.bodyClass = this.obj['bodyClass']
			? this.obj['bodyClass']
			: '' ;
		this.onclose = this.obj['onClose'];
		this.ck = Cookie.readCookie('dompopup')
			? JSON.parse(Cookie.readCookie('dompopup'))
			: {};
		if(this.onOpen) this.onOpen();
		if(this.obj['autoStart']) this.add2autoload();
	};
	DOMPopup.prototype.add2autoload = function(){
		this.loader = Cookie.readCookie('DOMPopup_load')
			? JSON.parse(Cookie.readCookie('DOMPopup_load'))
			: {};
		this.loader[this.id] = { 'func' : this.obj['autoStart'] };
		Cookie.writeCookie('DOMPopup_load',JSON.stringify(this.loader, null, '\t'));
	};
	DOMPopup.prototype.remove2autoload = function(){
		delete this.loader[this.id];
		Cookie.writeCookie('DOMPopup_load',JSON.stringify(this.loader, null, '\t'));
	};
	DOMPopup.prototype.create = function(){
		
		var _this = this;
		var l = this.ck[this.id]
			? this.ck[this.id]['x']+'px'
			: '50%' ;
		var t = this.ck[this.id]
			? this.ck[this.id]['y']+'px'
			: '50%' ;
		var w = this.ck[this.id]
			? this.ck[this.id]['w']+'px'
			: this.size[0]+"px";
		var h = this.ck[this.id]
			? this.ck[this.id]['h']+'px'
			: this.size[1]+"px";
		var z = this.ck[this.id]
			? this.ck[this.id]['z']
			: '1000' ;
		this.container = new DOMElement('div',{
			'attribute' : {
				'id' : this.id,
				'class' : this.containerClass+' __DOMPopup'
			},
			'jsCss' : {
				'position' : 'fixed',
				'top' : t,
				'left' : l,
				'marginTop' : '-'+this.size.height/2+'px',
				'marginLeft' : '-'+this.size.width/2+'px',
				'zIndex' : z
			}
		});
		this.caption = new DOMElement('div',{
			'html' : this.title,
			'attribute' : {
				'class' : this.captionClass
			}
		});
		this.closeButton = new DOMElement('a',{
			'html' : this.closeButtonHTML,
			'attribute' : {
				'class' : this.closeButtonClass
			},
			'jsCss' : {
				'position' : 'absolute',
				'right' : '5px'
			}
		});
		this.body = new DOMElement('div',{
			'html' : this.html,
			'attribute' : {
				'class' : this.bodyClass
			},
			'jsCss' : {
				'width' : w,
				'height' : h
			}
		});
		this.closeButton.href = '';
		this.closeButton.onclick = function(){return false};
		this.closeButton.onmouseup = function(){ _this.close(); }
		this.caption.appendChild(this.closeButton);
		this.container.appendChild(this.caption);
		this.container.appendChild(this.body);
		this.target.appendChild(this.container);
		this.caption.movable({
			'container' : this.container,
			'zIndex' : 1000,
			'onComplete' : function(){
				_this.registerPos();
			}
		});
		if(this.resize) this.createResizer();
		if(this.savepos) this.registerPos();
	};
	DOMPopup.prototype.createResizer = function(){
		var _this = this;
		var c = new DOMElement('div',{
			'jsCss' : {
				'height' : '0px',
				'width' : '100%'
			}
		});
		var g = new DOMElement('div',{
			'html' : '-',
			'jsCss' : {
				'position' : 'absolute',
				'width' : '10px',
				'height' : '10px',
				'right' : '0',
				'bottom' : '0',
				'cursor' : 'se-resize',
				//'backgroundColor' : '#000'
				'border' : 'solid 1px',
				'backgroundImage' : 'url()' 
			}
		});
		g.resizable({
			'element':this.body,
			'distance' : 10,
			'onComplete' : function(){
				_this.registerPos();
			}
		});
		c.appendChild(g);
		this.container.appendChild(c);
	};
	DOMPopup.prototype.registerPos = function(){
		if(!this.id) return false;
		this.ck = Cookie.readCookie('dompopup')
			? JSON.parse(Cookie.readCookie('dompopup'))
			: {};
		this.ck[this.id] = {
				'x' : this.caption.getPosition().x+this.size.width/2,
				'y' : this.caption.getPosition().y+this.size.height/2,
				'w' : this.body.offsetWidth-(this.marg*2),
				'h' : this.body.offsetHeight-(this.marg*2),
				'z' : parseInt(this.container.style.zIndex)
		};
		Cookie.writeCookie('dompopup',JSON.stringify(this.ck, null, '\t'));
	};
	DOMPopup.prototype.close = function(){
		if(this.onclose) if(!this.onclose()){ return false; document.body.focus();}
		this.target.removeChild(this.container);
		aso.domExtended.frame.show();
		if(this.obj['autoStart']) this.remove2autoload();
		delete this.id;
	};