// JavaScript Document
//<![CDATA[ 
function parseShow(elementoID)
{
    var elemento=$(elementoID);
    if(elemento!=null)
    {       
        // creo il div di sfondo che rendo opaco
		var sfondo = new Element('div').setProperty('id', 'lbOverlayRegalo').injectInside(document.body);
		sfondo.setStyles({
			'opacity': 0.85,
			'height': window.getScrollHeight()
		});

		//prendo il div spotRegalo
		var section = $('spotRegalo'); // prendo il div
		section.setStyle('top', window.getScrollTop()+50);
		
		var fx = new Fx.Styles(section, {duration: 500, transition: Fx.Transitions.Quart.easeOut, wait: false});
		fx.start({
			'right': Position(section)
			//'right': 600
		});
    }
}

function parseClose() {
    var section = $('spotRegalo'); // prendo il div
    var fx = new Fx.Styles(section, { duration: 500, transition: Fx.Transitions.Quart.easeOut, wait: false });
    fx.start({
        'right': -parseFloat(section.getStyle('width')) - 100
    }).chain(function() {
        $('lbOverlayRegalo').remove()
    })
    return false;
}

function Position(obj)
{
    var widthSection = parseFloat(obj.getStyle('width'));
	var positionSection = window.getWidth()/2 - widthSection/2;
	return positionSection;
}
