﻿$(document).ready(function()
{       
    //*************************************************************************
    //Created By:   Jeff Richmond
    //Created Date: 2008.10.08
    //Section Name: New window links
    //Description:  sets up newWin links to open in a new window.
    //*************************************************************************
    $('.newWin').each(function()
    {
        //add a notice to the title attribute
        if (this.title == "") { this.title = "(new window)"; }
        else { this.title = this.title + " (new window)"; }
        
        //add the click event
        $(this).click( function(e)
        {
            if(!e)e = window.event;
            if(e.shiftKey || e.ctrlKey || e.altKey) return;
            window.open(this.href);
            return false;
        });
    });//End newWin Links
    
       
    //*************************************************************************
    //Created By:   Jeff Richmond
    //Created Date: 2008.06.12
    //Section Name: Default Form Buttons
    //Description:  Associates the enter key with a default button for each
    //              sub form
    //*************************************************************************
        $('.SubForm').each( function()
            {
                $(this).keypress( function(e)
                    {
                        if (((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) && e.target.type != 'textarea')
                        {
                            $(this).find('.Default').click();
                            return false;
                        } 
                        else return true;
                    }
                );
            }
        ); //End Default Buttons
});