	var currentPage = 'display';
	var currentPage2 = 'diapers';
	var currentChan = 'famChan';
	var slidePage = 1;
	var slidePageDetails = 1;

	jQuery.timer = function (interval, callback) {
		var interval = interval || 100;
		if(!callback) {
			return false;
		}

		_timer = function (interval, callback) {
			this.stop = function () {
				clearInterval(self.id);
			};

		this.internalCallback = function () {
			callback(self);
		};

		this.reset = function (val) {
			if (self.id)
			clearInterval(self.id);
			var val = val || 100;
			this.id = setInterval(this.internalCallback, val);
		};

		this.interval = interval;
		this.id = setInterval(this.internalCallback, this.interval);
		var self = this;
	};

	return new _timer(interval, callback);
	};
	
	var statBox = new Array();
	statBox[0] = 'hlMembers';
	statBox[1] = 'hlDiscussions';
	statBox[2] = 'hlPosts';
	statBox[3] = 'hlVisitors';
	statBox[4] = 'hlViews';
	statBox[5] = 'hlTime';
	statBox[6] = 'hlRegistrations';
	statBox[7] = 'hlTraffic';
	
	var currentStatBox = 0;
	
	jQuery.fn.fadeStatBox = function() {
		var oldStatBox = currentStatBox;
		if(currentStatBox == (statBox.length - 1)) {
			currentStatBox = 0;
		} else {
			currentStatBox++;
		}
		$.timer(5000, function (timer) {
		
		$('#' + statBox[oldStatBox]).fadeOut(500);
		$('#' + statBox[currentStatBox]).fadeIn(700);
		
		timer.stop();
		$(this).fadeStatBox();
	});
		
	}
	


	
	jQuery.fn.slideBox = function() {
		$(this).blur();
		var direction = $(this).attr('rev');
		if(direction == 'left') {
			if(slidePage > 1) {
				$('#slider').animate({ left:  '+=774px'}, 1000);
				slidePage--;
			}
		} else {
			if(slidePage < 3) {
				$('#slider').animate({ left:'-=774px' }, 1000);
				slidePage++;
			}
		}
		return false;
	}




	jQuery.fn.slideDetails = function() {
		$(this).blur();
		var direction = $(this).attr('rev');
		if(direction == 'left') {
			if(slidePageDetails > 1) {
				$('#detailsSlider').animate({ left:  '+=568px'}, 1000);
				slidePageDetails--;
			}
		} else {
			if(slidePageDetails < 3) {
				$('#detailsSlider').animate({ left:'-=568px' }, 1000);
				slidePageDetails++;
			}
		}
		return false;
	}
	
/*	

	jQuery.fn.displayPage = function(obj) {
		$(this).blur();
		var page = $(obj).attr('rev');
		if(page != currentPage) {
			$('#' + currentPage).slideUp(500);
			$('#' + page).slideDown(1000);
			currentPage = page;
		}
		
		return false;
	
	}
	
	
	jQuery.fn.networkInfo = function() {
		$(this).blur();
		var page2 = $(obj).attr('rev');
		if(page2 != currentPage2) {
			$('#' + currentPage2).fadeIn(slow);
			$('#' + page2).fadeOut(slow);
			currentPage = page2;
		}
		
		return false;
	
	}

*/



	jQuery.fn.famChan = function() {
		$(this).blur();
		if ($("#famChan").is(":!hidden")) {
			$("#famChan").slideUp("slow");
		}
		if ($("#famChan").is(":hidden")) {
			$("#famChanInfo").slideDown("slow");
			$("#famChan").slideDown("slow");
			$("#techChan").slideUp("slow");
		} else {
			$("#techChan").slideUp("slow");
		}
		return false;
	}

	jQuery.fn.techChan = function() {
		$(this).blur();
		if ($("#techChan").is(":!hidden")) {
			$("#techChan").slideUp("slow");
		}
		if ($("#techChan").is(":hidden")) {
			$("#techChanInfo").slideDown("slow");
			$("#techChan").slideDown("slow");
			$("#famChan").slideUp("slow");
		} else {
			$("#famChan").slideUp("slow");
		}
		$("#techChanInfo").slideDown("slow");
		return false;
	}

/*
	jQuery.fn.chanInfo = function() {
		if ($("#techChanInfo").is(":!hidden")) {
			$("#famChanInfo").slideUp("slow");
		}
		if ($("#famChanInfo").is(":!hidden")) {
			$("#techChanInfo").slideUp("slow");
		}
		return false;
	}

*/



	jQuery.fn.toggleDisplay = function() {
		$(this).blur();
		$('div[@title="toggle"]').slideUp(500);
		$('#' + $(this).attr('rev')).slideDown(500);
		return false;
	}







	$(document).ready( function() {
		$('a[@rel="slide"]').click( function() { return $(this).slideBox(); });
		$(this).fadeStatBox();
		$('a[@rel="details"]').click( function() { return $(this).slideDetails(); });
		$('a[@rev="fam"]').click( function() { return $(this).famChan(); });
		$('a[@rev="tech"]').click( function() { return $(this).techChan(); });
		$('a[@rel="toggle"]').click( function() { return $(this).toggleDisplay(); });
		//$('a').click( function() { return $(this).chanInfo(); });
		//$('a[@rel="nav"]').click( function() { return $(this).displayPage(this); });
		//$('a[@rel="network"]').click( function() { return $(this).networkInfo(this); });
	});
