// set customers Array
var customers = new Array("customer1",
						  "customer2",
						  "customer3",
						  "customer4",
						  "customer5",
						  "customer6",
						  "customer7",
						  "customer8",
                                                  "customer9",
                                                  "customer10");

var totalCustomers = customers.length;

var currentCustomer = 0;
var oldCustomer = "nope";

function checkStart() {
	if(document.getElementById('customer1')) {
		window.setInterval("changeCustomer()", 10000);
	}
}

window.onload = new Function("checkStart()");

// timed function to show new customer
function changeCustomer() {
	
	document.getElementById("loading").src = 'images/loading.gif';
	document.getElementById("loading").style.display = "block";
	
	// checks if the currentCustomer not bigger than the last box
	if(currentCustomer == totalCustomers) {
		currentCustomer = 0;
	}
	
	// set current box visible
	document.getElementById(customers[currentCustomer]).style.visibility = "visible";
	
	if(oldCustomer != "nope" ) {
		document.getElementById(customers[oldCustomer]).style.visibility = "hidden";
	}
	
	oldCustomer = currentCustomer;
	
	// count
	currentCustomer++;
	
} // end function

function hideAllCustomers() {
	
	for(i = 0; i < totalCustomers; i++) {
		
		document.getElementById(customers[i]).style.visibility = "hidden";
		
	}
	
	document.getElementById("loading").style.display = "none";
	
}

