//custom code by billy bastardi
//westech solutions llc.
//http://westechsolutions.com

// background image preload
// for background image rotation
$.fn.preload = function() {
    this.each(function(){
        $('<img/>')[0].src = this;
    });
}

var images_array = ['images/home/photos/image_rotator_1.png','images/home/photos/image_rotator_2.png','images/home/photos/image_rotator_3.png','images/home/photos/image_rotator_4.png'];
$(images_array).preload();

//background image rotator
$(document).ready(function() {
	var image_index = 1;
	var prev_image = 1;
	
	$("#image_rotator_"+image_index).fadeIn();
	
	setInterval(function() {
		image_index++;
		//alert(image_index);
		$("#image_rotator_"+prev_image).fadeOut()
		$("#image_rotator_"+image_index).fadeIn(2000);
		prev_image = image_index;
		if (image_index >= 4) { 
			image_index = 0;
		}
	},7000);
});
