$(document).ready(function() {
	var zoom_min = 1.1,
		zoom_max = 1.7,
		zoom_step = 0.1,
		zoom_reset = 1.4,
		zoom_current = 1.4,
		zoomable = document.getElementById('zoomable');

	// print action responder
	$('.toolbar .print').click(function() {
		window.print();
	});

	// text zoom stuff
	if (zoomable) {
		if (zoomable.style.fontSize && zoomable.style.fontSize.indexOf('em')) {
			zoom_reset = zoom_current = parseFloat(zoomable.style.fontSize);
			zoom_min = zoom_reset - 0.3;
			zoom_max = zoom_reset + 0.3;
		}

		$('.toolbar .zoom_reset').click(function() {
			zoom_current = zoom_reset;
			zoomable.style.fontSize = zoom_current + 'em';
		});

		$('.toolbar .zoom_in').click(function() {
			zoom_current = Math.round((zoom_current >= zoom_max ? zoom_max : zoom_current + zoom_step) * 10) / 10;
			zoomable.style.fontSize = zoom_current + 'em';
		});

		$('.toolbar .zoom_out').click(function() {
			zoom_current = Math.round((zoom_current <= zoom_min ? zoom_min : zoom_current - zoom_step) * 10) / 10;
			zoomable.style.fontSize = zoom_current + 'em';
		});
	}
});

