function closeLbox(){window.parent.WysijaPopup.close()}function unset(e){window.parent.removeImage(e)}function insert(e){window.parent.addImage(e),"undefined"!=typeof filesToAdd&&(1<filesToAdd?filesToAdd--:jQuery("#overlay").hide())}function hideShowOverlay(){if(window.parent.ajaxOver)formsubmit||jQuery("#overlay").hide();else if(formsubmit)return jQuery("#wysija-browse-form").submit(),formsubmit=!1}var formsubmit=!1;jQuery(function(i){i(".wysija-thumb").click(function(){return i(this).hasClass("selected")?(i(this).removeClass("selected"),unset("wp-"+i(this).find("span.identifier").html())):(i(this).addClass("selected"),insert({identifier:"wp-"+i(this).find("span.identifier").html(),width:i(this).find("span.width").html(),height:i(this).find("span.height").html(),url:i(this).find("span.url").html(),thumb_url:i(this).find("span.thumb_url").html()})),!0}),i("#wysija-close, #close-pop-alt").click(function(){return closeLbox(),!1}),i(".del-attachment").click(function(e){return e.stopPropagation(),confirm(wysijatrans.deleteimg)&&(i("#wysija-browse-form").append('<input type="hidden" name="subaction" value="delete" /><input type="hidden" name="imgid" value="'+parseInt(i(this).html())+'" /><input type="hidden" name="_wpnonce" value="'+wysijanonces.campaigns.sub_delete_image+'" />'),formsubmit=!0,unset("wp-"+i(this).html()),jQuery("#overlay").show(),window.parent.ajaxOver=!1,hideShowOverlay()),!1})});