JavaScript Resize Height Issue
<p>Im stuck on a JavaScript Issue, which I have no idea how to resolve.</p>

<p>I have a Contact Modal within a Blog: <a href="http://www.northernvirginiapaintingcontractor.com/blog" rel="nofollow">http://www.northernvirginiapaintingcontractor.com/blog</a>  Click "Send a Page"</p>

<p>When you click on this you will see the issue.  The Contact Modal doesn't open all of the way.</p>

<p>Compare that with the same "Send a Page" button on the Parent Application which functions normal. <a href="http://www.northernvirginiapaintingcontractor.com" rel="nofollow">http://www.northernvirginiapaintingcontractor.com</a></p>

<p>This utilizes a modified version of Eric Martin's Simple Modal.</p>

<p>The Contact.js was modified to enable dynamic height, as well as, several different Contact Modals to be utilized with the same script.</p>

<p>3 other .js files include:
actual.js
jquery-easing-1.3.pack.js
jquery-easing-compatibility.1.2.pack.js</p>

<p>Here is the contact.js that has the problem:  I don't have the slightest clue, if someone else does that would be great.</p>

<pre><code>jQuery(function ($) {
var contact = {
    message: null,
    init: function () {
        $('#contact-form input.contact, a.contact').click(function (e) {
            e.preventDefault();

            // Create the 1stModal dialog with the data

            $('#modal-contact-form').modal({
                closeHTML: "&lt;a href='#' title='Close' class='modal-close'&gt;Close Pager Modal&lt;/a&gt;",
                //maxHeight: 62,
                //maxWidth: 62,
                //minHeight: 62,
                //minWidth: 62,
                position: [98, 377],
                //autoPosition: false,
                autoResize: true,
                //overlayId: 'contact-overlay',
                containerId: 'contact-container',
                containerCss: { 'width': '350px'},
                onOpen: contact.open,
                onShow: contact.show,
                onClose: contact.close
            });
        });

        $('#contact-form input.suportecontacto, a.suportecontacto').click(function (e) {
            e.preventDefault();

            // Create the 2nd Modal dialog with the data

            $('#modal-soporte-form').modal({
                closeHTML: "&lt;a href='#' title='Close' class='modal-close'&gt;Close Ticket Modal&lt;/a&gt;",
                //maxHeight: 62,
                //maxWidth: 62,
                //minHeight: 62,
                //minWidth: 62,
                position: [98, 377],
                //autoPosition: false,
                autoResize: true,
                //overlayId: 'contact-overlay',
                containerId: 'contact-container',
                containerCss: { 'width': '350px' },
                onOpen: contact.open,
                onShow: contact.show,
                onClose: contact.close
            });
        });

        $('#contact-indivform input.indivcontacto, a.indivcontacto').click(function (e) {
            e.preventDefault();

            // Create the 3rd Modal dialog with the data

            $('#modal-indivcontact-form').modal({
                closeHTML: "&lt;a href='#' title='Close' class='modal-close'&gt;Close Contacto Modal&lt;/a&gt;",
                //maxHeight: 62,
                //maxWidth: 62,
                //minHeight: 62,
                //minWidth: 62,
                position: [98, 377],
                //autoPosition: false,
                autoResize: true,
                //overlayId: 'contact-overlay',
                containerId: 'contact-container',
                containerCss: { 'width': '350px' },
                onOpen: contact.open,
                onShow: contact.show,
                onClose: contact.close
            });
        });

        $('#HeadLogin').click(function (e) {
            e.preventDefault();

            // Create the Login modal

            $('#login_form').modal({
                closeHTML: "&lt;a href='#' title='Cerrar' class='modal-close' style='padding-right:15px'&gt;Cerrar Login Modal&lt;/a&gt;",
                //maxHeight: 62,
                //maxWidth: 62,
                //minHeight: 62,
                //minWidth: 62,
                position: [110, 364],
                //autoPosition: false,
                autoResize: true,
                //overlayId: 'contact-overlay',
                containerId: 'contact-container',
                containerCss: { 'width': '310px' },
                onOpen: contact.open,
                onShow: contact.login,
                onClose: contact.close
            });
        });
    },
    open: function (dialog) {
        $('#ajax_loading').hide();
        $('.simplemodal-wrap').css('overflow-x', 'visible').css('overflow-y', 'visible');
        // add padding to the buttons in firefox/mozilla
        if ($.browser.mozilla) {
            $('#contact-container .contact-button').css({
                'padding-bottom': '2px'
            });
        }
        // input field font size
        if ($.browser.safari) {
            $('#contact-container .contact-input').css({
                'font-size': '.9em'
            });
        }

        // Dynamically determine Modal Height

        //var h = 280;
        //var h = 220;
        //if ($('#contact-subject').length) {
        //    h += 26;
        //}
        //if ($('#contact-cc').length) {
        //    h += 22;
        //}

        var h = $('#contact-container form').actual('outerHeight') + 30;

        var title = $('#contact-container .contact-title').html();
        $('#contact-container .contact-title').html('Loading...');
        dialog.overlay.fadeIn(200, function () {
            dialog.container.fadeIn(200, function () {
                dialog.data.fadeIn(200, function () {
                    $('#contact-container .contact-content').animate({
                        height: h
                    }, function () {
                        $('#contact-container .contact-title').html(title);
                        $('#contact-container form').fadeIn(200, function () {
                            $('#contact-container #contact-name').focus();

                            $('#contact-container .contact-cc').click(function () {
                                var cc = $('#contact-container #contact-cc');
                                cc.is(':checked') ? cc.attr('checked', '') : cc.attr('checked', 'checked');
                            });

                            // fix png's for IE 6
                            if ($.browser.msie &amp;&amp; $.browser.version &lt; 7) {
                                $('#contact-container .contact-button').each(function () {
                                    if ($(this).css('backgroundImage').match(/^url[("']+(.*\.png)[)"']+$/i)) {
                                        var src = RegExp.$1;
                                        $(this).css({
                                            backgroundImage: 'none',
                                            filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '", sizingMethod="crop")'
                                        });
                                    }
                                });
                            }
                        });
                    });
                });
            });
        });
    },
    login: function() {
    $('#contact-container .contact-send').click(function (e) {
            e.preventDefault();
        // Hide 'Submit' Button
     if (contact.validateLogin()) {
        $('.contact-send').hide();
        $('.contact-cancel').hide();

        // Show Gif Spinning Rotator
        $('#ajax_loading').show();

        // 'this' refers to the current submitted form  
        var url ='';
        var str = $('#frmlogin').serialize();
        var path = window.location.pathname;
        var sub = 'Account';


        if(path.toUpperCase().indexOf(sub.toUpperCase()) != -1) {
            url = 'Login.aspx';
            var image = $('#ajax_loading img');
            image.attr('src','../images/spinner.gif');
        }
        else {
            url = 'Account/Login.aspx';
        }

        // -- Start AJAX Call --
        var form = $('#status form');
        $.ajax({
            type: "POST",
            //url: form[0].action,
            url: url,
            data: str,
            success: function (msg) {


            $("#status").ajaxComplete(function (event, request, settings) {

                // Show 'Submit' Button
                $('.contact-send').show();
                $('.contact-cancel').show();
                // Hide Gif Spinning Rotator
                $('#ajax_loading').hide();

                if (msg != 'False') // LOGIN OK?
                {
                    var login_response = '&lt;div style="color:green; margin: 1px; float: right; width: 300px;"&gt;Ya Estás Conectado!&lt;br /&gt;Por favor, espera mientras estas redirigido...&lt;/div&gt;';
                    $('.contact-title').hide();

                    $('a.modalCloseImg').hide();
                    $('#frmlogin').hide();

                    $('#simplemodal-container').css("width", "500px");
                    $('#simplemodal-container').css("height", "140px");

                    $('#login_form .contact-message').html(login_response).show();      // Refers to 'status'

                    // After 1 second redirect the Logged-in User 
                    setTimeout(contact.redirect, 500);
                }
                else // ERROR?
                {
                    $('#login_form .contact-content').css("height", "150px");

                    $('#login_form .contact-message').html("Login failed!").css('color','red').show();
                }

            });

        }

    });
    }
    // -- End AJAX Call --

    else {
                if ($('#login_form .contact-message:visible').length &gt; 0) {
                    var msg = $('#login_form .contact-message div');
                    msg.fadeOut(200, function () {
                        msg.empty();
                        contact.showError();
                        msg.fadeIn(200);
                    });
                }
                else {
                    $('#login_form .contact-message').animate({
                        height: '30px'
                    }, contact.showError);
                }

            }
    });


    },
    redirect: function() {
        window.location = '/'; // Members Area
    },
    show: function (dialog) {
        $('#contact-container .contact-send').click(function (e) {
            e.preventDefault();

            var form = $('#contact-container form');

            // validate form
            if (contact.validate()) {
                var msg = $('#contact-container .contact-message');
                msg.fadeOut(function () {
                    msg.removeClass('contact-error').empty();
                });
                $('#contact-container .contact-title').html('Sending...');
                $('#contact-container form').fadeOut(200);

                $('#contact-container .contact-content').animate({
                    height: '80px'
                }, function () {

                    var uname = $('#contact-container #contact-name').val();
                    var email = $('#contact-container #contact-email').val();
                    var cntx = $('#contact-container #contact-message').val();

                    var docc = "false";
                    if ($('#contact-container #contact-cc').is(':checked')) {
                        docc = "true";
                    }

                    $.ajax({
                      url: "blog/api/Blogs.asmx/SendMail",
                      data: "{'uname':'" + uname + "', 'email':'" + email + "','cntx':'" + cntx + "','docc':'" + docc + "'}",
                      type: "POST",
                      contentType: "application/json",
                      success: function (msg) {
                         //contact.close(dialog);
                         $('#contact-container .contact-loading').fadeOut(200, function () {
                            $('#contact-container .contact-title').html('Thank you!');
                            msg.html(data).fadeIn(200);
                            setTimeout(function () {
                                contact.close(dialog);
                            }, 1500);
                        });
                      }
                   });

                    contact.close(dialog);
                });
            }
            else {
                if ($('#contact-container .contact-message:visible').length &gt; 0) {
                    var msg = $('#contact-container .contact-message div');
                    msg.fadeOut(200, function () {
                        msg.empty();
                        contact.showError();
                        msg.fadeIn(200);
                    });
                }
                else {
                    $('#contact-container .contact-message').animate({
                        height: '30px'
                    }, contact.showError);
                }
            }
        });
    },


    close: function (dialog) {

        $('#contact-container .contact-message').fadeOut();
        $('#contact-container .contact-title').html('Closing...');
        $('#contact-container form').fadeOut(200);

        $('#contact-container .contact-content').animate({
            height: 40
        }, function () {
            dialog.data.fadeOut(200, function () {
                dialog.container.fadeOut(200, function () {
                    dialog.overlay.fadeOut(200, function () {
                        $.modal.close();
                    });
                });
            });
        });
    },
    error: function (xhr) {
        alert(xhr.statusText);
    },
    validateLogin: function () {
        contact.message = '';

        if (!$('#username').val()) {

             contact.message += 'User name is required. ';
        }

        var pass = $('#password').val();
        if (!pass) {

            contact.message += 'Password is required. ';
        }
        if (contact.message.length &gt; 0) {
            return false;
        }
        else {
            return true;
        }

    },
    validate: function () {
        contact.message = '';
        if (!$('#contact-container input[name="name"]').val()) {
            contact.message += 'Name is required. ';
        }

        var email = $('#contact-container input[name="email"]').val();
        if (!email) {
            contact.message += 'Email is required. ';
        }
        else {
            if (!contact.validateEmail(email)) {
                contact.message += 'Email is invalid. ';
            }
        }

        if (!$('#contact-container textarea[name="message"]').val()) {
            contact.message += 'Message is required.';
        }

        if (contact.message.length &gt; 0) {
            return false;
        }
        else {
            return true;
        }
    },
    validateEmail: function (email) {
        var at = email.lastIndexOf("@");

        // Make sure the at (@) sybmol exists and  
        // it is not the first or last character
        if (at &lt; 1 || (at + 1) === email.length)
            return false;

        // Make sure there aren't multiple periods together
        if (/(\.{2,})/.test(email))
            return false;

        // Break up the local and domain portions
        var local = email.substring(0, at);
        var domain = email.substring(at + 1);

        // Check lengths
        if (local.length &lt; 1 || local.length &gt; 64 || domain.length &lt; 4 || domain.length &gt; 255)
            return false;

        // Make sure local and domain don't start with or end with a period
        if (/(^\.|\.$)/.test(local) || /(^\.|\.$)/.test(domain))
            return false;

        // Check for quoted-string addresses
        // Since almost anything is allowed in a quoted-string address,
        // we're just going to let them go through
        if (!/^"(.+)"$/.test(local)) {
            // It's a dot-string address...check for valid characters
            if (!/^[-a-zA-Z0-9!#$%*\/?|^{}`~&amp;'+=_\.]*$/.test(local))
                return false;
        }

        // Make sure domain contains only valid characters and at least one period
        if (!/^[-a-zA-Z0-9\.]*$/.test(domain) || domain.indexOf(".") === -1)
            return false;

        return true;
    },
    showError: function () {
        $('#contact-container .contact-message')
            .html($('&lt;div class="contact-error"&gt;&lt;/div&gt;').append(contact.message))
            .fadeIn(200);
    }
};

contact.init();

});
</code></pre>
