$(document).ready(function() { // $('#basic').hide(); // var jsonstring = $('#".$ia[1]."').val(); // var filecount = $('#".$ia[1]."_filecount').val(); // displayUploadedFiles(jsonstring, filecount, fieldname, show_title, show_comment, pos); $(function() { $('.upload').click(function(e) { e.preventDefault(); var $this = $(this); var show_title = getQueryVariable('show_title', this.href); var show_comment = getQueryVariable('show_comment', this.href); var pos = getQueryVariable('pos', this.href); var fieldname = getQueryVariable('fieldname', this.href); var buttonsOpts = {}; buttonsOpts[translt.returnTxt] = function() { // Fix for the IE bug 04965 var pass; if(document.getElementById('uploader').contentDocument) { if(document.getElementById('uploader').contentDocument.defaultView) { /*Firefox*/ pass=document.getElementById('uploader').contentDocument.defaultView.saveAndExit(fieldname,show_title,show_comment,pos); } else { /*IE8*/ pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos); } } else { /*IE6*/ pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos); } if (pass) { $(this).dialog('close'); $('iframe#uploader').remove(); $(this).dialog('destroy'); checkconditions(); } }; var horizontalPadding = 30; var verticalPadding = 20; $('#uploader').dialog('destroy'); // destroy the old modal dialog if ($('#uploader').length > 0) { $('iframe#uploader', parent.document).dialog({ title: translt.title, autoOpen: true, width: 984, height: 440, modal: true, resizable: true, autoResize: true, draggable: true, closeOnEscape: false, beforeclose: function() { var pass; if(document.getElementById('uploader').contentDocument) { if(document.getElementById('uploader').contentDocument.defaultView) { /*Firefox*/ pass=document.getElementById('uploader').contentDocument.defaultView.saveAndExit(fieldname,show_title,show_comment,pos); }else{ /*IE8*/ pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos); } }else{ /*IE6*/ pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos); } if (pass) { $('iframe#uploader').remove(); $(this).dialog('destroy'); checkconditions(); } return true; }, overlay: { opacity: 0.85, background: 'black' }, buttons: buttonsOpts }).width(984 - horizontalPadding).height(440 - verticalPadding); } else { $('