
	
	_no_events 	= 0 ;
	_popH		= 100 ;
	_dest		= false ;
	
	
	
	_bank 		= -1 ;
	
	function liveUB()
	{	// IM 0	:: anim crédits restants
				
		OBJ = document.getElementById('ub') ;


		// --- Valeur à afficher cette pass
			if( _bank == -1 )
			{	_bank = _bankI ;
			}
		
			
			_bank_now = _bank.toString() ;
			
		// --- Version mise en forme 
			_display_bank = new String() ;
		
			
		// ---- Espacement
			$n = 0 ;
			for( a = _bank_now.length-1 ; a>=0 ; a-- )
			{	c= _bank_now.substr( a , 1 );			
				_display_bank = c + _display_bank ;
				$n = ($n+1) % 3 ;
				if( $n == 0 )
				{	_display_bank = ' ' + _display_bank ;
				}				
			}
			
		// --- Done
			OBJ.innerHTML = _display_bank ;

			
			if( _bank != _bankO )
			{	
				delta	= Math.round( ( _bankO - _bank ) / 10 ) ;
				
				if( Math.abs( delta ) > 10 )
				{	_bank += delta ;
					setTimeout( 'liveUB()' , 30 );
				}
				else
				{	// Finalise
					if( delta != 0 )
					{	_bank = _bankO ;
						setTimeout( 'liveUB()' , 30 );
					}
				}
			}
		
	}
	
	

	lastshow	= false;
	
	function show(num)
	{	//	IM 0 :: ouvre display_unit_second	
	
		from		= num.toString();
		
		if( num.substr(0,3) == 'ins' )
				INS	= true ;
		else	INS	= false ;
	

		
		if( lastshow != false && lastshow != num && INS )
				document.getElementById(lastshow).style.display = "none";
		
		if(document.getElementById(num).style.display)
				document.getElementById(num).style.display = "";
		else	document.getElementById(num).style.display = "none";
		
		if( INS )
				lastshow = num ;
	}


	function roll()
	{	//	IM 0 :: roll tous les timers
	
		for( n=0; n<timersN ; n++)
		{	if( timers[n] != - 100 )
			{	timers[n] -- ;
				if( OBJ = document.getElementById('timer'+n) )
				{	OBJ.innerHTML = timing( timers[n] , n );
				}
			}
		}
	}
	
	function timing( num , id )
	{	//	IM 0 :: process 1 timer

		if( num > 0 )
		{
			// --- Affichage temps restant h:m:s
			H	= parseInt( num / 3600 );
			D	= parseInt( H / 24 );
			
			M	= num - H*3600 ;
			MM	= parseInt( M / 60 );
			S	= M - MM*60 ;
			
			if(MM<10) 	{ MM = "0" + MM; }
			if(S<10) 		{ S = "0" + S; }
			
			R	= "";
			
			if( D > 0 )
			{	R	+= D + "j ";
				H	= parseInt( H % 24 );
			}
				 
			R	+= H + ":" + MM + "'" + S + "\"";
			
			return	( '<I>' + R + '</I>' ) ;
		}
		else
		{	timers[id]	= -100 ;
			// if( who_user_cfg_mute == 0 ) { document.getElementById("audio").src = 'GFX/OST/audio.php?event=avert' ; }	
			if( _no_events == 0 )
			{	window.location = thisURL ;
			}
			return	("<B>OK</B>") ;
		}
	}
	
	
	
	
	function pop_display()
	{
		document.getElementById('main').style.filter = "alpha(opacity=20)" ;
		document.getElementById('main').style.opacity = 0.2 ;
		
		liveeManager();
		
		document.getElementById('pop').style.visibility = 'visible' ; 
		document.getElementById('pop').style.height = 1 ;
		_popH	= 1 ;
	}
	

	function liveeurl( go )
	{
		// pop_display() ;
		document.getElementById('popframe').src = go ;
	}
	
	function livee( unit , kid )
	{			
		src	= "?c=more&where=" + _where + "&SID=" + _SID + "&im=1&what=" + unit + "&kid=" + kid ;
		// pop_display() ;
		document.getElementById('popframe').src = src ;
	
	}

	
	function liveeclose()
	{
		// parent.document.body.style.overflow = 'auto' ; 
		WHERE	= document ;
		WHERE.getElementById('pop').style.visibility = 'hidden' ;	
		WHERE.body.style.overflowX = 'hidden' ; // IE Fix		
		WHERE.getElementById('main').style.filter = '' ;
		WHERE.getElementById('main').style.opacity = 1 ;
	}

	
	
	function liveeManager(event)
	{	// IM 0
	
		OBJ	= document.getElementById('pop') ;
	
		DS	= document.body.scrollTop ;
		CW	= document.body.clientWidth ;
		CH	= document.body.clientHeight ;
		DW	= 480 ; // 512; // OBJ.style.width ;
		DH	= _popH ; // 520 OBJ.style.height ;
	
		
		OBJ.style.top = DS + ( CH - DH ) / 2 - 12 ;
		OBJ.style.left = ( CW - DW ) / 2 + 12 ;
		
	}

	
	function pop_boot()
	{	// IM 1
	
		if( ! _dest )
		{	//	Init. 
			_dest = document.getElementById('popbody').scrollHeight ;
			parent.pop_display();
			if( _dest > 480 )
			{	_dest = 480 ;
			}
		}
		else
		{		
			if( _dest != _popH )
			{
				_popH	+= ( _dest - _popH ) / 3 ;
				parent._popH = _popH ;
				parent.document.getElementById('pop').style.height = _popH ;
				parent.liveeManager();
			}
		}
	}
	

	
	
	function ajustprix()
	{	//	input
		if( document.getElementById('priced') )
		{
			nb = document.getElementById('nb').value ;
			if( nb > 0 )
			{		price = document.getElementById('prix').value * nb ;
					document.getElementById('priced').innerHTML = 'TX ' + Math.round( price ) ; // price.toFixed(2) ;
			}
			else	document.getElementById('priced').innerHTML = '--' ;
		}
		
	}

	
	function boot()
	{	// IM 0
		if (document.all)
				document.body.onscroll = liveeManager ;
		else	document.onscroll = liveeManager ;
		
		setInterval( 'ajustprix()' , 500 );
		setTimeout( 'liveUB()' , 100 );
		
		// --- Réinit Chan
			if( parent.tail )
			{	parent.tail.frame_alive() ;
			}

	}

	
