// Copyright (c) 2010 Javier Aguilar//// Permission is hereby granted, free of charge, to any person// obtaining a copy of this software and associated documentation// files (the "Software"), to deal in the Software without// restriction, including without limitation the rights to use,// copy, modify, merge, publish, distribute, sublicense, and/or sell// copies of the Software, and to permit persons to whom the// Software is furnished to do so, subject to the following// conditions://// The above copyright notice and this permission notice shall be// included in all copies or substantial portions of the Software.//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR// OTHER DEALINGS IN THE SOFTWARE.(function($) {    $.font = {        version: '0.9.8',        settings: {            units: '%',            defaultSize: 75, //75% equals to 12px and 1em, therefore 2em = 24px            currentSize: 75,            maxSize: 150,            minSize: 40,            zoomStep: 10        },        zoom: function(newSize, element) {            element = $(element).get(0) || document.body;            newSize = (isNaN(newSize) || (newSize > this.settings.maxSize) || (newSize < this.settings.minSize))                ? this.settings.defaultSize : newSize;            if ((this.settings.units != 'em') || (this.settings.units != '%')) {                this.settings.units = '%';            }            if (element.style != undefined) {                element.style.fontSize = newSize + this.settings.units;                this.settings.currentSize = parseInt(newSize);            }            return this.settings.currentSize;        },        zoomIn: function(element) {            element = element || document.body;            if (this.settings.currentSize <= this.settings.maxSize) {                this.settings.currentSize += this.settings.zoomStep;                this.zoom(this.settings.currentSize, element);            } else {                this.zoom(this.settings.defaultSize, element);            }            return this.settings.currentSize;        },        zoomOut: function(element) {            element = element || document.body;            if (this.settings.currentSize >= this.settings.minSize) {                this.settings.currentSize -= this.settings.zoomStep;                this.zoom(this.settings.currentSize, element);            } else {                this.zoom(this.settings.defaultSize, element);            }            return this.settings.currentSize;        }    }    $.fn.fontZoom = function(newSize) {        $.font.zoom(newSize, this);        return this;    }    $.fn.fontZoomIn = function() {        $.font.zoomIn(this);        return this;    }    $.fn.fontZoomOut = function() {        $.font.zoomOut(this);        return this;    }})(jQuery);
