var dlg=null;
function init(e) {
	//dlg = dojo.widget.createWidget("dojo:Dialog",{toggle:"fade",toggleDuration:250,bgColor:"black",closeNode:"noButton"}, document.getElementById("DialogContent"));
	dlg = dojo.widget.byId("DialogContent");
	var timerDialog = document.getElementById("timerDialog");
	dlg.setTimerNode(timerDialog);
}
//dojo.addOnLoad(init);


var dateConnection = new Date();
if(dateConnection.getHours()>=6 && dateConnection.getMinutes()>=45 || dateConnection.getHours()>=7 )
	dateConnection.setDate(dateConnection.getDate()+1)
dateConnection.setHours(6,45,0,0);

var dateCurrent;
var isPassedOnce = false;
var goOn = true;

function stillGoOn(listTimerComponent){
	dateCurrent = new Date();
	dojo.debug("dateConnection",dateConnection);
	dojo.debug("dateCurrent",dateCurrent);
	
	
	// Popup de fin de temps reel
	/*
	if(dlg==null){
		try{
		dlg = dojo.widget.byId("DialogContent");
		var timerDialog = document.getElementById("timerDialog");
		dlg.setTimerNode(timerDialog);
		}catch(e){}
	}
	
	if(! isPassedOnce){
		if(dojo.date.diff(dateConnection,dateCurrent,dojo.date.dateParts.MINUTE) >= REALTIME_INTERVAL_STOPPING){
			goOn = false;
			for(var i; i < listTimerComponent.length; i++){
				listTimerComponent[i].stop();
			}
			
			isPassedOnce = true;
			dlg.show();
			
			dojo.event.connect(dojo.byId("yesButton"), "onclick", function(){
				dateConnection = new Date();
				for(var i; i < listTimerComponent.length; i++){
					listTimerComponent[i].start();
				}
				goOn = true;
				dlg.hide();
			});
				
		}
	}else{
		if(dojo.date.diff(dateConnection,dateCurrent,dojo.date.dateParts.HOURE) >= REALTIME_SECONDE_INTERVAL_STOPPING){
			goOn = false;
			for(var i; i < listTimerComponent.length; i++){
				listTimerComponent[i].stop();
			}
		}
	}
	*/
	dojo.debug("Realtime : "+(dateConnection.getTime() - dateCurrent.getTime()));
	if((dateConnection.getTime() - dateCurrent.getTime()) <= 0){
		goOn = false;
		for(var i; i < listTimerComponent.length; i++){
			listTimerComponent[i].stop();
		}
	}
	
	return goOn;
}