function DisplaySecsRemain( id , secs ) {
	if (secs<0) secs=0;
	var cd = $("#"+id+"_countdown");

	var r_secs = secs%60;
	secs = Math.floor( secs / 60 );
	var r_mins = secs%60;
	secs = Math.floor( secs / 60 );
	var r_hours = secs;

	var s = "";
	if (r_hours<10) s+="0";
	s+=r_hours;
	s+=":";
	if (r_mins<10) s+="0";
	s+=r_mins;
	s+=":";
	if (r_secs<10) s+="0";
	s+=r_secs;

	cd.html( s );

}

function RefreshMaintenancePane( id ) {
	var d = $("#"+id).data( "datas" );
	var ed = new Date( d.epochms );

	var curtime = new Date();
	var timeleft = new Date( ed - curtime );

	DisplaySecsRemain( id , Math.floor( timeleft.valueOf()/1000 ) );
	// d.vis = !d.vis;
	$("#"+id).data( "datas" , d );
	setTimeout( "RefreshMaintenancePane('"+id+"');" , 1000 );
}

function InitMaintenancePane( id , datas ) {
	// datas.vis = true;
	$("#"+id).data( "datas" , datas );
	RefreshMaintenancePane( id );
}
