$(document).ready(function() {

	// pseudo constants
		// whether there is a "back" button
		var backbutton = false;
		// whether the display of content is cyclic
		var turnaround = true;

		// internal functions
		function display_buttons() {
			if ((i == ($('.know_more_content').length) - 1) && ! turnaround) {
				$('#know_more_button').css("visibility", "hidden");
			} else {
				$('#know_more_button').css("visibility", "visible");
			}
			if ((i > 0) && backbutton) {
				$('#know_more_back_button').css("visibility", "visible");
			} else {
				$('#know_more_back_button').css("visibility", "hidden");
			}
		}

		function display_content(obj, i) {
			obj.html($('.know_more_content').eq(i).html());
			obj.fadeIn();
		}

		// paste the first content in the box
		$('.know_more_box').eq(0).html(
				"<div class='know_more_ship'>"
						+ $('.know_more_content').eq(0).html() + "</div>");
		// set index
		var i = 0;
		// make the box ready for interaction
		$('#know_more_button').eq(0).click(function() {
			$('.know_more_ship').eq(0).fadeOut('slow', function() {
				if (!turnaround) {
					if (i < $('.know_more_content').length - 1) {
						i++;
					}
				} else {
					i = (i + 1) % $('.know_more_content').length
				}
				display_buttons();
				display_content($(this), i);
			});
		});
		$('#know_more_back_button').eq(0).click(function() {
			$('.know_more_ship').eq(0).fadeOut('slow', function() {
				if (i > 0) {
					i--;
				}
				display_buttons();
				display_content($(this), i);
			});
		});
	});
