/*
* Love Your Liver Website Main Javascript Library
* Squiz Canberra
* July 2011
* This file assumes that jQuery framework has already been loaded.
* Use 'jQuery' instead of '$' to avoid other framework conflicts e.g. prototype uses '$'.
* 
* Modification history:
* 
* 2011-07-01: Squiz
*             - File creation and initial object/function creation.
*
*/


var GlobalScripts = {
    
    
    /**
     * Generic form controls.
     */
    genericFormControls: function()
    {
        
        var self = this;
        
        // Replace any default text in input text boxes if marked with related class.
        jQuery("#main input[type=text].replace-default").focus(function() {
            if( this.value === this.defaultValue ) {
                this.value = "";
            }
        }).blur(function() {
            if( !this.value.length ) {
                this.value = this.defaultValue;
            }
        });
        
        // Set remove class on inputs when clicked/focussed - for IE7 only.
        jQuery("#main input, #main textarea").focus(function() {
            jQuery(this).addClass('focus');
        }).blur(function() {
            jQuery(this).removeClass('focus');
        });
        
        
    }, // genericFormControls.
    
    /**
     * Generic form controls.
     */
    globalNavigationControls: function()
    {
        
        var self = this;
        
        // FB link.
        jQuery('#fb-link').hover(
            function () {
                jQuery(this).animate({height:'56px'});
            },
            function () {
                jQuery(this).animate({height:'46px'});
            }
        ); // End hover.
        
        
    }, // globalNavigationControls.
    
    /**
     * Generic content manipulation.
     */
    contentManipulation: function()
    {
        
        var self = this;
        
        // Table styling.
        jQuery('#main .zebra-table tr:not(:first):odd').addClass('odd');
        jQuery('#main .zebra-table tr:not(:first):even').addClass('even');
        
        
    } // contentManipulation.
    
    
    
}; // End GlobalScripts.

jQuery(document).ready( function() {
        
    GlobalScripts.genericFormControls();
    GlobalScripts.globalNavigationControls();
    GlobalScripts.contentManipulation();
    
}); // End DOM ready.


