var HPurls = new Array("5","3","4","16","9","2","7");
var HPpictures = new Array("homeBottomOpen.jpg", "homeBottomLinks.jpg", "homeBottomEmergency.jpg", "homeBottomAgent.jpg", "homeBottomService.jpg",
				"homeBottomAbout.jpg", "homeBottomFAQ.jpg");
var HPnames = new Array("פתח קריאת שירות","מסלולי השירות","שירותי חרום","כניסה לסוכנים","מחירון שירותים נוספים", "אודותינו", "שאלות נפוצות");
var HPrightmost = 0;

function chooseBox (id)
{
	unchoose();
  	document.getElementById("HB" + id).style.background = 'url(loadedFiles/HomeBottomHeaderSelected.jpg)';
	document.getElementById("HB" + id).style.color = '#959595';
}

function unchoose ()
{
  	document.getElementById("HB1").style.background = 'url(loadedFiles/HomeBottomHeader.jpg)';
  	document.getElementById("HB2").style.background = 'url(loadedFiles/HomeBottomHeader.jpg)';
  	document.getElementById("HB3").style.background = 'url(loadedFiles/HomeBottomHeader.jpg)';
  	document.getElementById("HB4").style.background = 'url(loadedFiles/HomeBottomHeader.jpg)';
	document.getElementById("HB1").style.color = '#5D5D5D';
	document.getElementById("HB2").style.color = '#5D5D5D';
	document.getElementById("HB3").style.color = '#5D5D5D';
	document.getElementById("HB4").style.color = '#5D5D5D';
}

function drawHPboxes()
{
	document.getElementById("HB1").innerHTML = "<br />" + HPnames[HPrightmost];
	document.getElementById("HB2").innerHTML = "<br />" + HPnames[(HPrightmost+1)%HPurls.length];
	document.getElementById("HB3").innerHTML = "<br />" + HPnames[(HPrightmost+2)%HPurls.length];
	document.getElementById("HB4").innerHTML = "<br />" + HPnames[(HPrightmost+3)%HPurls.length];
	document.getElementById("HBImg1").src = "loadedFiles/" + HPpictures[HPrightmost];
	document.getElementById("HBImg2").src = "loadedFiles/" + HPpictures[(HPrightmost+1)%HPurls.length];
	document.getElementById("HBImg3").src = "loadedFiles/" + HPpictures[(HPrightmost+2)%HPurls.length];
	document.getElementById("HBImg4").src = "loadedFiles/" + HPpictures[(HPrightmost+3)%HPurls.length];
	document.getElementById("HB1").onclick = new Function("location.href='index2.php?id=" + HPurls[HPrightmost] + "&lang=HEB'");
	document.getElementById("HB2").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+1)%HPurls.length] + "&lang=HEB'");
	document.getElementById("HB3").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+2)%HPurls.length] + "&lang=HEB'");
	document.getElementById("HB4").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+3)%HPurls.length] + "&lang=HEB'");
	document.getElementById("HBImg1").onclick = new Function("location.href='index2.php?id=" + HPurls[HPrightmost] + "&lang=HEB'");
	document.getElementById("HBImg2").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+1)%HPurls.length] + "&lang=HEB'");
	document.getElementById("HBImg3").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+2)%HPurls.length] + "&lang=HEB'");
	document.getElementById("HBImg4").onclick = new Function("location.href='index2.php?id=" + HPurls[(HPrightmost+3)%HPurls.length] + "&lang=HEB'");
}

function rotateLeft()
{
		HPrightmost = HPrightmost - 1;
		if (HPrightmost < 0)
				HPrightmost = HPurls.length - 1;
		drawHPboxes();
}

function rotateRight()
{
		HPrightmost = (HPrightmost + 1) % HPurls.length;
		drawHPboxes();
}

