
var objArray = new Array(5);
var objArrayBg = new Array(5);
var objArrayText = new Array(5);
var imgArray = new Array(5);
var text;
var prefOb = null
var stop = false;
var ffw = false;
var tf;
var fwd;
var count = 0;



	function assignArrays()
	{
		//getting back th container objects
		objArray[0] = document.getElementById("ie_containerA");
		objArray[1] = document.getElementById("ie_containerB");
		objArray[2] = document.getElementById("ie_containerC");
		objArray[3] = document.getElementById("ie_containerD");
		objArray[4] = document.getElementById("ie_containerE");

		//assigning color to the color array
		objArrayBg[0] = "#303030";
		objArrayBg[1] = "#444444";
		objArrayBg[2] = "#595959";
		objArrayBg[3] = "#6e6e6e";
		objArrayBg[4] = "#838383";


	/*	objArrayText[0] = "<font size='4' family='arial'><b>Cover Story</b></font><br><font size='2' family='arial'><b>Gem Diamonds – A Cut above the Rest</b></font><br><font family='aral'>By Clare Matthes<br><br>Leading global diamond producer, Gem Diamonds, recently enlisted the services of Peta Bank and, winner of many prestigious design awards, Steve de Nikolits of DesignBank to bring about the company's vision for its Johannesburg head office.<br><br><font family='aral'>";
		objArrayText[1] = "<font size='4' family='arial'><b>Hotbox</b></font><br><font size='2' family='arial'><b>The Fairest One&Only Cape Town</b></font><br><font family='aral'>By Dean Davis<br><br><font family='aral'>One&Only Resorts unveils its plans for its newest resort, One&Only Cape Town, scheduled to open during the latter half of 2009. The resort is set to become one of South Africa’s most luxurious destinations, providing a comprehensive range of services.<font family='aral'>";
		objArrayText[2] = "<font size='4' family='arial'><b>Design Emporium</b></font><br><font size='2' family='arial'><b>Rocco de Villiers – Rocking the Kitchen</b></font><br><font family='aral'>By Clare Matthes<br><br><font family='aral'>Rocco is well known for his 'roctails' and as a talented pianist, he let us into his kitchen and revealed a side that we are not used to seeing. <br><br>In photographs of Rocco when he first appeared in the media, he is dressed to the nines with a cocktail glass in his hand to round out the serious, almost James Bond look.<font family='aral'>";
		objArrayText[3] = "<font size='4' family='arial'><b>Hospitality</b></font><br><font size='2' family='arial'><b>Sexy in the City</b></font><br><font family='aral'>By Dean Davis <br><br><font family='aral'>Encapsulating everything from innovative design, dazzling colours and original décor to comprehensive hospitality and professional staff, The Grand strips down preconceived notions of how adult entertainment venues are seen whilst raising the bar on how they should be. <br><br>Situated along Rivonia’s main arterial route, The Grand's conspicuous appearance makes it hard to miss both during the day and at night.<font family='aral'>";
		objArrayText[4] = "<font size='4' family='arial'><b>Hospitality</b></font><br><font size='2' family='arial'><b>Dock House – Dramatic Revamp</b></font><br><font family='aral'>By Annali Smiths<br><br><font family='aral'>The ultra-luxurious boutique Waterfront hotel, Dock House, has opened its doors to sophisticated travellers, sporting an interior to rival the finest in the world! <br><br>Located in the building that previously housed the grand residence and offices to the Harbour Engineer in the mid-1800s, Dock House is where 'Rococo design meets the 21st century'.<font family='aral'>";*/
		
		objArray[0].style.marginLeft = "0px"
		objArray[1].style.marginLeft = "1px"
		objArray[2].style.marginLeft = "1px"
		objArray[3].style.marginLeft = "1px"
		objArray[4].style.marginLeft = "1px"

		for (var i = 0; i < (document.forms[0].length/2); i++) { 
			objArrayText[i] = document.forms[0].elements[(i*2)].value;
			//assigning images to the image array
			imgArray[i] = document.forms[0].elements[(i*2)+1].value;
		}
		count = 0;
	}


function autodivs()
{
	tf = "?";
	if(count == 5)
	{
		count = 0
	}
	if(stop)
	{
	}
	else
	{
		document.getElementById("ie_container1").style.background = objArrayBg[count];
		document.getElementById("skrif").innerHTML = objArrayText[count];
		document.getElementById("ie_containerBorder").style.background = objArrayBg[count];
		document.getElementById("ie_containerpic1").src = imgArray[count]
		if(count == 0)
		{
			objArray[count].style.marginLeft = "0px"
			objArray[count+4].style.marginLeft = "1px"
		}

		else
		{
			objArray[count-1].style.marginLeft = "1px"
			objArray[count].style.marginLeft = "0px"
		}
		
		if(count <= 4)
		{
			if(stop && count != 0)
			{
				document.getElementById("ie_container1").style.background = objArrayBg[count-1];
				document.getElementById("ie_containerpic1").src = imgArray[count-1]
				document.getElementById("skrif").innerHTML = objArrayText[count-1]
				document.getElementById("ie_containerBorder").style.background = objArrayBg[count-1];
					objArray[count].style.marginLeft = "1px"
					objArray[count-1].style.marginLeft = "0"
					ffw = true;
			}
			else
			{
			count++
				if(count == 5)
					{
						count = 0
					}
			window.setTimeout("autodivs()", 8000);
			}
			
		}
	}

}

function pause()
{
	if(count == 0)
	{
		
	}
	stop = true;
}
function forward()
{
				fwd = "#";
				if(stop == false)
				{
				}
				else if(count == 0 )
						{
							document.getElementById("ie_container1").style.background = objArrayBg[count];
							document.getElementById("skrif").innerHTML = objArrayText[count]
							document.getElementById("ie_containerBorder").style.background = objArrayBg[count];
							document.getElementById("ie_containerpic1").src = imgArray[count]
								objArray[count].style.marginLeft = "0"
								objArray[count+4].style.marginLeft = "1px"
							count++;
						}
						else
						{
							document.getElementById("ie_container1").style.background = objArrayBg[count-1];
							document.getElementById("skrif").innerHTML = objArrayText[count-1]
							document.getElementById("ie_containerBorder").style.background = objArrayBg[count-1];
							document.getElementById("ie_containerpic1").src = imgArray[count-1]
							objArray[count-1].style.marginLeft = "0"
							if (count >= 2)
							{
								objArray[count-2].style.marginLeft = "1px"
							}
							else
							{
								objArray[4].style.marginLeft = "1px"
							}
							
							if(count == 5)
							{
								count = 0;
								
							}
							count++
						}
				
		
}

function reverse()
{
		stop = true;
		
		if (count == 0)
		{
			count = 6;
			document.getElementById("ie_container1").style.background = objArrayBg[count-2]
			document.getElementsByName("skrif.innerHTML").innerHTML = objArrayText[count-2]
			document.getElementById("ie_containerBorder").style.background = objArrayBg[count-2];
			document.getElementById("ie_containerpic1").src = imgArray[count-2]
			objArray[count-2].style.marginLeft = "0"
			objArray[4].style.marginLeft = "1px"
			count--
		}
		if (count == 1)
		{
			count = 6;
			document.getElementById("ie_container1").style.background = objArrayBg[count-2]
			document.getElementById("skrif").innerHTML = objArrayText[count-2]
			document.getElementById("ie_containerBorder").style.background = objArrayBg[count-2];
			document.getElementById("ie_containerpic1").src = imgArray[count-2]
			objArray[count-2].style.marginLeft = "0"
			objArray[0].style.marginLeft = "1px"
			count--
		}
		else
		{
		document.getElementById("ie_container1").style.background = objArrayBg[count-2]
		document.getElementById("skrif").innerHTML = objArrayText[count-2]
		document.getElementById("ie_containerBorder").style.background = objArrayBg[count-2];
		document.getElementById("ie_containerpic1").src = imgArray[count-2]
		objArray[count-2].style.marginLeft = "0"
		objArray[count-1].style.marginLeft = "1px"
		count--
		}
	
}

function stopDivs()
{
}




function changedivs(arg, obs, ct)
{
	stop = true;

		if(fwd == "#")
		{
			if (count == 1)
			{
				document.getElementById("ie_container1").style.background = objArrayBg[count-1];
				document.getElementById("skrif").innerHTML = objArrayText[count-1]
				document.getElementById("ie_containerBorder").style.background = objArrayBg[count-1];
				document.getElementById("ie_containerpic1").src = imgArray[count-1]
					
					objArray[count-1].style.marginLeft = "0"
					objArray[4].style.marginLeft = "1px"
			}

			if (count == 0)
			{
				document.getElementById("ie_container1").style.background = objArrayBg[count];
				document.getElementById("skrif").innerHTML = objArrayText[count]
				document.getElementById("ie_containerBorder").style.background = objArrayBg[count];
				document.getElementById("ie_containerpic1").src = imgArray[count]
					
					objArray[count].style.marginLeft = "0"
					objArray[count+4].style.marginLeft = "1px"
			}
			if (count > 1)
			{
				objArray[count-2].style.marginLeft = "1px"
				document.getElementById("ie_container1").style.background = arg;
				document.getElementById("ie_containerBorder").style.background = arg;
				document.getElementById("ie_containerpic1").src = imgArray[ct]
					
				obs.style.marginLeft = "0"
				document.getElementById("skrif").innerHTML = objArrayText[ct]
				fwd = "";
			}
		}



		if(tf == "?")
		{
			if (count == 0)
			{
				objArray[4].style.marginLeft = "1px"
			}
			else
			{
			objArray[count-1].style.marginLeft = "1px"
			}
		}
		document.getElementById("ie_container1").style.background = arg;
		document.getElementById("ie_containerBorder").style.background = arg;
		document.getElementById("skrif").innerHTML = objArrayText[ct]
			document.getElementById("ie_containerpic1").src = imgArray[ct]
			
		obs.style.marginLeft = "0"
		count = ct+1
		if(prefOb == null)
		{
			prefOb = obs
		}
		else
		{
			prefOb.style.marginLeft = "1px"
			prefOb = obs
		}


}
