var RotationSpeed = 10000;
var len = 4;


String.prototype.cl_lTrim=function()
{
    return this.replace(/^(\s|\xA0|&nbsp;)*/,"");
};
String.prototype.cl_rTrim=function()
{
    return this.replace(/(\s|\xA0|&nbsp;)*$/,"");
};
String.prototype.cl_Trim=function()
{
    return this.cl_rTrim().cl_lTrim();
};

function GetPosition(el)
{
	var l=el.offsetLeft,t=el.offsetTop;
	while ((el = el.offsetParent) != null)
	{
		l+=el.offsetLeft;
		t+=el.offsetTop;
	}
	return [l,t]
};

var Container, ContainerPosition;

var c = len,n=1;

var O = 0;

var CurrentlyFlipping = false;
var RequireSwitching = false;

function InitRotation()
{
	Container = document.getElementById("RotatorContainer");
	ContainerPosition = GetPosition(Container);
	for(var i = 1; i <= len; i++)
	{
		with (document.getElementById("RotText"+i))
		{
			style.left = ContainerPosition[0];
			style.top = ContainerPosition[1];
			className = "Rotator" + (i>1?" op0":"");
		}
	}
	
	window.setTimeout(SwitchTesti, RotationSpeed);
}


function FlipTesti()
{
	if(O == 11)
	{
		O = 1;
		CurrentlyFlipping = false;
		if(RequireSwitching)
			SwitchTesti();
		return;
	}
	CurrentlyFlipping = true;
	document.getElementById("RotText"+c).className = "Rotator op" + (10 - O);
	document.getElementById("RotText"+n).className = "Rotator op" + O;
	O++;
	window.setTimeout(FlipTesti, 100);
}
function SwitchTesti()
{
	if(CurrentlyFlipping)
	{
		RequireSwitching = true;
		return;
	}
	c++;
	n++;
	if(c == len + 1)
		c = 1;
	if(n == len + 1)
		n = 1;
		
	FlipTesti();
	
	
	window.setTimeout(SwitchTesti, RotationSpeed);
}

document.body.onload = new Function(document.body.onload+";InitRotation();try{anonymous()}catch(e){}");
//www.pl4e.com
