

function setTimerToAnimations()
{
if ($('animationholder'))
	var y = window.setTimeout('startRandomAnimations()', 8000);

 
}	

		
function startRandomAnimations()
{
	var y = window.setInterval('randomAnimations()', 30000);

 
}		

		
function randomAnimations()
{
		
	var i = Math.round( 6 * Math.random() );
	
	
	
		if (i == 0)
		showBallon();
		else if 	(i == 1)
		showFly();
		else if 	(i == 2)
		showChase();
		else if 	(i == 3)
		showGrey();
		else if 	(i == 4)
		showAstro();
		else if 	(i == 5)		
		showLunar();
	 

}

function showBallon() {  

var winHeight = document.viewport.getHeight();
var pos = $('art-Sheet').cumulativeOffset(); 

var posX =(pos[0]) +300;

var top  = winHeight-20;
$('animationholder').innerHTML= '<img id="pink" src="/images/ballonpink.png" style="position:absolute; left:'+posX+'px; top:'+winHeight+'px; z-index:200;">';
new Effect.Appear('pink', { queue: { position: 'end', scope: 'ball' } });
new Effect.Move('pink', { x:0, y:-top, duration:8, transition: Effect.Transitions.spring, queue: { position: 'end', scope: 'ball' } }); 
new Effect.Fade('pink', { queue: { position: 'end', scope: 'ball' }});

  
}


function showAlien() {  

var pos = $('art-Sheet').cumulativeOffset(); 
var winHeight = document.viewport.getHeight(); 
var top = winHeight= winHeight-20;
var posX =(pos[0]) -120;
$('animationholder').innerHTML= '<img id="ali" src="/images/alien.png" style="display:none;position:absolute; top:'+winHeight+'px;left:'+posX+'px;  z-index:200;">';

new Effect.Appear('ali', { queue: { position: 'end', scope: 'alien' } });
new Effect.Move('ali', { x:0, y:-top, duration:8, queue: { position: 'end', scope: 'alien' } }); 
new Effect.Fade('ali', { queue: { position: 'end', scope: 'alien' }});

/*Effect.Queues.get('alien').interval = 1500;*/
  
}

function showTutu() {  

var winHeight = document.viewport.getHeight(); 
var winWidth = document.viewport.getWidth(); 
var top= winHeight-20;
var posX =winWidth -130;
$('animationholder').innerHTML= '<img id="tutu" src="/images/alientutu.png" style="display:none;position:absolute; top:'+winHeight+'px;left:'+posX+'px;  z-index:200;">';

new Effect.Appear('tutu', { queue: { position: 'end', scope: 'tut' } });
new Effect.Move('tutu', { x:0, y:-top, duration:8, queue: { position: 'end', scope: 'tut' } }); 
new Effect.Fade('tutu', { queue: { position: 'end', scope: 'tut' }});

/*Effect.Queues.get('alien').interval = 1500;*/
  
}


function showChase() {  
var pos = $('art-Sheet').cumulativeOffset(); 
var winHeight = document.viewport.getHeight(); 

var posX =(pos[0]) -80;

winHeight = winHeight -200 ;
$('animationholder').innerHTML= '<img id="chase" src="/images/satellite.png" style="position:absolute;  display:none;left:'+posX+'px; top:180px; z-index:200;">';
new Effect.Appear('chase', { queue: { position: 'end', scope: 'chased' }});
new Effect.Move('chase',{ x:820,duration: 3.5 ,  queue: { position: 'end', scope: 'chased' }}); 
new Effect.Fade('chase', { queue: { position: 'end', scope: 'chased' }});
  
}


function showGrey() {  
var winHeight = document.viewport.getHeight();
var pos = $('art-Sheet').cumulativeOffset(); 

var posX =(pos[0]) +600;

var top = winHeight = winHeight-20;
$('animationholder').innerHTML= '<img id="grey" src="/images/balloongrey.png" style="position:absolute; left:'+posX+'px; top:'+winHeight+'px; z-index:200;">';
new Effect.Appear('grey', { queue: { position: 'end', scope: 'ballg' } });
new Effect.Move('grey', { x:0, y:-top, duration:9, transition: Effect.Transitions.spring, queue: { position: 'end', scope: 'ballg' } }); 
new Effect.Fade('grey', { queue: { position: 'end', scope: 'ballg' }});
}




function showAstro() {  
var winHeight = document.viewport.getHeight();
var winWidth= document.viewport.getWidth();
var pos = $('art-Sheet').cumulativeOffset(); 
 

var posX =(pos[0]) -200;
winHeight = winHeight -100 ;
$('animationholder').innerHTML= '<img id="happy" src="/images/astronaut.png" style="overflow: hidden; display:none; position:absolute;left:'+posX+'px; top:'+winHeight+'px; z-index:200;">';
new Effect.Appear('happy', { duration: 1, queue:'end'});
new Effect.Move('happy',{x: winWidth, y: -1000,duration: 5, queue:'end'}); 
new Effect.Fade('happy', { duration: 1.0, delay: 2.0, queue:'end'});
  
}


function showFly() {  

var winHeight = document.viewport.getHeight();
var winWidth= document.viewport.getWidth();
var pos = $('art-Sheet').cumulativeOffset();
winWidth = winWidth -300;
var posX =(pos[0]) +400;
$('animationholder').innerHTML= '<img id="fly" src="/images/flyingsaucer.png" style="overflow: hidden; position:absolute;left:0px; top: 300px; z-index:200;">';
new Effect.Appear('fly', {  queue: { position: 'end', scope: 'saucer' } });
new Effect.Move('fly', { x:winWidth , y: 300,  duration: 8, transition: Effect.Transitions.spring, queue: { position: 'end', scope: 'saucer' } }); 
new Effect.Fade('fly', { queue: { position: 'end', scope: 'saucer' } });

 
}


function showLunar() {  

var pos = $('art-Sheet').cumulativeOffset(); 
var winHeight = document.viewport.getHeight(); 
winHeight = winHeight-240;
var posX =(pos[0]) +600;
$('animationholder').innerHTML= '<img id="moon" src="/images/lunar.png" style="display:none;position:absolute; top:0px;left:'+posX+'px;  z-index:200;">';

new Effect.Appear('moon', { queue: { position: 'end', scope: 'lune' } });
new Effect.Move('moon', { x:0, y:+winHeight, duration:8, queue: { position: 'end', scope: 'lune' } }); 
new Effect.Fade('moon', { queue: { position: 'end', scope: 'lune' }});

  
}
