var CR_Rotator = function(interval, fade) {
	this.interval = interval?interval:10000;
	this.fade = fade?fade:3000;
	this.curr_item = 0;
}
CR_Rotator.prototype.rotate = function() {
	var elems = $('.cr-content .the-content');
	for (var i = 0; i < elems.length; i++) {
		if ($(elems[i]).is(':visible')) {
			this.curr_item = i;
			$(elems[this.curr_item]).hide();
			break;
		}
	}
	this.curr_item++;
	if (this.curr_item >= elems.length) {
		this.curr_item = 0;
	}
	$(elems[this.curr_item]).fadeIn(this.fade);
}
CR_Rotator.prototype.init = function() {
	console.log('initting');
	if($('.cr-content .the-content')) {
		if ($('.cr-content .cr-interval')) {
			this.interval = parseInt($('.cr-content .cr-interval').html());
		}
	}
	if ($('.cr-content .cr-fade')) {
		this.fade = parseInt($('.cr-content .cr-fade').html());
		console.log(this.fade);
	}
}
$(document).ready(function() {
	// cr_rotator_init();
	var crr = new CR_Rotator();
	crr.init();
	setInterval(function(){crr.rotate()}, crr.interval);
});
