xx$(document).on('ready pjax:scriptcomplete', function () { doFileUpload(); fixParentHeigth(); }); function fixParentHeigth(fieldname, elementHeight) { fieldname = fieldname || ''; elementHeight = elementHeight || 0; if (window != top) { //~ frameheight=Math.max($(document).height(),$('html').outerHeight()+30,150); if (fieldname != '') { frameheight = Math.max($(document).height() + elementHeight, $('#field' + fieldname + '_listfiles').parent().height()); } else { frameheight = Math.max($(document).height() + elementHeight, 150); } if (jQuery.isFunction(parent.updateUploadFrame)) { parent.updateUploadFrame(window.name, frameheight); } } } function doFileUpload() { var fieldname = $('#ia').val(); /* Load the previously uploaded files */ var filecount = window.parent.window.$('#' + fieldname + '_filecount').val(); $('#' + fieldname + '_filecount').val(filecount); var image_extensions = new Array("gif", "jpeg", "jpg", "png", "swf", "psd", "bmp", "tiff", "jp2", "iff", "bmp", "xbm", "ico"); if (filecount > 0) { var jsontext = window.parent.window.$('#' + fieldname).val(); var json = eval('(' + jsontext + ')'); if ($('#field' + fieldname + '_listfiles').length == 0) { $("