function showCenteredPopup(href, wnd_width, wnd_height) {
  try {
    var wnd_left = Math.round((screen.width-wnd_width)/2);
    var wnd_top = Math.round((screen.height-wnd_height)/2)-20;

    window.open(href, "", "width="+wnd_width+",height="+wnd_height+",left="+wnd_left+",top="+wnd_top+",scrollbars=yes,statusbar=no,resizable=yes");
  } catch(e) { alert(e.message); }
}


function openLinkInOpener(link) {
  try {
      if (window.opener) {
        window.opener.location.href = link.href;
      	window.close();
      	return false;
      } else {
	    link.target = "_blank";
		window.close();
    	return true;
      }
  } catch(e) {}

  return true;
}

function addFirefoxSearchEngine()
{
	try {
    if ((typeof window.sidebar == "object") && (typeof window.sidebar.addSearchEngine == "function"))
    {
        window.sidebar.addSearchEngine(
            "http://www.imagevortex.com/downloads/firefox/search_plugin/imagevortex.src",  /* engine URL */
            "http://www.imagevortex.com/downloads/firefox/search_plugin/imagevortex.gif",  /* icon URL */
            "ImageVortex.com",                                         /* engine name */
            "Web" );                                               /* category name */
    }
    else
    {
        alert("A Mozilla based browser is required to add a search engine.");
    }
	
	}
	catch (e) {
		alert("An error happened while trying to install search engine");
	}
}
