jQuery(document).ready(function($){

    //alert($('html').css('font-size'));

    $("area.small").click(function(){
          $("body").css('font-size','78%');
          $.ajax({ url: "/wp-content/themes/his/includes/set-persistent-fontsize.php", data: {font_size: 78} });
          return false;
      });
    $("area.medium").click(function(){
        $("body").css('font-size','100%');
        $.ajax({ url: "/wp-content/themes/his/includes/set-persistent-fontsize.php", data: {font_size: 100} });
        return false;
    });
    $("area.large").click(function(){
        $("body").css('font-size','122%');
        $.ajax({ url: "/wp-content/themes/his/includes/set-persistent-fontsize.php", data: {font_size: 122} });
        return false;
    });

/*
	// Setup base variable to track font size
	var checkFontSizeLrg = 1;
	var checkFontSizeSml = 1;

        var originalFontSize = $('html').css('font-size');
        var currentFontSize = originalFontSize;
        
        $.ajax({
            url: "/wp-content/themes/his/includes/inc_fontsize.php",
            data: {action: 'get'},
            success: function(data){
                alert("DATA: " + data);
                //var currentFontSize = parseFloat(data,10);
                //if(currentFontSize > 0){
                //    alert(currentFontSize);
                //    $('html').css('font-size', currentFontSize);
                //}else{
                //    alert('Less than 0: ' + currentFontSize);
                //}
            }
        });       
	
	// RESET FONT SIZE
	
	$(".resetFont").click(function(){
		// Reset counters
		checkFontSizeLrg = 1;
		checkFontSizeSml = 1;
		$('html').css('font-size', originalFontSize);
	});
	
	// INCREASE FONT SIZE
	$(".increaseFont").click(function(){

		checkFontSizeLrg++;
		checkFontSizeSml - 1;

		if (checkFontSizeLrg < 3) {
		
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*1.2;
		$('html').css('font-size', newFontSize);
                $.ajax({
                    url: "/wp-content/themes/his/includes/inc_fontsize.php",
                    data: {action: 'set', his_fontsize:newFontSize}
                });
		return false;
		
		}

	});
	
	// DECREASE FONT SIZE
	$(".decreaseFont").click(function(){

		checkFontSizeSml++;
		checkFontSizeLrg - 1;
		
		if (checkFontSizeSml < 3) {
	
		var currentFontSize = $('html').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = currentFontSizeNum*0.8;
		$('html').css('font-size', newFontSize);
                $.ajax({
                    url: "/wp-content/themes/his/includes/inc_fontsize.php",
                    data: {action: 'set', his_fontsize:newFontSize}
                });
		return false;
		
		}

	});
*/
});
