/*  $Id$
 *  
 *  This file is part of the Jamiedia Toolkit.
 *  Copyright 2007/2008, Jamiedia Ltd., http://www.jamiedia.co.uk
 *  
 *  This file may not be used or (re)distributed for any other
 *  purposes than a commercial deployment by Jamiedia of a system
 *  based on the Jamiedia Toolkit. No modifications may be made to
 *  this file by anyone, except for individuals working for Jamiedia Ltd.
 *
 *  File description:
 *
 */ 

(function() {
    $(document).ready(function() {
        var controlButtons = $('#control-buttons');
        var content = $('#content');
        var factor = 1.2;
        var startSize, size;
        
        startSize = content.css('font-size');
        var unit = startSize.slice(-2);
        startSize = parseFloat(startSize, 10);
        size = startSize;

        // Update size
        var updateSize = function() {
            content.css('font-size', size+unit);
        }
        
        // Bind the reset font size button
        $('a.zoomreset', controlButtons).click(function() {
            size = startSize;
            updateSize();
            return false;
        });
        
        // Bind the print button
        $('a.print', controlButtons).click(function() {
            window.print();
            return false;
        });
        
        // Bind the zoom out button
        $('a.zoomout', controlButtons).click(function() {
            size /= factor;
            updateSize();
            return false;
        });
        
        // Bind the zoom in button
        $('a.zoomin', controlButtons).click(function() {
            size *= factor;
            updateSize();
            return false;
        });
    });
})();
