// JavaScript Document
var Backdrop = {
    init: function(num,image,fade,container) {
        container = document.getElementById(container);
        var images = new Array();
        for (var i = 0;i < num; i++) {
            images[i] = document.createElement('img');
            images[i].src = image;
            images[i].style.top = Math.floor(Math.random()*250) + 'px';
            images[i].style.left = Math.floor(Math.random()*95) + '%';
            container.appendChild(images[i]);
            Backdrop.animate(images[i],fade);
        }
    },
    animate: function(img,fade) {
        currentPos = parseInt(img.style.left);
        if (currentPos >= 0) {
            newPos = currentPos - fade;
           
        } else {
            
            
        }
        setTimeout(function(){Backdrop.animate(img,fade)},2000);
    }
	
};

window.onload = function () {
    Backdrop.init(80,'/wp-content/themes/levos/images/star-sm.png',1,'stars');
    Backdrop.init(40,'/wp-content/themes/levos/images/star-purp.png',3,'stars');
    Backdrop.init(10,'/wp-content/themes/levos/images/STAR1.gif',1,'stars');
    Backdrop.init(20,'/wp-content/themes/levos/images/star3.gif',1,'stars');
}

jQuery(document).ready(function($){
	shootingstar();
	setInterval('shootingstar()',12000);
});

function shootingstar()
{
	jQuery('#shootingstar').css('bottom','700px').css('left','500px') .css('opacity','1');
	jQuery('#shootingstar').animate({'bottom':'700px', 'left':'500px', 'opacity':1}, 2600);
	jQuery('#shootingstar').animate({'opacity':1}, 300);
	jQuery('#shootingstar').animate({'bottom':'400px', 'left':'0px', 'rotate':'90', 'opacity':0}, 600);
	
	

}
jQuery(document).ready(function($){
	shootingstar2();
	setInterval('shootingstar2()',20000);
});

function shootingstar2()
{	
	jQuery('#shootingstar2').css('bottom','400px').css('left','500px') .css('opacity','1');
	jQuery('#shootingstar2').animate({'bottom':'400px', 'left':'500px', 'opacity':1}, 5600);
	
	jQuery('#shootingstar2').animate({'opacity':1}, 300);
	jQuery('#shootingstar2').animate({'bottom':'100px', 'left':'0px', 'rotate':'90', 'opacity':0}, 600);
	

}
