var currentTOP = 0;
var lastTOP = 0;
var numTOP = 0;
var TitleArrTOP = new Array(); TitleArrTOP[0] = "";	
var TextArrTOP = new Array(); TextArrTOP[0] = "";	
var ImageArrTOP = new Array(); ImageArrTOP[0] = "";	
var RandomArrTOP = new Array(); RandomArrTOP[0] = "";
var LeftRight = "right";

function addTOPitem(yTitle,yText,yImage)
{
  if(yImage!="") ImageArrTOP[numTOP] = yImage;
 	else ImageArrTOP[numTOP] = "none.gif";

  if(yTitle!="") TitleArrTOP[numTOP] = yTitle;
 	else TitleArrTOP[numTOP] = "No Title";

  if(yText!="") TextArrTOP[numTOP] = yText;
 	else TextArrTOP[numTOP] = "No Text";
	
	RandomArrTOP[numTOP] = "free";
	
	numTOP++;
}

function updateChangeTOPitem() 
{
	var DoneStatus = "done";
	var ImageTOPhtml = "";
	var TitleTOPhtml = "";
	var TextTOPhtml = "";
	
	var i = 0;
	for (i = 0; i < numTOP; i++)
			if (RandomArrTOP[i] == "free") DoneStatus = "free";
			
  var j = 0;
	if (DoneStatus == "done") {
		for (j = 0; j < numTOP; j++)
      RandomArrTOP[j] = "free";
	}
	
	do {
    currentTOP = Math.floor((Math.random() * numTOP));
  } while ((currentTOP == lastTOP) || (RandomArrTOP[currentTOP] == "done"));

  RandomArrTOP[currentTOP] = "done";
	
	if (LeftRight == "right") {
		ImageTOPhtml = "<img src=\"images/changer/" + ImageArrTOP[currentTOP] + "\" width=\"230\" height=\"100\" align=\"left\" style=\"margin:0px 15px 0px 0px\"\" />";
		TitleTOPhtml = "<h3 style=\"margin:12px 6px 0px 0px;\">" + TitleArrTOP[currentTOP] + "</h3>";
		TextTOPhtml = "<p style=\"margin:0px 6px 0px 0px;\">" + TextArrTOP[currentTOP] + "</p>";
		LeftRight = "left";
	}
	else {
		ImageTOPhtml = "<img src=\"images/changer/" + ImageArrTOP[currentTOP] + "\" width=\"230\" height=\"100\" align=\"right\" style=\"margin:0px 0px 0px 15px\"\" />";
		TitleTOPhtml = "<h3 style=\"margin:12px 0px 0px 6px;\">" + TitleArrTOP[currentTOP] + "</h3>";
		TextTOPhtml = "<p style=\"margin:0px 0px 0px 6px;\">" + TextArrTOP[currentTOP] + "</p>";
		LeftRight = "right";
	}
		
	document.all.ChangerTOP.innerHTML = ImageTOPhtml + TitleTOPhtml + TextTOPhtml;

	lastTOP = currentTOP;

setTimeout("updateChangeTOPitem()",7000);
}

