

newimage0 = new Image();
newimage0.src = "../images/foto1.jpg";
newimage1 = new Image();
newimage1.src = "../images/foto2.jpg";
newimage2 = new Image();
newimage2.src = "../images/foto3.jpg";
newimage3 = new Image();
newimage3.src = "../images/foto4.jpg";
newimage4 = new Image();
newimage4.src = "../images/foto5.jpg";

	var banners = new Array(
		'foto1.jpg',
		'foto2.jpg',
		'foto3.jpg',
		'foto4.jpg',
		'foto5.jpg'
		);


	var texts = new Array(
		 "<font color=black><p align=left><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looking for a nice villa with pool&nbsp;&nbsp;&nbsp;",
		 "<font color=black><p align=left><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Search' and pick your choice&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
		 "<font color=black><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>Luxurious holiday acc</font>ommodations?",
		 "<font color=black><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>VillaVida has several to</font> choose from"
	);

var old = 0;
var current = 0;



function init()
{
	if (!document.images) return
	while (current == old)
	{
		modulo = current + 1;
		current = modulo%banners.length;
	}
	old = current;
	name = 'top_right' + current;
	document.getElementById("banner").setAttribute("class", name);
	document.getElementById("banner").setAttribute("className", name);
	setTimeout('init()',7000);
}







/////////////////////
/////// to delete




	var iLiczbapaczek = 3;
	var iNumber   = 4;

	var iCurrent  = 0;
	var iInterval = 4000;

	var iRand = Math.floor(iLiczbapaczek*Math.random());
	//var iRand = 2;
	var iAfter = 1;



	var asTexts = new Array();
	var asBmp = new Array();
	for (i=0;  i < iLiczbapaczek; i++)
	{
		asTexts[i] = new Array();
		asBmp[i] = new Array();
	}

	//var basePath = "";
	var basePath = "/assets/images/";


if(navigator.appName=="Netscape"){

	asTexts[0][0] = "<font color=black><p align=left><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looking for a nice villa with pool&nbsp;&nbsp;&nbsp;";
	asTexts[0][1] = "<font color=black><p align=left><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Search' and pick your choice&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	asTexts[0][2] = "<font color=black><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>Luxurious holiday acc</font>ommodations?";
	asTexts[0][3] = "<font color=black><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>VillaVida has several to</font> choose from";
	asBmp[0][0] = "top_right_pool";
	asBmp[0][1] = "top_right2";

	asTexts[1][0] = "<font color=#00245D><p align=center>&nbsp;&nbsp;Play golf on exceptional courses";
	asTexts[1][1] = "<font color=#00245D><p align=center><font color=white>VillaVi</font>da will totally facilitate your golf trip ";
	asTexts[1][2] = "<font color=white><p align=left><br><br>&nbsp;&nbsp;&nbsp;Owning a house in the  <br>&nbsp;&nbsp;&nbsp;<font color=#00245D>Eastern Alga</font>rve</p>";
	asTexts[1][3] = "<font color=white><p align=left><br><br>&nbsp;&nbsp;&nbsp;&nbsp;VillaVida will take care of it</p>";
	asBmp[1][0] = "top_right3";
	asBmp[1][1] = "top_right4";

	asTexts[2][0] = "<font color=black><div align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your property.<font color=white>..</font></div>";
	asTexts[2][1] = "<font color=black><div align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your property.<font color=white>..</font><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>......our Experti<font color=black>se.</font></div>";
	asTexts[2][2] = "<font color=black><div align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Want to rent out you<font color=white>r property</font>?</p>";
	asTexts[2][3] = "<font color=black><div align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VillaVida will do it for <font color=white>you</font></p>";
	asBmp[2][0] = "top_right5";
	asBmp[2][1] = "top_right7";
}
else{
	asTexts[0][0] = "<font color=black><p align=left><br><br><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Looking for a nice villa with pool&nbsp;&nbsp;&nbsp;";
	asTexts[0][1] = "<font color=black><p align=left><br><br><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'Search' and pick your choice&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	asTexts[0][2] = "<font color=black><br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>Luxurious holiday acc</font>ommodations?";
	asTexts[0][3] = "<font color=black><br><br>&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>VillaVida has several to</font> choose from";
	//asBmp[0][0] = "pool.jpg";
asBmp[0][0] = "top_right_pool";
//	asBmp[0][1] = "foto2.jpg";
asBmp[0][1] = "top_right2";

	asTexts[1][0] = "<font color=#00245D><p align=center><br>&nbsp;&nbsp;Play golf on exceptional courses";
	asTexts[1][1] = "<font color=#00245D><p align=center><br><font color=white>VillaVi</font>da will totally facilitate your golf trip ";
	asTexts[1][2] = "<font color=white><p align=left><br><br><br><br><br>&nbsp;&nbsp;&nbsp;Owning a house in the  <br>&nbsp;&nbsp;&nbsp;<font color=#00245D>Eastern Alga</font>rve</p>";
	asTexts[1][3] = "<font color=white><p align=left><br><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;VillaVida will take care of it</p>";
	asBmp[1][0] = "top_right3";
	//asBmp[1][1] = "foto4.jpg";
	asBmp[1][1] = "top_right4";
	asTexts[2][0] = "<font color=black><p align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your property.<font color=white>..</font>";
	asTexts[2][1] = "<font color=black><p align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your property.<font color=white>..</font><br><br><br><br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=white>......our Experti<font color=black>se.</font>";
	asTexts[2][2] = "<font color=black><p align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Want to rent out you<font color=white>r property</font>?</p>";
	asTexts[2][3] = "<font color=black><p align=left>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VillaVida will do it for <font color=white>you</font></p>";
	asBmp[2][0] = "top_right5";
	asBmp[2][1] = "top_right7";
}


	function changebg(){
		tdone = document.getElementById("td1");
//		tdone.background = basePath+asBmp[iRand][1];
		document.getElementById("banner").setAttribute("class", asBmp[iRand][1]);
	}

	function startfirstbg(){
		tdone = document.getElementById("td1");
		//tdone.background = basePath+asBmp[iRand][0];
	//	document.body.background = basePath+asBmp[iRand][0];
		document.getElementById("banner").setAttribute("class", asBmp[iRand][0]);
	}

	function startCounting() {

		//do the loop
		//if (iCurrent == iNumber)
		//	iCurrent = 0;

		if(iCurrent == 0){			startfirstbg();		}
		if(iCurrent == 3){			changebg();			}

		if (iCurrent < iNumber ) {
			if(iCurrent==2){
				window.setTimeout("changeDisplay();", iInterval*2);}
			else{
				window.setTimeout("changeDisplay();", iInterval);
			}
			iCurrent++;
		}
	}


	function changeDisplay() {
		var oElement = document.getElementById("banner_home");
		var sText = asTexts[iRand][iCurrent-1];
		oElement.innerHTML = sText;
		startCounting();
	}



