﻿
var xm = -0.50;
var nx = 0;


var ss = {
	dx  : 0, // Delta x (aka offset)
	b0  : 0, // First <span>
	b1  : 0, // Second <span>
	NH  : 0, // <span>'s height
	
	slide : function ()
	{
		ss.dx += xm;
		//document.title = ss.dx;
		if(ss.dx > 0) ss.dx -= ss.NH; else if(ss.dx < -ss.NH) ss.dx += ss.NH;

		ss.b0.style.top = px(ss.dx);
		ss.b1.style.top = px(ss.dx + ss.NH);
		setTimeout(ss.slide, 16);
	},
	
	init : function (obj) // Setting the <a>s and she <span>'s size
	{
		/*var a = obj.getElementsByTagName("div");
		for(var i = 0; i < a.length; i++)
		{
			var o = a[i];
			alert(a[i].offsetHeight);
			newHeight+=a[i].offsetHeight;
			//o.style.top = px(i * o.offsetHeight);
		}*/
		//obj.style.width = "100px";//px(a[0].offsetWidth);
		//obj.style.height = "200px";//px(a[0].offsetHeight * a.length);
		//obj.style.top = px(0);
	},
	
	load : function ()
	{
	    ss.b0 = id("b0")
	    ss.b1 = id("b1")
	    ss.init(ss.b0);
	    ss.b0.style.top = px(0);
	    // Duplicating the <span>
	    ss.b1.innerHTML = ss.b0.innerHTML;
	    //ss.b1.style.width = ss.b0.style.width;
	    //ss.b1.style.height = px(ss.b0.offsetHeight);
	    ss.b1.style.top = px(ss.b1.offsetHeight);
	    
	    id("slideShow").onmouseout = mouseout;
	    id("slideShow").onmouseover = mouseover;
        //NH = id("slideShow").offsetHeight;
        ss.NH = ss.b0.offsetHeight;
        ss.slide();
	}
}

function mouseover(e)
{
    xm = 0;
}

function mouseout(e)
{
    xm = -0.50;
}



id = function(o)
{
	return document.getElementById(o);
}

px = function (x)
{
	return ''.concat(Math.round(x), 'px');
}
