//	Site-wide Javascript functions

//	Note: If you plan to use jQuery, it must be wrappered inside an onReady function declaration


    $(document).ready(function(){
        // is ie
        if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) {
            // Fix for long text in select boxes in IEs
            // http://stackoverflow.com/questions/294040/how-to-expand-select-option-width-after-the-user-wants-to-select-an-option/1077314#1077314
            $('.fixLongSelect').wrap("<div class='selectWrapper'></div>");
            $('.selectWrapper').after("<div class=\"selectArrow\" onmouseout=\"nd();\" onmouseover=\"return overlib('Please click the text to make a selection');\" />");
            $('.selectWrapper').find('select').mousedown(function(){
                    $(this).parent().next().addClass('selectArrow-mousedown').removeClass('selectArrow-mouseover');
            }).
            mouseup(function(){
                    $(this).parent().next().removeClass('selectArrow-mousedown').addClass('selectArrow-mouseover');
            }).
            hover(function(){
                    $(this).parent().next().addClass('selectArrow-mouseover');
            }, function(){
                    $(this).parent().next().removeClass('selectArrow-mouseover');
            });

            $('.selectArrow').click(function(){
                    $(this).prev().find('select').focus();
                    $(this).prev().find('select').focus();
                    //alert('Please click the text to make a selection');
            });

            $('.selectArrow').mousedown(function(){
                    $(this).addClass('selectArrow-mousedown').removeClass('selectArrow-mouseover');
            }).
            mouseup(function(){
                    $(this).removeClass('selectArrow-mousedown').addClass('selectArrow-mouseover');
            }).
            hover(function(){
                    $(this).addClass('selectArrow-mouseover');
            }, function(){
                    $(this).removeClass('selectArrow-mouseover');
            });
        }
    });
