// Deploy the Slider

// The Slider should be located in an element of id 'slider' and should be hidden
// out of view

var slider;

function deployslider()
// initializing
{
	slider= document.getElementById('slider');
	
	sliderheight = 79; // total height of slider in pixels
	slideroverlap = 21; // height of the 'overlap' portion only (semi-transparent)
	slidertimeout = setTimeout(startslider, 2000);
}

function startslider()
// starts the slider sliding up
{
	sliderposition = 0; // slider position is expressed in percentage points (out of 100)
	slidertimeout = setInterval(positionslider, 25);
}

function positionslider()
{
	sliderposition += 10;
	slider.style.marginBottom = '-' + (((100 - sliderposition) / 100) * sliderheight) + 'px';
	if (sliderposition >= 100)
	{
		clearTimeout(slidertimeout);
		slidertimeout = setTimeout(finishslider, 1);
	}
}

function finishslider()
{
	slider.style.marginBottom = '0';	
	// jump the bottom of the document to give room for the slider when scrolled right down
	document.body.parentNode.style.paddingBottom = (sliderheight - slideroverlap) +'px';
	
	// here you could use AJAX (or similar) to log the popup hit for tracking purposes	
}

addLoadEvent(deployslider);
