/* JavaScript Document [j_text_size.js]
	Author: Claudio Nunez Jr.
	Entity: Rayhawk Corporation
	Copyright: 2010
	Requirements: jQuery [core: current release]
	Original Creation Date: 07.06.2010
	Last Update On: 07.06.2010
	Description:  Decreases, Increases, or Resets the current font-size by clicking on one of 3 respective buttons or links. */

var _DEFAULT_SIZE = 12; //[CONSTANT] - holds the default font size.
var _MIN_SIZE = 10; //[CONSTANT] - holds the minimum font size parameter.
var _MAX_SIZE = 21; //[CONSTANT] - holds the maximum font size parameter.
var currentSize = _DEFAULT_SIZE; //initializes this variable to the value of _DEFAULT_SIZE.

$(document).ready(function() {
	
	//sets our 3 buttons/links to have a hand pointer whenever the mouse hovers over them.
	$("#jDecrease").css("cursor", "pointer");
	$("#jReset").css("cursor", "pointer");
	$("#jIncrease").css("cursor", "pointer");
	
	//decreases the current font-size by 1 increment, and then assigns the new value to currentSize, but only if currentSize is greater than _MIN_SIZE.
	$("#jDecrease").click(function() {
		
		if (currentSize > _MIN_SIZE) {
			
			$(".jSizable").css("font-size", --currentSize);
		}
		
	});
	
	//resets the current font-size by assigning the value of _DEFAULT_SIZE to currentSize, but only if currentSize is not already equal to _DEFAULT_SIZE.
	$("#jReset").click(function() {
		
		if (currentSize != _DEFAULT_SIZE) {
		
			currentSize = _DEFAULT_SIZE;
			$(".jSizable").css("font-size", currentSize);
		}
		
	});
	
	//increases the current font-size by 1 increment, and then assigns the new value to currentSize, but only if currentSize is less than _MAX_SIZE.
	$("#jIncrease").click(function() {
		
		if (currentSize < _MAX_SIZE) {
		
			$(".jSizable").css("font-size", ++currentSize);
		}
		
	});
});
