jQuery.fn.disableSelection = function() {
    jQuery(this).attr('unselectable', 'on')
           .css('-moz-user-select', 'none')
           .each(function() {
               this.onselectstart = function() { return false; };
            });
};


jQuery(document).ready(function($){

	var init = false;
	var x;
	var limit = 2;

	////////////////////////////////////////////////////
	// homepage stuff
	// (this stuff applies ONLY to homepage template
	////////////////////////////////////////////////////
	$("body.home").each(function(){

		swapImages();

	});

////////////////////////////////////////////////////
		// homepage images
		// cycle through image list
		function swapImages() {

			if (init == false) {
				x = Math.floor(Math.random()*limit);
				init = true;
			} else {
				if (x<limit) {
					x++;
				} else {
					x=0;
				}
			}

			$('#featured-image li IMG').each(function(index) {
				$(this).hide();
				if (index == x){
					$(this).fadeIn();
					//alert(x + ': ' + $(this).attr('src'));
				}
			});

			window.setTimeout(function() {swapImages()}, 8000);
		}

});

