/**
 * @author mryan
 * 
 * This code is used to create the "DHTML Slider" popup on RxPop.com
 * 
 * It reveals a hidden div layer which animates across the screen using the interval function.
 * 
 * 
 */

var foo = document.getElementById('dhtmlslider'); // object

var windowwidth;
var sliderwidth;
var moveto;

function doMove() {
	if (parseInt(foo.style.left) >= parseInt(moveto))
	{		
				
	} 
	else
	{
		//alert(moveto);
		foo.style.left = parseInt(foo.style.left)+10+'px';
		//alert(foo.style.left);
		setTimeout(doMove,20); // call doMove in 20msec		
	}
  	
}

function init() {
	//alert(window.innerWidth);
	//alert(document.body.offsetWidth);	
  foo = document.getElementById('dhtmlslider1'); // get the "foo" object
  
  windowwidth = document.body.offsetWidth;
  sliderwidth = foo.style.width;
  
  //alert(windowwidth);
  //alert(sliderwidth);
  
  moveto = (parseInt(windowwidth)/2) - (parseInt(sliderwidth)/2);
  
  //alert(parseInt(moveto));
  
  foo.style.left = '-450px'; // set its initial position to 0px
  doMove(); // start animating
}
function closeModal(div)
{
	document.getElementById(div).style.display = 'none';
};

window.onload = init;
