function popWin(URL,WD,HG) {
var strOptions = "width=" + WD + ",height=" + HG +
",toolbar=no,menubar=no,status=no,resize=no,resizable=no,directories=no,scrollbars=yes";
aWindow = window.open(URL, "popUp", strOptions);
}

    function setCookie(cookieName, cookieValue, cookiePath, cookieExpires) 
      { 
        cookieValue = escape(cookieValue); 
        if (cookieExpires == "") 
          { 
            var nowDate = new Date(); 
            nowDate.setMonth(nowDate.getMonth() + 6); 
            cookieExpires = nowDate.toGMTString(); 
          }

        if (cookiePath != "") 
          {
            cookiePath = ";Path=" + cookiePath; 
          } 

       document.cookie = cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath; 
      } 

    function getCookieValue(name) 
      { 
        var cookieString = document.cookie; 
        var index = cookieString.indexOf(name + "="); 

        if (index == -1) return null; 

        index = cookieString.indexOf("=", index) + 1; 
        var endstr = cookieString.indexOf(";", index); 

        if (endstr == -1) endstr = cookieString.length; 

        return unescape(cookieString.substring(index, endstr)); 
      } 

	function OpenWin(URL, winName, width, height, scroll)
		{
			var winLeft = (screen.width - width) / 2;
			var winTop = (screen.height - height) / 2;
					
			winData = 'height='+height+',width='+width+',top='+winTop+',left='+winLeft+',scrollbars='+scroll+',resizable';
			win = window.open(URL, winName, winData);
					
			if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
		}

  function DoPopupNL()
    {
      var NL = getCookieValue('majestic'); 

      if(NL == null)
        {
          // Show the newsletter signup popup
          setCookie('majestic', 'true', '', '');
          OpenWin('http://www.lit.org/ezine.php', 'popupNL', 500, 400, 'no');          
        }
    }


//active dictionary
document.onkeypress = keyhandler;

function findSelection()
{
	if (document.getSelection) txt = document.getSelection();
	else if (document.selection) txt = document.selection.createRange().text;
	else return "";
	return txt;
};

function keyhandler(e) {
    if (window.event) 
    	Key = window.event.keyCode;
    else 
        Key = e.which;

    if (Key == 100) { 
    	var result = findSelection();
        if(result.length && result.length < 125) 
        	var toast = window.open('http://www.lit.org/dictionary/index.php?database=all&define=Define&define=Define&_fields=term%3Adatabase%3Adefine&term='+escape(result)+'&pop=1','0','toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=600,height=500,left=280,top=80');
 
        	
     }
};