/**
* @version		0.0.1 16.05.2011 $
* @package		POP-UP Mootools
* @copyright	Copyright (C) 2011 - 2012 Open Source Matters. All rights reserved.
* @license		GNU/GPL
* project page  http://www.cleverscript.ru
* support       support@cleverscript.ru
* author        cleverscript
*/
function PopUp(obj,trig){
	var html = obj.get('html');
	obj.destroy();
	var body = $$('body')[0];
				
	var HTML="<div id='popup'><span id='cancel'></span>"+html+"</div></div>";
	
	var win = new Element('div', {id:'win', html:HTML});
	win.inject(body);
	
	function showWin(){	
		$('win').setStyles({display: 'block'});
		$('popup').setStyles({
			display:'block', 
			opacity:0, 
			top: window.getSize().y/2-$('popup').getSize().y/2+'px', 
			left: window.getSize().x/2-$('popup').getSize().x/2+'px'
		});
		$('popup').setStyle('opacity', 1);			
	}
		
	if($(trig)){
		$(trig).addEvent('click',function(){
			showWin();
		});
	}
		
	if($('cancel')){
		$('cancel').addEvent('click', function(){
			$('win').setStyle('display', 'none');
		});
	}
	
}