/*
  Copyright (C) 2003, 2004 Dana Dahlstrom
  (http://www.cs.ucsd.edu/users/ddahlstr/) and Vinu Somayaji
  (http://www.cs.ucsd.edu/users/vsomayaj/).

  This file is part of Semiotics and UID.

  Semiotics and UID is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  Semiotics and UID is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with Semiotics and UID; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

var glossary;
var glossary_width = 320;
var glossary_height = 240;

function show_term(term, x1, y1)
{
  var y2 = -1;
  
  if(glossary && !glossary.closed) {
    glossary.location = "glossary.php?term=" + term;
  }
  else {
    glossary = window.open("glossary.php?term=" + term, "glossary",
      "height=" + glossary_height + ",resizable=yes,scrollbars=yes,"
      + "toolbar=yes,width=" + glossary_width);
  }
  
  /* If it is small enough to move, do it */
  /*
  if(glossary_width < screen.availWidth / 2
    && glossary_height < screen.availHeight / 2) {
    if(y1 - 50 > glossary_height) {
    	y2 = y1 - 50 - glossary_height;
    }
    else if(y1 + 50 + glossary_height < screen.availHeight) {
      y2 = y1 + 50;
    }

    if(y2 != -1) {
    	if(x1 + glossary_width + 50 < screen.availWidth) {
    	  glossary.moveTo(x1, y2);
    	}
    	else {
    	  glossary.moveTo(screen.availWidth - glossary_width - 50, y2);
    	}
    }
  }
  */ 
  glossary.focus();
}
