﻿/* sitewide functions for butler pappas site 
 * started 05/27/2011, Brian
 */

 // restrict jquery framerate a bit
 jQuery.fx.interval = 25;

$(document).ready(function () {
    // make sure our shared strip texts have spans inside
    $('.sharedstriptext').each(function () {
        if ($(this).children('span').length == 0) {
            $(this).wrapInner('<span />');
        }
    });
});

$(window).load(function() {
    // make sure our content area isn't too short
    var maincontentelement = $('.pagebodymain');
    var leftcolumnheight = $('.pagebodyleft').outerHeight();
    if ( maincontentelement.outerHeight() < leftcolumnheight ) {
        maincontentelement.css('height',(leftcolumnheight)+'px').resize();
    }
});



// add enter-to-submit functionality to an element, pass in the element you wish to be 'clicked' when enter is pressed
// crafted by Brian 01/13/2011, tested on jQuery 1.4.4
jQuery.fn.satEnterSubmit = function (submitelement) {
    jQuery(this).keypress(function (e) {
        if (e.keyCode == 13) {
            jQuery(submitelement).click();
            return false;
        }
    });
};

