function HelpWindow(PageName){
	newwin=window.open(PageName,"Help","height=600,width=480, toolbar=no, menubar=no, scrollbars=yes,resizable=yes");
}

function LogOut_onclick(TermURL) {
location.href=TermURL + '/Logout.asp'
}

//var URL = TermURL + '/DictMgt.asp?SD=' + DictID + '&DictMode=EditDict' + '&EditMode=Descript'
function DeleteEntry(TermURL) {
	if (document.EntryForm.SelectedEntryID.value==0) {
		var theResponse = window.alert("Nothing to delete!");
	}
	else {
		var theResponse = window.confirm("You are about to remove entry #" + document.EntryForm.SelectedEntryID.value + ". Do you really want to remove the whole entry?");
		if (theResponse) {
			theResponse = window.confirm("Are you sure? Click OK to delete the whole entry.");
			if (theResponse) {
				location.href=TermURL + '/DictEdit.asp?EID=' + document.EntryForm.SelectedEntryID.value  + '&RIF=' + document.EntryForm.SelectedIndexFieldID.value + '&Mode=DeleteField' + '&EFN=Entry&EFID=0&DID=' + document.EntryForm.DictionaryID.value
			}
		}
	}
}

function EditEntry(TermURL) {
	if (document.EntryForm.SelectedEntryID.value==0) {
		var theResponse = window.alert("Nothing to edit! Please select an entry to edit.");
	}
	else {
		location.href=TermURL + '/DictEdit.asp?EID=' + document.EntryForm.SelectedEntryID.value + '&DID=' + document.EntryForm.DictionaryID.value + '&RIF=' + document.EntryForm.SelectedIndexFieldID.value
	}
}

function NewEntry(TermURL) {
	if (document.EntryForm.DictionaryID.value==0) {
		var theResponse = window.alert("Please select a dictionary!");
	}
	else {
		location.href=TermURL + '/DictEdit.asp?EID=0&RIF=0&DID=' + document.EntryForm.DictionaryID.value + '&NewMode=New'
	}
}

function QuickEntry(TermURL) {
	if (document.EntryForm.DictionaryID.value==0) {
		var theResponse = window.alert("Please select a dictionary!");
	}
	else {
		location.href=TermURL + '/DictEdit.asp?EID=0&RIF=0&DID=' + document.EntryForm.DictionaryID.value + '&NewMode=Quick'
	}
}

function SelectDict_onclick(TermURL, DictID) {
	location.href=TermURL + '/DictMgt.asp?DictMode=SelectDict&SD=' + DictID
}

function DeleteEntry_onclick(EID, RIF, DID, TermURL) {
	var theResponse = window.confirm("You are about to remove this entry. \rDo you really want to remove the whole entry?");
	if (theResponse) {
		theResponse = window.confirm("Are you sure? Click OK to delete the whole entry.");
		if (theResponse) {
			location.href=TermURL + '/DictEdit.asp?DID=' + DID + '&EID=' + EID + '&RIF=' + RIF + '&Mode=DeleteField' + '&EFN=Entry&EFID=0'
		}
	}
}

function DeleteDict_onclick(DictID, TermURL) {
	var theResponse = window.confirm("You are about to remove this dictionary. \rDo you really want to remove the whole dictionary?");
	if (theResponse) {
		theResponse = window.confirm("Are you sure? This action is irreversable. \rClick OK to delete the whole dictionary.");
		if (theResponse) {
			location.href=TermURL + '/DeleteDict.asp?SD=' + DictID
		}
	}
}

function EditDict_onclick(DictID, TermURL) {
	var newWindow;
	var URL = TermURL + '/DictMgt.asp?SD=' + DictID + '&DictMode=EditDict&EditMode=Descript'
	//var props = 'scrollBars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes,directories=yes,width=800,height=600,top=0,left=0';
	//newWindow = window.open(URL, 'Dictionary_Editing', props);
	location.href = URL;
}
/* ie-activex fix taken from http://activecontent.blogspot.com/ */
var bo_ns_id = 0;

function ieFixStart()
{
  if(isIE())
  {
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}
function ieFixEnd()
{
  if(isIE())
  {
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"));
    document.write(theCode);
  }
}
function isIE()
{
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0)
  {
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6)
    {
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 || strBrwsr.indexOf("win 9x 4.90") > -1 
      || strBrwsr.indexOf("winnt4.0") > -1 || strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }
  else
  {
    return false;
  }
}
/* end of ie activex fix */

function SelectDictionaries () {
  var f = document.getElementById ("frmSelDict");
  
  if (f) {
    var url = "/term/DictMgt.asp?DictMode=SelectDict";

    var sd  = document.getElementById ("SD");
    if (sd) {
      if (sd.selectedIndex > -1) {
        url += "&SD=" + sd.options[sd.selectedIndex].value;
      }
    }
    var st1 = document.getElementById ("ShowStructure1");
    var st2 = document.getElementById ("ShowStructure2");
    if (st1 && st2) {
      if (st1.checked) {
        url += "&ShowStructure=" + st1.value;
      }
      if (st2.checked) {
        url += "&ShowStructure=" + st2.value;
      }
    }
    var ls = document.getElementById ("fSrc");
    if (ls) {
      if (ls.selectedIndex > 0) {
        url += "&lns=" + ls.options[ls.selectedIndex].value;
      }
    }
    var lt = document.getElementById ("fTrg");
    if (lt) {
      if (lt.selectedIndex > 0) {
        url += "&lnt=" + lt.options[lt.selectedIndex].value;
      }
    }
    
  location.href = url;
  }
}


