addLoadEvent( function() { theFileList = { currentImage: {ID: 0}, nonce: '', tab: '', postID: 0, initializeVars: function() { this.urlData = document.location.href.split('?'); this.params = this.urlData[1].toQueryParams(); this.postID = this.params['post_id']; this.tab = this.params['tab']; this.style = this.params['style']; this.ID = this.params['ID']; if ( !this.style ) this.style = 'default'; var nonceEl = $('nonce-value'); if ( nonceEl ) this.nonce = nonceEl.value; if ( this.ID ) { this.grabImageData( this.ID ); this.imageView( this.ID ); } }, initializeLinks: function() { if ( this.ID ) return; $$('a.file-link').each( function(i) { var id = i.id.split('-').pop(); i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); } } ); }, grabImageData: function(id) { if ( id == this.currentImage.ID ) return; var thumbEl = $('attachment-thumb-url-' + id); this.currentImage.isImage = true; if ( thumbEl ) { this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value ); this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value ); } else { this.currentImage.thumb = false; var isImageEl = $('attachment-is-image-' + id); if ( !isImageEl ) this.currentImage.isImage = false; } this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value ); this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value ); this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value ); this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value ); this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value ); var widthEl = $('attachment-width-' + id); if ( widthEl ) { this.currentImage.width = ( 0 == id ? '' : widthEl.value ); this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value ); } else { this.currentImage.width = false; this.currentImage.height = false; } this.currentImage.ID = id; }, imageView: function(id, e) { this.prepView(id); var h = ''; h += "