//var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
//document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

//pass min and max -measured against window width
function P7_MinMaxW(a,b){
	var nw="auto",w=document.documentElement.clientWidth;
	if(w>=b){nw=b+"px";}if(w<=a){nw=a+"px";}return nw;
}

		var numLoops = 1000;			// number of times to increment loop;
		var numSecs = 5;				// number of seconds you want script to delay;
		var timeout = numSecs * 1000;		// the timeout time
		var t = 0;						// used to increment timeout
		var currentAd = 0;
		var flag = 0;
		var arrayImages = new Array();	// array for image file names
		var arrayLinks  = new Array();	// array for string to pass to the javascript function

		// lamborgini ad
		arrayImages[0] = "http://supercarlifestyle.com/images/new/lambo.jpg";
		arrayLinks[0] = "showbox('lambo')";

		// mothers add
		arrayImages[2] = "http://supercarlifestyle.com/images/new/mothers.gif";
		arrayLinks[2] = "window.open('http://www.mothers.com/', '_blank');newWindow.focus()";

		// union add
		arrayImages[1] = "http://supercarlifestyle.com/images/new/union.jpg";
		arrayLinks[1] = "showbox('union')";

		// silhouette add
		arrayImages[3] = "http://supercarlifestyle.com/images/new/silhouette.jpg";
		arrayLinks[3] = "var action=false;"		

		// add your new advers here
		var numAds = arrayImages.length-1;

		for(var x=0;x<=numLoops;x++)
		{
			setTimeout("showAdd()",t);
			t = timeout + t;			
		}

function showAdd()
{

	// buld html string
	var htmlString = "<img style=\"cursor:pointer; cursor: hand; margin-bottom: 10px; border: solid 1px #A98C62\" onClick=\"javascript:";
	htmlString = htmlString + arrayLinks[currentAd] + "\" src=\"" + arrayImages[currentAd] + "\">";
	if(flag == 0)

	{
		document.getElementById("add1").innerHTML = "";
		document.getElementById("add1").innerHTML = htmlString;
		flag = 1;
	}
	else
	{
		document.getElementById("add2").innerHTML = "";
		document.getElementById("add2").innerHTML = htmlString;
		flag = 0;
	}

	// goto the next add in the array or go to the beginning of the array.

	if(currentAd==numAds){ currentAd = 0;	/*reset current add to 0 */ }
	else
	{ currentAd = currentAd + 1; /*goto the next add */ }
}

window.onload=function(){
new popUp(500, 500, 300, 175, "union", "<b>Contact Mr Nigel Croxon.</b><br><br><b>Cell:</b> +27 82 601 5803<br><b>Land line:</b> 013 752 1500<br>", "white", "black", "10pt sans-serif", "Union Motors", "#A98C62", "white", "#dddddd", "gray", "black", false, true, false, true, false),
new popUp(400, 450, 400, 220, "compo", "<p>Please provide us with your email address.  By pressing <i>'Enter'</i> you agree to our <a href='?page=competition-rules'>Competition Rules</a> and our <a href='?page=privacy-policy'>Privacy Policy</a></p><form name='compo' onSubmit='return ValidateForm()' method='post'><table><tr><td><b>Your answer:</b></td><td><input type='text' name='answer' readonly></td></tr><tr><td><b>Your email address:</b></td><td><input type='text' name='email'></td></tr></table><center><input type='submit' value='Enter'><input type='reset' value='Cancel' onClick='javascript:hidebox(\"compo\")'></center></form>", "white", "black", "10pt sans-serif", "Playstation Hamper Competition", "#A98C62", "white", "#dddddd", "gray", "black", false, true, false, true, false),new popUp(500, 400, 300, 175, "lambo", "<b>Contact Mr Marius Malherbe.</b><br><br>MD Lamborghini Johannesburg<br><br><b>Land line:</b> +27 11 709 6351 (office)<br>", "white", "black", "10pt sans-serif", "Lamborghini Johannesburg", "#A98C62", "white", "#dddddd", "gray", "black", false, true, false, true, false);
}
