// Polling hits counter
var counter = 0;

function clock(){
  // Repeat it just 5 times		
  if(counter < 5){
    message = Clean.createSimpleMessage("demos/polling/counter.php", "clock", null);
    // No progress bar please !  
    message.silent = true;
    // The result will not be cached !
    message.cache = false;  
    // Define the onComplete listener
    message.onComplete = polling;
    Clean.doGet(message);
	// Count one more
    ++counter;  
  }
} 

function polling(xhr){ 
 // Call clock again
  clock();	
}

function restart(){
  counter = 0;
  di = new DomIterator(document);
  di.applyValue("clock", "00:00:00", true);
}