﻿$(document).ready(
    function() 
    { 
        //############################################################
        // Handle form style switching and confirmation message fading
        //############################################################
        $("p.formContainer").children().focus(    
            function () 
            { 
                $(this).parent("p.formContainer").css("background-color","#FEF9D6");
            }
        );
        
        $("p.formContainer").children().blur(    
            function () 
            { 
                $(this).parent("p.formContainer").css("background-color","#E6E2E0");
            }
        );
        
        $("p.formContainer").click(    
            function () 
            { 
                $("p.formContainer").css("background-color","#E6E2E0");
                $(this).css("background-color","#FEF9D6");
            }
        ); 
        
        $(".fadeIn").fadeIn("slow");     

        //############################################################
        // Charity panel toggle code
        //############################################################
        $("#aCharityWorldVision").click(   
            function () 
            { 
                $("#divCharityTraid").hide();
                $("#divCharityWorldVision").toggle();
            }
        );
        
        $("#aCharityTraid").click(   
            function () 
            { 
                
                $("#divCharityWorldVision").hide();
                $("#divCharityTraid").toggle();
            }
        );
    }
);    

//############################################################
// Stop the enter key being used
//############################################################
var nav = window.Event ? true : false;

if (nav) {
    window.captureEvents(Event.KEYDOWN);
    window.onkeydown = NetscapeEventHandler_KeyDown;
    } else {
    document.onkeydown = MicrosoftEventHandler_KeyDown;
}

function NetscapeEventHandler_KeyDown(e) {
    if (e.which == 13 && e.target.type != 'textarea' && e.target.type != 'submit') { return false; }
    return true;
}

function MicrosoftEventHandler_KeyDown() {
    if (event.keyCode == 13 && event.srcElement.type != 'textarea' && event.srcElement.type != 'submit')
    return false;
    return true;
} 