if (top != self) {
	top.location = location;
}

IE = (document.all) ? true : false;

var iLeft = 0;
var iLeader = 0;
var oVisDiv0;
var oVisDiv1;
var oVisDiv2;
var oVisDiv3;
var oVisDiv4;
var oVisDiv5;
var oVisDiv6;
var oVisDiv7;
var oVisDiv8;
var oVisDiv9;
var oVisDiv10;
var TimeOutID;
var iNumberOfImages = 11;
var m_ImageWidth = parseInt(iNumberOfImages - 1);
var m_iSeq = m_ImageWidth;

positionLayers();

startScroll();

loadVisibleDiv();

function positionLayers()
{
	var posX;
	var posY;
	
	posX = parseInt(RightHorizontal() - 300);
	posY = Math.max(2 * BottomVertical() / 3, 280);
	
	moveLayer('ButtonLayer', (posX - 300) / 2, parseInt(posY - 200));
	moveLayer('LanguageLayer', RightHorizontal() - 102, 6);
	moveLayer('MainLayer', 0, posY);
	moveLayer('LogoLayer', posX, parseInt(posY - 236));
}

function RightHorizontal() {
	var TheWindowWidth = IE ? (document.body.clientWidth) : window.innerWidth;
	return parseInt(TheWindowWidth);
}

function BottomVertical() {
	var TheWindowHeight = IE ? (document.body.clientHeight) : window.innerHeight;
	return parseInt(TheWindowHeight);
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function moveLayer(theLayer, posX, posY)
{
  var obj;
  if ((findObj(theLayer))!=null)
  {
    if (document.layers)  //NS
    {
      obj = document.layers[theLayer];
      obj.left = posX;
      obj.top  = posY;
    }
    else if (document.all)//IE
    {
      obj = document.all[theLayer].style;
      obj.pixelLeft = posX;
      obj.pixelTop  = posY;
    }
  }
}

function startScroll()
{
	TimeOutID = window.setInterval('doIt();',50);
}
function stopScroll()
{
	clearInterval(TimeOutID);
}

function loadVisibleDiv()
{
	if (document.layers) {
		for (var iCnt=0; iCnt<=m_ImageWidth; iCnt++) {
			eval("oVisDiv" + iCnt + " = document.layers['divSC" + iCnt + "']")
		}
	}
	else if (document.all) {
		for (var iCnt=0; iCnt<=m_ImageWidth; iCnt++) {
			eval("oVisDiv" + iCnt + " = document.all['divSC" + iCnt + "'].style")
		}
	}
	else if (document.getElementById) {
		for (var iCnt=0; iCnt<=m_ImageWidth; iCnt++) {
			eval("oVisDiv" + iCnt + " = document.getElementById('divSC" + iCnt + "').style")
		}
	}
}

function doIt()
{
	var iLa;
	var iLb;
	var iLc;
	var iLd;
	var iAddIncr
	var iLocal
	var i
	iLocal=iLeader
	iAddIncr=0;
	
	for (var iCnt=0; iCnt<=m_ImageWidth; iCnt++) {
		eval("oVisDiv" + iLocal + ".left=" + (iLeft + iAddIncr));
		iAddIncr += MediaData[iLocal].Width + 1; 		// + 1 is the spacer
		iLocal+=1;
		if (iLocal > m_ImageWidth) {
			iLocal=0;
		}
	}
	  
	if (iLeft<=-(MediaData[iLeader].Width+1)) {  
		iLeft=0;
		m_iSeq+=1;
		if (m_iSeq > iNumberOfImages-1) {
			m_iSeq=0;
		}
		iLeader+=1;
		if (iLeader > m_ImageWidth) {
			iLeader=0;
		}
	}
	
	iLeft-=1
}

function makeData(ID, Width, Height)
{
	this.ID = ID;
	this.Width = Width;
	this.Height = Height;
	return true;
}

var MediaData = new Array();

MediaData[0] = new makeData('MRPERU00',120,0)
MediaData[1] = new makeData('MRPERU01',120,0)
MediaData[2] = new makeData('MRPERU02',120,0)
MediaData[3] = new makeData('MRPERU03',120,0)
MediaData[4] = new makeData('MRPERU04',120,0)
MediaData[5] = new makeData('MRPERU05',120,0)
MediaData[6] = new makeData('MRPERU06',120,0)
MediaData[7] = new makeData('MRPERU07',120,0)
MediaData[8] = new makeData('MRPERU08',120,0)
MediaData[9] = new makeData('MRPERU09',120,0)
MediaData[10] = new makeData('MRPERU10',120,0)

