diff --git a/chrome/content/zotero/advancedSearch.js b/chrome/content/zotero/advancedSearch.js
index 58e6ccb69..1a841dd61 100644
--- a/chrome/content/zotero/advancedSearch.js
+++ b/chrome/content/zotero/advancedSearch.js
@@ -116,6 +116,7 @@ var ZoteroAdvancedSearch = new function() {
}
lastWin.ZoteroPane.selectItem(item.getID(), false, true);
+ lastWin.focus();
}
}
}
diff --git a/chrome/content/zotero/advancedSearch.xul b/chrome/content/zotero/advancedSearch.xul
index 8371a3c18..1ff0c343c 100644
--- a/chrome/content/zotero/advancedSearch.xul
+++ b/chrome/content/zotero/advancedSearch.xul
@@ -17,7 +17,8 @@
persist="screenX screenY width height"
onload="ZoteroAdvancedSearch.onLoad()"
onunload="ZoteroAdvancedSearch.onUnload()"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ windowtype="zotero:search">
diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js
index 8ac07e88e..6c7f31826 100644
--- a/chrome/content/zotero/overlay.js
+++ b/chrome/content/zotero/overlay.js
@@ -450,6 +450,18 @@ var ZoteroPane = new function()
function openAdvancedSearchWindow() {
+ var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Components.interfaces.nsIWindowMediator);
+ var enumerator = wm.getEnumerator('zotero:search');
+ while (enumerator.hasMoreElements()) {
+ var win = enumerator.getNext();
+ }
+
+ if (win) {
+ win.focus();
+ return;
+ }
+
var s = new Zotero.Search();
s.addCondition('title', 'contains', '');
var io = {dataIn: {search: s}, dataOut: null};