function setHookOnSubmit(formName) { 
    var cx = 0;
    for (cx = 0; cx < window.frames.length; cx++) {
        //We need to put a try-catch in case an external iframe is on the page
        try {
            if ( window.frames[cx].name == formName ) {
                ///is the submit
                var cnForm = window.frames[cx].document.forms.length;
                var curFrame = window.frames[cx];
                var cxF = 0;
                
                for (cxF=0; cxF < cnForm; cxF++) {
                    var curForm = curFrame.document.forms[cxF];
                    
                    curForm.onsubmit = function() { 
                        curForm.target = "_parent";
                        window.scrollTo(0,0); 
                        return true; 
                    }   //end function onsubmit                
                }   //end for
            }   //end if
        } catch (err) { continue }
    }   //end for
}

function autoCalcHeight(iframeId) {
    try {

        //find the height of the internal page
        var the_height = document.getElementById(iframeId).contentWindow.document.body.scrollHeight;
        var the_height2 = document.getElementById(iframeId).contentWindow.document.body.parentNode.clientHeight;

        // fix for FireFox (in FireFox scrollHeight gives a value larger than clientHeight
        if (!jQuery.browser.msie) {
            if (parseInt(the_height2) < parseInt(the_height))
                the_height = the_height2;
        }

        //change the height of the iframe
        document.getElementById(iframeId).height = the_height;
        document.getElementById(iframeId).style.height = the_height + 'px';
    } catch (err) { }
}

