
function createRegularPopin(container, width)
{
	if(width == undefined || width == "")
		width = "400";
  
	container.setStyle('display','');
	container.setStyle('width', width+'px');
	container.addClass('regular-popin');
	
	var containerclose = $(container.id + '-close');
	
	var closeevent = function(e) {
		e.stop();
		DisposeRegularPopin(container);
		}
		
	containerclose.removeEvent("click", closeevent);
			
	containerclose.addEvent("click", closeevent);
	
	rePositionRegularPopin(container);
}

function DisposeRegularPopin(container)
{
    if (container)
    {
	    container.setStyle('display','none');
	    var wrapper = $(container.id + '-wrapper');
		if(wrapper)
	        wrapper.setStyle('display','none');
	}
}

function rePositionRegularPopin(container) {
		
	if (container)
	{
		container.setStyle("left", window.getSize().x/2 - container.getStyle("width").toInt()/2);
	
        var wrapper = $(container.id + '-wrapper');
	    if(wrapper)
	    {
	        wrapper.addClass('regular-popin-wrapper');
	        wrapper.setStyle('display','');
	        wrapper.setStyle("height", window.getScrollSize().y.toInt());
	    }
	}
}