//Master Variables - do not edit
var lights = [];
//Configurations
var AR_cfg_transitions = ['sine:in', 'quad:in:out', 'bounce:out'];
var AR_cfg_totalLights = 10;
var AR_cfg_fileDirectory = "";
var AR_cfg_lightFiles = ['/include/glow-effects/LargeCircle.png', '/include/glow-effects/MediumCircle.png', '/include/glow-effects/SmallCircle.png'];
var AR_cfg_maxHeight = 350;
var AR_cfg_speedoffset = 5100;
//Public Functions
function AR_random(max) {
  return (Math.ceil(Math.random() * max) - 1);
}
function AR_speed(){
	return ((AR_random(10) + 5) * AR_cfg_speedoffset);
	//return AR_cfg_speedoffset
}
function AR_width(){
	 var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return AR_random(myWidth - 100);
}

function AR_height(){
 return AR_random(AR_cfg_maxHeight);	
}

//Light Prototypes
var Light = function(id) {
  //var self = this;
  this.i = AR_cfg_lightFiles[AR_random(AR_cfg_lightFiles.length)];
  this.f = AR_cfg_fileDirectory + this.i; 
  this.n = document.createElement('img');  
  this.id = id;
  this.pointX = AR_width();
  this.pointY = AR_height();
  this.el = this.create();
  this.fly();

};


Light.prototype.create = function() {
var myLight = new Element('img', {
    'src': this.f,
	'id': this.id,
    'styles': {
        'position': 'absolute',
        'z-index': AR_random(20),
		'top': this.pointY,
   	    'left': this.pointX
    }
});
myLight.injectInside($(document.body));                   
return $(myLight);
};

Light.prototype.fly = function() {
  
	var animateImg = new Fx.Morph(this.el, {
		duration:AR_speed(), 
		wait:false, 
		transition: AR_cfg_transitions[AR_random(AR_cfg_transitions.length)],
		onComplete: function(passed) {
			lights[passed.id].fly();
		 }
	});
	animateImg.start({
			'left': AR_width(),
			'top': AR_height()
		});
};

window.addEvent('domready', function() {
if ((Browser.Engine.trident && Browser.Engine.version > 4) || !(Browser.Engine.trident)){
  for (i = 0; i < AR_cfg_totalLights; i++){  
    lights[i] = new Light(i);
  }}
});

