$(document).ready(function() {

	// resize the modal
        setTimeout(function(){

			//make sure the first field item is selected (if there is one.
			var firstField = $('input:visible,select:visible').get(0);
			if (firstField){
				firstField.focus();
			}
            paddingsize = 40;
            theHeight       = $('body').outerHeight()+paddingsize;
            if (theHeight > paddingsize) { // make sure that if things haven't fully loaded so we can't get a height, don't resize
                  try {
                    $(self.parent.document.getElementById('TB_iframeContent')).css('height', Math.max(200, Math.min(theHeight, 310)));
                  }catch(e){
                   //ignoring exception
                  }
            }

        }, 500);

});


