<!--
if (navigator.product == 'Gecko')
{

HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) 
{
   var r = this.ownerDocument.createRange();
   r.setStartBefore(this);
   var df = r.createContextualFragment(sHTML);
   this.parentNode.replaceChild(df, this);
}
);

var _emptyTags = {
   "IMG":   true,
   "BR":    true,
   "INPUT": true,
   "META":  true,
   "LINK":  true,
   "PARAM": true,
   "HR":    true
};

HTMLElement.prototype.__defineGetter__("outerHTML", function () {
   var attrs = this.attributes;
   var str = "<" + this.tagName;
   for (var i = 0; i < attrs.length; i++)
      str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";

   if (_emptyTags[this.tagName])
      return str + ">";

   return str + ">" + this.innerHTML + "</" + this.tagName + ">";
});

}

function strcmp(a, b)
{
  return (a > b) ? 1 : (a == b) ? 0 : -1;
}

function stricmp(a, b)
{
  return strcmp((a+'').toLowerCase(),(b+'').toLowerCase());
}

function dictcmp(a, b)
{
  var result = stricmp(a,b);
  return result ? result : -strcmp(a, b);
}

function dictcmp_break(a, b)
{
  a.replace(',','\0');
  b.replace(',','\0');
  return dictcmp(a,b);
}

//--------------------------- 

var standard_dues = 15;
var nbsp = "&nbsp;"

function exitField(f1)
{
   if (!f1.disabled)
	 f1.style.background="#FFFFFF";
}

function enterField(f1)
{
   f1.style.background="#DEF3F3";
}

var marked = "#000000", faint="#996699", white = "#FFFFFF", grey = "#999999";
var alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZŠŒŽŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßabcdefghijklmnopqrstuvwxyzšœžƒàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ";
var quote = '"', num = "0123456789", decnum = num+".", basic = "--'!?, \t\r\n\f"+quote, extended = ".:;";
var full = "-,.!?;/:+%^*#~[]{}@()£&$-' \t\r\n\f"+quote;
var urlcodes = ".?:/+%$@_-=~";
var emailcodes = ".@_-";

var error, errordetected, changedetected;
var cell, font, str;

var MC = new Array("Regular","Student","Postdoc","Emeritus");
var payment = new Array(standard_dues, 0,  standard_dues/2, standard_dues/2);
	
var Month = new Array(12);
	Month[0] =  "January";
	Month[1] =  "February";
	Month[2] =  "March";
	Month[3] =  "April";
	Month[4] =  "May";
	Month[5] =  "June";
	Month[6] =  "July";
	Month[7] =  "August";
	Month[8] =  "September";
	Month[9] =  "October";
	Month[10] = "November";
	Month[11] = "December";
	
var DayofWeek = new Array(7);
	DayofWeek[0] =  "Sunday";
	DayofWeek[1] =  "Monday";
	DayofWeek[2] =  "Tuesday";
	DayofWeek[3] =  "Wednesday";
	DayofWeek[4] =  "Thursday";
	DayofWeek[5] =  "Friday";
	DayofWeek[6] =  "Saturday";
	
var bgCol = new Array(6);
	bgCol[0] = "#CCCCFF";
	bgCol[1] = "#EEFFEE";
	bgCol[2] = "#FFFFEE";
	bgCol[3] = "#FFFFE6";
	bgCol[4] = "#FFFFDD";
	bgCol[5] = "#CCFFFF";

function GetRadio(grp)
{
  var i;
  for (i=0;i<grp.length;i++)
	if (grp[i].checked)
		return i;
  return -1;
}

function SetCheck(code, flag)
{
  chk = document.getElementById(code);
  if (chk)
	chk.checked = flag;
}

function Trim(str)
{
  var i, ch, len = str.length;
  for (i = 0;  i < len;  i++)
  {
    ch = str.charCodeAt(i);
	if ((ch < 0) || (ch > 32))
	   break;
  }
  if (i > 0)
  {
 	str = str.substr(i, len-i); 
	len = str.length;
  }
  for (i = len-1;  i >=0;  i--)
  {
    ch = str.charCodeAt(i);
	if ((ch < 0) || (ch > 32))
	   break;
  }
  if (i < len-1)
 	str = str.substr(0, i+1); 
  return str;
}

function CleanStr(checkStr, checkOK)
{
 var newstr = "";
 var i, ch, len = checkStr.length;
 for (i = 0;  i < len;  i++)
 {
    ch = checkStr.charAt(i);
	if (checkOK.indexOf(ch)>-1)
       newstr = newstr + ch;  
  }
  error = checkStr != newstr;
  return newstr;
}

function TestPWDSecurity(pwd)
{
  var i, ch, total, count = 0;
  if (!pwd) return 1;
  total = pwd.length;
  if (total < 5) return 1;
  for (i = 0; i<total; i++)
  {
    ch = pwd.charAt(i);
	if (alpha.indexOf(ch)>-1)
		count++;
  }
  if (count == total) return 2;
  return 0;
}

function SentenceStyle(checkStr)
{
 var newstr = "", punc = " ,;:-", punc2 = ".!?";
 var i, j, ch;
 var wposn = 0, sposn = 0;
 var cap = alpha.length/2;
 for (i = 0;  i < checkStr.length;  i++)
 {
    ch = checkStr.charAt(i);
	if (punc.indexOf(ch)>-1) wposn=0;
	else 
	if (punc2.indexOf(ch)>-1) sposn=0;
	else 
	{
	  j = alpha.indexOf(ch);
	  if (j>-1)
	  {
	    if (j >= cap)
		{
		  if (sposn == 0) ch = ch.toUpperCase();
		}
		else 
		  if (wposn > 0) ch = ch.toLowerCase();  
	    wposn++;
 	    sposn++;
	  }
	}
	newstr = newstr + ch;
  }
  error |= (checkStr != newstr);
  return newstr;
}

function CheckException(checkStr, i, except)
{
	if (except == null) return 0;
	var w = except.length;
	var str, j;
	j = except.indexOf(",");
	while (j > -1)
	{
		str = except.substr(0, j);
		if (checkStr.substr(i, j) == str)
			return str;
		except = except.substr(j+1, w);
		w = except.length;
		j = except.indexOf(",");
	}
 	if (checkStr.substr(i, w) == except)
		return except;	
	return null;
}

function TitleStyle(checkStr, except, initial_lower)
{
 var newstr = "";
 var i, j, ch, k;
 var wposn = 0;
 var cap = alpha.length/2;
 for (i = 0;  i < checkStr.length;  i++)
 {
    ch = checkStr.charAt(i);
	j = alpha.indexOf(ch);
	if (j>-1)
	{
	   	if (wposn == 0)
	   	{
	   		if (initial_lower || (i > 0))
			{		
				k = CheckException(checkStr, i, except);
				if (k)
				{
					i = i + k.length;
					newstr = newstr + k + " ";
					continue;
				}			
			}
			if (j >= cap)
				ch = ch.toUpperCase();
		}
		else 
		  	if (j < cap)	
				ch = ch.toLowerCase();  
	   	wposn++;		
	}
	else
		if (ch!="'")
		  wposn = 0;
	newstr = newstr + ch;
  }
  error |= (checkStr != newstr);
  return newstr;
}

function CapitalStyle(checkStr, upper)
{
 var newstr = "";
 var i, j, ch;
 var cap = alpha.length/2;
 for (i = 0;  i < checkStr.length;  i++)
 {
    ch = checkStr.charAt(i);
	j = alpha.indexOf(ch);
   	if (j>-1)
		if (upper)
		{
			if (j >= cap)
				ch = ch.toUpperCase();
		}
		else
			if (j < cap)
				ch = ch.toLowerCase();
	newstr = newstr + ch;
  }
  error |= (checkStr != newstr);
  return newstr;
}

function Replace(checkStr, ch1, ch2)
{
 var newstr = "";
 var i, ch;
 for (i = 0;  i < checkStr.length;  i++)
 {
    ch = checkStr.charAt(i);
	newstr = newstr + ((ch == ch1) ? ch2 : ch);
  }
  return newstr;
}

function GetSeqUntil(chars)
{
  var newstr = "";
  var i,ch;
  if (str != null)
  {
	  for (i = 0;  i < str.length;  i++)
	  {
		ch = str.charAt(i);
		if (chars.indexOf(ch)>-1)
		{
		  str = str.substr(i,str.length);
		  return newstr;
		}
		else
		  newstr = newstr+ch;
	  }
  }
  str = null;
  return newstr; 
}

function SkipZero(str)
{
  var i;
  if (str != null)
	for (i = 0;  i < str.length;  i++)
	  if (str.charAt(i) != '0')
		return str.substr(i,str.length);
  return null;
}

function ReplaceStr(checkStr, checkOK, replacement)
{
 var newstr = "";
 var i, j, ch;
 for (i = 0;  i < checkStr.length;  i++)
 {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
      {
	    ch = replacement;  
		break;
	  }
	newstr = newstr + ch;
  }
  error |= (checkStr != newstr);
  return newstr;
}

function number(string, mini, maxi)
{
	var n = parseInt(SkipZero(string));
	if (isNaN(n)) 
		n = 0;
	if (n > maxi) 
		n = maxi;
	else
	if (n < mini) 
		n = mini;
	return n;
}

function paddigits(val, n)
{
	var s = val.toString(), i;
	if (s.length > n)
	  s = s.substring(s.length-n,s.length);
	else
	  for (i = s.length; i < n; i++)
		s = "0"+s;
	return s;
}

var dd, mm, yy;
function ParseDate(date)
{
   var punc = " .,:;/\\"
   str = date;
   dd = number(GetSeqUntil(punc), 1, 31);
   GetSeqUntil(num);
   mm = number(GetSeqUntil(punc), 1, 12);
   GetSeqUntil(num);
   yy = number(GetSeqUntil(punc), 0, 99);
   return str;
}

function date2str(date)
{
   yy = date.getYear();
   mm = date.getMonth()+1;
   dd = date.getDate();// curious bug! getDate <-> getDay
   return paddigits(dd,2) + "/" + paddigits(mm,2) + "/" + paddigits(yy,2);
}

function num2currencystr(num)
{
	return Math.floor(num).toString() + "." + paddigits((num*100) % 100,2);
}

function CleanDate(date)
{
   var copy, now = new Date(), newdate;
   ParseDate(date); 
   newdate = new Date(yy+2000,mm-1,dd,0,0,0,0,0);
   if (newdate < now) newdate = now; 
   copy = date2str(newdate);
   error = copy != date;
   return copy;
}

function DateStr(date)
{
  var newdate;
  ParseDate(date);
  newdate = new Date(yy+2000,mm-1,dd,0,0,0,0,0);
  return DayofWeek[newdate.getDay()]+ " " + dd + " " + Month[mm-1] + " " + (yy+2000);
}

function DateStr2(date1, date2)
{
  var newdate, yy2, mm2, str;
  ParseDate(date2);
  yy2=yy;
  mm2=mm;
  ParseDate(date1);
  newdate = new Date(yy+2000,mm-1,dd,0,0,0,0,0);
  str = DayofWeek[newdate.getDay()]+ " " + dd;
  if (yy != yy2)
  	str = str + " " + Month[mm-1] + " " + (yy+2000);
	else
		if (mm != mm2)
			str = str + " " + Month[mm-1];
  return str;
}


function ampm(str)
{
   var s;
   if (str)
   {
	 s = str.charAt(0);
	 return ((s == 'a') || (s == 'A')) ? 2 : 
	 		((s == 'p') || (s == 'P')) ? 1 : 0;
   }
   return 0;
}

function CleanTime(time)
{
   var hh, mm, pm;
   var punc = " .,:;/\\apmAPM", copy, s;
   copy = time;
   str = time;
   hh = number(GetSeqUntil(punc), 0, 24);
   if (hh == 24) hh = 0;                // 24:00 = 00:00
   pm = ampm(GetSeqUntil(num));
   mm = number(GetSeqUntil(punc), 0, 59);
   pm |= ampm(str);
   if ((pm == 1) && (hh < 12)) hh += 12; // 12pm = 12:00
   if ((pm == 2) && (hh == 12)) hh = 0; // 12am = 0:00
   time = paddigits(hh,2) + ":" + paddigits(mm,2);
   error = copy != time;
   return time;
}

function zeroes(dpls)
{
  var str;
  str = "";
  while (dpls--)
    str=str+'0';
  return str;
}

var lower;
function cDecimal(str, dpls)
{
  var i, left, right;
  str = CleanStr(str, num+'.');
  i = str.indexOf('.');
  left = str.substr(0, i);
  right = CleanStr(str.substr(i+1,dpls), num);
  if (right.length < dpls)
    right = right+zeroes(dpls-right.length);
  lower = parseInt(right,10);
  return parseInt(left,10);
}

function CleanDecimal(str, dpls)
{
   var higher, copy, right;
   copy = str;
   higher = cDecimal(str, dpls);
   if (isNaN(higher)) higher = 0;
   right = lower.toString();
   if (right.length < dpls)
    right = right+zeroes(dpls-right.length);
   str = higher.toString()+"."+right;
   error = str != copy;
   return str;
}

function CleanInteger(str, minimum, maximum)
{
   var num = number(str, minimum, maximum);
   var copy = str;
   str = num.toString();
   error = copy != str;
   return str;
}

function ColourCode(element, edit)
{  
  if (edit)
  {
	//window.location = "#form";
	if (!element.disabled) element.focus();
  	if (cell) cell.style.backgroundColor = marked;
	if (font) font.style.color = white;
	errordetected = true;
  }
  else
  {
	if (error)
	{
	    changedetected = true;
		if (cell) cell.style.backgroundColor = faint;
		if (font) font.style.color = white;
	}
	else
	{
	    if (cell) cell.style.backgroundColor = white;
		if (font) font.style.color = marked;
	}
  }
}

function EnableField(element, status)
{
  element.disabled = !status;
  if (cell) cell.style.backgroundColor = white;
  if (font) font.style.color = status ? marked : grey;
}

function Evaluate(element, filter, minlen)
{
  element.value = CleanStr(element.value, filter);
  ColourCode(element, element.value.length < minlen);
}

function EvaluateTitle(element, filter, minlen, except, initial_lower)
{
  element.value = TitleStyle(CleanStr(element.value, filter), except, initial_lower);
  ColourCode(element, element.value.length < minlen);
}

function EvaluateSentence(element, filter, minlen)
{
  element.value = SentenceStyle(CleanStr(element.value, filter));
  ColourCode(element, element.value.length < minlen);
}

function EvaluateCap(element, filter, minlen, upper)
{
  element.value = CapitalStyle(CleanStr(element.value, filter), upper);
  ColourCode(element, element.value.length < minlen);
}

function EvaluateLimit(element, filter, minlen, maxlen)
{
  element.value = CleanStr(element.value, filter);
  error = (element.value.length > maxlen);
  if (error)
  	element.value = element.value.substring(0, maxlen);
  ColourCode(element, element.value.length < minlen);
}

function EvaluateURLorMailTo(element, http)
{
  var c, str;
  str = CleanStr(element.value, alpha+num+urlcodes);
  if ((str == "") || (str == null)) return; 
  c = str.indexOf(':');
  if ((http !=2) && ((str.indexOf('@') > -1) == http))
     errordetected = true;
 else
  if (str.indexOf('@') == -1)
  {
  	if (c > -1)
	{
	   while (str.charAt(++c) == '/');
	   str = str.substring(c, str.length);
	}
    if (str.indexOf('@') > -1)
 		errordetected = true;
  }
  else 
  { 
    if (c > -1) str = str.substring(++c, str.length);
	if (str.indexOf('@') == -1)
		errordetected = true;
  }
  
  error = (str != element.value);
  if (error)
	element.value = str;
  ColourCode(element, errordetected || (element.value.length < 1));
}

function EvaluateUpper(element, filter, minlen)
{
  var str = CleanStr(element.value, filter);
  str = str.toUpperCase();
  error = (str != element.value);
  if (error)
	element.value = str;
  ColourCode(element, element.value.length < minlen);
}

function EvaluateDate(element)
{
  element.value = CleanDate(element.value);
  ColourCode(element, false);
}

function EvaluateDateDiff(element1, element2)
{
  var date1, date2;
  ParseDate(element1.value);
  date1 = new Date(yy+2000,mm-1,dd,0,0,0,0,0);
  ParseDate(element2.value);
  date2 = new Date(yy+2000,mm-1,dd,0,0,0,0,0);
  error = (date2<date1);
  if (error)
  {
	element2.value = date2str(date1);
	ColourCode(element2, false);
  }
}

function EvaluateCD(dayelement, monthelement, yearelement, date)
{
  var daystr, month, yearstr;
  daystr = dayelement.value;
  month = monthelement.selectedIndex;
  yearstr = yearelement.value;

  yy = date.getYear();
  mm = date.getMonth();
  dd = date.getDate();// curious bug! getDate <-> getDay
  delete date;
  error = false;
  if (dd != daystr)
  {
  	dayelement.value = dd;
	error = true;
  }
  if (month != mm)
  {
  	monthelement.selectedIndex = mm;
	error = true;
  }
  if (yy < 2000) yy = (yy % 100) + 2000;
  if (yy != yearstr)
  {
    yearelement.value = yy;
	error = true;
  }
  ColourCode(dayelement, false);
  delete date;
  date = new Date(parseInt(yy),parseInt(mm),parseInt(dd),0,0,0);
  return date;
}

function ParseCD(dayelement, monthelement, yearelement)
{
  var daystr, day, month, year, yearstr;
  daystr = dayelement.value;
  yearstr = yearelement.value;
  month = monthelement.selectedIndex;
  day = number(daystr,1,31);
  year = number(yearstr,2008,2099);
  return new Date(year,month,day,0,0,0,0,0);
}

function EvaluateCompoundDate(dayelement, monthelement, yearelement)
{
  var date;
  date = ParseCD(dayelement, monthelement, yearelement);
  return EvaluateCD(dayelement, monthelement, yearelement, date);
}

function EvaluateTime(element)
{
  element.value = CleanTime(element.value);
  ColourCode(element, false);
}

function EvaluateDecimal(element)
{
  element.value = CleanDecimal(element.value, 2);
  ColourCode(element, false);
}

function EvaluateInteger(element, minimum, maximum)
{
  element.value = CleanInteger(element.value, minimum, maximum);
  ColourCode(element, false);
}

function ClearCode(element)
{
  	error = false;
  	if (element)
	{	
	  element.value = "";
	  ColourCode(element, false);
	}
}

function ClearSelector(id)
{
  error = false;
  var element = document.getElementById(id);
  if (element)
  {
    element.selectedIndex = 0;
	element.style.display = 'none'; // refresh
	element.style.display = 'block';
	ColourCode(element, false);
  }
}

function ClearTA(element)
{
  	error = false;
  	if (element)
	{	
	  element.innerHTML = "";
	  ColourCode(element, false);
	}
}

function cellfont(base)
{
  cell = document.getElementById(base+'cell');
  font = document.getElementById(base+'col');
}

function pdvalue(element)
{
  return element.options[element.selectedIndex].text;
}

function NonNullStr(element, def)
{
  return (element == "") ? def: element;
}

function set_text(target, element, def)
{
  var t = document.getElementById(target);
  if (t == null)
  	alert("error: target '"+ target +"' not found.");
  t.innerHTML = NonNullStr(element, def);
}

function set_text_opt(target, element, plus)
{
  var t = document.getElementById(target);
  t.innerHTML = (element== "") ? "" : plus+element;
}

function set_text_colour(target, element, def, col)
{
  var t = document.getElementById(target);
  if (t == null)
  	alert("error: target '"+ target +"' not found.");
  t.innerHTML = NonNullStr(element, def);
  t.color = col;
}

function set_url(main, url)
{
  if ((main!="") && (url!=""))
	main = "<a href='http://" + url +"' target=_blank>" + main.fontcolor('#000066') + "</a>";
  return main;
}

function set_text_url(target, main, def, url)
{
  set_text(target, set_url(main, url), def);
}

function set_seq_text(target, prefix, main, url, suffix, opt)
{
  if (main!="")
  {
	str = prefix+" "+set_url(main, url);
	if (suffix!="") str+=", "+suffix;
  }
  else
    str="";
  set_text_opt(target, str, opt);
}

function ActionConfValidator(theForm)
{
  errordetected = false;
  changedetected = false;
  marked = "#000000";  // not mandatory

  cellfont('comments');
  EvaluateLimit(theForm.Submitted_Comments.value, alpha+num+basic, 0, 200);

  marked = "#990099"; 

  cellfont('by');
  Evaluate(theForm.Submitted_By.value, alpha+num+emailcodes, 8);
  return !(errordetected || changedetected);
}

function MemberValidator(theForm)
{
  errordetected = false;
  changedetected = false;
  
  marked = "#000000";

  cellfont('HomeURL');
  EvaluateURLorMailTo(theForm.HomeURL, true);

  cellfont('Email');
  EvaluateURLorMailTo(theForm.Email, false);
  EvaluateCap(theForm.Email, alpha+num+full, 3, false);

  cellfont('telno');
  Evaluate(theForm.Telno, num+" +", 0);

  cellfont('postcode');
  EvaluateCap(theForm.Postcode, alpha+num+" ", 0, true);

  cellfont('country');
  ColourCode(theForm.Country, !theForm.Country.selectedIndex);

  cellfont('city');
  EvaluateTitle(theForm.City, alpha+full, 3, "de", false);

  cellfont('addr');
  Evaluate(theForm.Addr, alpha+full+num, 3, null, false);
  EvaluateTitle(theForm.Addr2, alpha+full+num, 0, null, false);
  EvaluateTitle(theForm.Addr3, alpha+full+num, 0, null, false);

  if (theForm.Affiliated.checked)
  {  
    cellfont('uni');
    Evaluate(theForm.Uni, alpha+full+num, 3);

    cellfont('dept');
    EvaluateTitle(theForm.Dept, alpha+full+num, 3, "of,and,the",false);
  }
  
  cellfont('surname');
  EvaluateTitle(theForm.Surname, alpha+" -", 3, "van,der,de,ap",true);

  cellfont('name1');
  EvaluateTitle(theForm.Name1, alpha+" -", 2, null, false);
  
  cellfont('name2');
  EvaluateCap(theForm.Name2, alpha+". ", 0, true, false);

  font = document.getElementById('errcol');
  if (font)
    font.style.color = errordetected ? marked : white;
  
  return (!(errordetected || changedetected));
}

function MemberValidatorFull(theForm)
{
  var result = MemberValidator(theForm), JDate;

  cellfont('join'); 
  JDate = EvaluateCompoundDate(theForm.DayJoin, theForm.MonthJoin, theForm.YearJoin); 

  return result && (!(errordetected || changedetected));
}


function MemberValidator2(theForm)
{
}

function MemberReset2()
{
   SetCheck('NameShow', 1);
   SetCheck('DeptShow', 0);
   SetCheck('UniShow', 0);
   SetCheck('AddrShow', 0);
   SetCheck('TelShow', 0);
   SetCheck('EmailShow', 0);
   SetCheck('URLShow', 1);
}

function MemberValidator3(theForm)
{
  var status;
  status = GetRadio(theForm.member);
  createCookie("MemberClass",MC[status],1);	
}

function openwindow(url, opt)
{
 var rep = 1, win, platform;
 if (navigator.appVersion.substring(0,1) == "2")
 {
  platform=navigator.appVersion;
  if ((platform.indexOf("X11")!=-1) || (platform.indexOf("Mac")!=-1)) rep = 2;
 }
 for (;rep;rep--)
    win = window.open(url, 'example', opt);
// if (win != null) win.creator = self;
 return win;
}

function TestURL(theForm, id, http)
{
	var url, element;
	errordetected = false;
	element = document.getElementById(id);
	cellfont(id);
	EvaluateURLorMailTo(element, http);
	if (!errordetected)
	  if (http)
	    openwindow("http://"+element.value, "");
	  else
	  	location.href = "mailto:"+element.value;
	return (true);
}

function MemberReset(theForm)
{
  var aff;
  marked = "#000000";  

  cellfont('UID');
  ClearCode(theForm.UID);

  cellfont('name1');
  ClearCode(theForm.Name1);

  cellfont('name2');
  ClearCode(theForm.Name2);

  cellfont('surname');
  ClearCode(theForm.Surname);

  aff = theForm.Affiliated;
  if (aff)
    aff.checked = true;
  
  cellfont('dept');
  ClearCode(theForm.Dept);

  cellfont('uni');
  ClearCode(theForm.Uni);
  
  cellfont('addr');
  ClearCode(theForm.Addr);

  cellfont('city');
  ClearCode(theForm.City);
  
  cellfont('country');
  ClearSelector('Country');

  cellfont('postcode');
  ClearCode(theForm.Postcode);
  
  cellfont('telno');
  ClearCode(theForm.Telno);
  
  cellfont('email');
  ClearCode(theForm.Email);
  
  cellfont('HomeURL');
  ClearCode(theForm.HomeURL);
  
  ClearSelector('Title');
  ClearSelector('MemberClass');
  ClearSelector('Mship');
  ClearSelector('Live');
  
  font = document.getElementById('errcol');
  if (font)
    font.style.color = white;
  return false;
}

function EnableDept()
{
  var status;
  var id;
  var theForm;
  theForm = document.forms[0];
  id = document.getElementById('Affiliated');
  status = id.checked;
  if (!status)
  	id.focus();
  
  cellfont('dept');
  EnableField(theForm.Dept, status);
  id = document.getElementById('DeptShow');
  if (id)
    id.disabled = !status;
  
  cellfont('uni');
  EnableField(theForm.Uni, status);
  id = document.getElementById('UniShow');
  if (id)
    id.disabled = !status;
}

function FlagZeroText(src, el)
{
  var id, newval;
  id = document.getElementById(el);
  if (id)
  {
	newval = !src.value || !src.value.length;
	if (id.disabled != newval)
	  id.disabled = newval;
  }
}

function EnableDate(str)
{
  var status;
  var id;
  var theForm;
  id = document.getElementById(str+"DateFlag");
  status = id.checked;
  id = document.getElementById("Day"+str);
  id.disabled = !status;
  id = document.getElementById("Month"+str);
  id.disabled = !status;
  id = document.getElementById("Year"+str);
  cellfont(str);
  EnableField(id, status);
}

function ClearPWD(theForm, pwd2)
{
  cellfont('PWD');
  ClearCode(theForm.PWD);
  if (pwd2)
  {
	cellfont('PWD2');
    ClearCode(theForm.PWD2);
  }
}

function LoginValidator(theForm)
{
  var pwd, pwd2, uid, errstr, err, errtxt;
  
  cellfont('UID');
  Evaluate(theForm.UID, alpha+num+" ", 4);
  
  pwd = theForm.PWD.value;
  pwd2 = theForm.PWD2.value;
  
  errstr = "";
  if (pwd == pwd2)
  {
  	err = TestPWDSecurity(pwd);
	if (!err) return true;
	
	errstr = "Please try a stronger password.<br><br>"
	switch (err)
	{
	case 1: errstr = errstr + "It must be at least five (5) characters in length.";
			break;
	case 2: errstr = errstr + "It must contain at least one non-alphabetic character.";
			break;	
	}
  }
  else
	errstr = "The second password is different from the first. Please try again.";

  errtxt = document.getElementById('err');
  errtxt.innerHTML = errstr;
  cellfont('PWD');
  ClearPWD(theForm, true);
  return false;
}

function PassValidator(theForm)
{
  var pwd, err, errtxt, errstr;
  pwd = theForm.CPWD.value;

  err = TestPWDSecurity(pwd);
  if (!err) return true;
  errstr = "Please try a stronger password.<br><br>"
  switch (err)
  {
	case 1: errstr = errstr + "It must be at least five (5) characters in length.";
			break;
	case 2: errstr = errstr + "It must contain at least one non-alphabetic character.";
			break;	
  }  
  errtxt = document.getElementById('err');
  errtxt.innerHTML = errstr;
  cellfont('PWD');
  ClearCode(theForm.CPWD);
  return false;
}

function LoginReset(theForm, pwd2)
{
  cellfont('UID');
  ClearCode(theForm.UID);
  ClearPWD(theForm, pwd2);
  return false;
}


var AddPtStr = "<span id=\'AddPoint\'></span>";

function ResearchValidator(theForm)
{
  var font, OK;
  errordetected = false;
  changedetected = false;
  
  marked = "#000000";
  
  AddKwd("Keywords");
  AddKwd("stdKwds");

  cellfont('HomeURL');
  EvaluateURLorMailTo(theForm.HomeURL, true);
  
  cellfont('expire'); 
  EvaluateCompoundDate(theForm.DayEnd, theForm.MonthEnd, theForm.YearEnd); 
  
  cellfont('summary');
  Evaluate(theForm.Summary, alpha+full+num, 3);
  
  cellfont('title');
  Evaluate(theForm.Title, alpha+full+num, 3);

  font = document.getElementById('errcol');
  if (font)
    font.style.color = errordetected ? marked : white;
  
  OK = (!(errordetected || changedetected));
  if (OK)    
	StoreKwds("KS");
    
  return OK;
}

function ResearchReset(theForm)
{
  var element;
  cellfont('title');
  ClearCode(theForm.Title);
  cellfont('summary');
  ClearCode(theForm.Summary);
  limitText('Summary',200);
  cellfont('HomeURL');
  ClearCode(theForm.HomeURL);
  element = document.getElementById('errcol');
  if (element)
    element.style.color = white;
  ClearKwds(theForm);
  return false;
}

function ClearKwds(theForm)
{
  var element;
  cellfont('kwds');
  ClearSelector("stdKwds");
  ClearCode(theForm.Keywords);
  element = document.getElementById('tags');
  element.innerHTML = " "+AddPtStr+nbsp;
}

function Re_SearchValidator(theForm)
{
  AddKwd("Keywords");
  AddKwd("stdKwds");
  StoreKwds("KS");   
  return true;
}

function Re_SearchReset(theForm)
{
  ClearCode(theForm.UID2);
  ClearKwds(theForm);
  SetCheck('CaseS', 0);
  SetCheck('SText', 0);   
}

function SetDues(membership)
{
  var def, duestxt, str;
  def = false;
  switch (membership)
  {
    case 2:	str = "Student members are entitled to free membership <b>for the duration of your degree</b> programme. You will be asked to provide proof of full time student status.";
   			break;
    default:str = "Since dues are payable, you can put a cheque in the post (you need to add &euro;10.00 for bank charges unless drawn on a German bank) or use PayPal to pay by card over the internet. <ul><li>Cheque - On selecting <b>Apply</b> you will receive an email to arrange payment by cheque to complete the application.</li><li>PayPal - On selecting <b>Apply</b> you will be directed to a secure PayPal website where you will be asked to complete payment by credit or debit card.</li></ul>"
   			def = true;			
			break;
  }
  duestxt = document.getElementById('dues');
  duestxt.innerHTML = str;
  return def;
}      

function EnableMethod(status)
{
  var theForm;
  theForm = document.forms[0];
  cellfont("method");
  EnableField(theForm.method1, status);
  cellfont("method2");
  EnableField(theForm.method2, status);
}

function UpdateDues()
{
  var theForm, qty, years, mc, def, status;
  theForm = document.forms[0];
  status = GetRadio(theForm.member);
//  qty = document.getElementById('Years');
//  years = qty.selectedIndex + 1;
//  RecalcTotal(years, payment[status]);
  mc = document.getElementById('MC');
  mc.innerHTML = MC[status];
//  def = SetDues(status);
//  EnableMethod(def);
}

function UpdateYears()
{
  var qty, years, yr, endyr, total, theForm, grp, mc, don, donation;
  qty = document.getElementById('Years');
  years = qty.selectedIndex + 1;
  yr = parseInt(document.getElementById('yr').innerHTML);
  endyr = document.getElementById('endyr');  
  endyr.innerHTML = (yr+years).toString();
  grp = document.getElementById('MC2');
  if (grp)
    mc = parseInt(grp.value);
  else
  {
    theForm = document.forms[0]; 
    grp = theForm.member;
    mc = GetRadio(grp)
  }
  don = document.getElementById('Donation');  
  if (don)
    donation = parseFloat(don.value = CleanDecimal(don.value, 2));
  RecalcTotal(years, payment[mc], donation);
}

function RecalcTotal(years, rate, donation)
{
  rate = years * rate;
  var amt = document.getElementById('amt');
  amt.innerHTML="&euro;"+num2currencystr(rate);
  amt = document.getElementById('tot');
  if (amt)
    amt.innerHTML="&euro;"+num2currencystr(rate + donation);
}

function SetMethod(status)
{
  document.getElementById("MethodSect");
}

function UpdateMethod()
{
  var theForm, i, grp, def, status;
  theForm = document.forms[0];
  status = theForm.Method.selectedIndex;
  SetMethod(status);
}

function UpdateQty()
{
  var qty, quantity;
  qty = document.getElementById('Years');
  quantity = document.getElementById('quantity');
  quantity.value = qty.selectedIndex + 1;
}

function UpdateMC()
{
  var mc, os0, change;
  mc = document.getElementById('MemberClass');
  os0 = document.getElementById('os0');
  os0.value = pdvalue(mc);

  change = document.getElementById('Change');
  mc = document.getElementById('MC');
  change.disabled = (os0.value.toString() == mc.value.toString());
}

function SecureUpdateMC()
{
	var mc, vid, dis;
	mc = document.getElementById('MemberClass');
	if (mc)
	{
	  dis = (mc.selectedIndex != 1);
	  vid = document.getElementById('Verify');
	  if (vid)
		vid.disabled = dis;
	  vid = document.getElementById('verifycol');
	  vid.style.color = dis ? grey : marked;
	}
}

function expand(UID)
{
  location.href = "expand.asp?UID="+UID;
}

function remove(UID)
{
  if (confirm("Please confirm the deletion of membership record '"+UID+"'.\nNote: once this record has been deleted it may not be easily restored.\nTo suspend a member, simply uncheck the Live switch."))
    location.href = "remove.asp?UID="+UID;
}

function update_password(UID)
{
  var PWD = document.getElementById("PWD").value;
  location.href = "passwd.asp?UID="+UID+"&PWD="+PWD;
}

function edit_theme(Theme)
{
  location.href = "add.asp?Theme="+Theme;
}

function remove_theme(Theme)
{
  if (confirm("Please confirm the deletion of this theme.\nNote: once this theme has been deleted it may not be easily restored."))
    location.href = "remove.asp?Theme="+Theme;
}

function edit_transaction(Tid)
{
  location.href = "add.asp?Tid="+Tid;
}

function remove_transaction(Tid)
{
  if (confirm("Please confirm the deletion of this transaction.\nNote: once this transaction has been deleted it may not be easily restored."))
    location.href = "remove.asp?Tid="+Tid;
}

function edit_election(Eid)
{
  location.href = "add.asp?id="+Eid;
}

function vote_in_election(Eid)
{
  location.href = "vote.asp?id="+Eid;
}

function ConfValidator(theForm)
{
  var ADate, EDate, SDate;
  errordetected = false;
  changedetected = false;
  
  marked = "#000000";
  
  cellfont('expire'); 
  ADate = EvaluateCompoundDate(theForm.DayAdvert, theForm.MonthAdvert, theForm.YearAdvert);
  
  cellfont('end'); 
  EDate = EvaluateCompoundDate(theForm.DayEnd, theForm.MonthEnd, theForm.YearEnd); 
 
  cellfont('start'); 
  SDate = EvaluateCompoundDate(theForm.DayStart, theForm.MonthStart, theForm.YearStart); 
  if (SDate > EDate)
  {
    cellfont('end'); 
  	EDate = SDate;
	EvaluateCD(theForm.DayEnd, theForm.MonthEnd, theForm.YearEnd, EDate);
  } 
  if (EDate > ADate)
  {
    cellfont('expire'); 
  	ADate = EDate;
	EvaluateCD(theForm.DayAdvert, theForm.MonthAdvert, theForm.YearAdvert, ADate);
  }

  cellfont('country');
  ColourCode(theForm.Country, !theForm.Country.selectedIndex);
  
  cellfont('city');
  EvaluateTitle(theForm.City, alpha+full, 3, "de", false);

  cellfont('uni');
  Evaluate(theForm.Uni, alpha+full+num, 3);

  cellfont('seq');
  Evaluate(theForm.Seq, num, 0);

  cellfont('org');
  Evaluate(theForm.Org, alpha+full+num, 2);

  cellfont('ConfURL');
  EvaluateURLorMailTo(theForm.ConfURL, true);

  cellfont('summary');
  Evaluate(theForm.Summary, alpha+full+num, 3);
  
  cellfont('title');
  Evaluate(theForm.Title, alpha+full+num, 3);

  return (!(errordetected || changedetected));
}

function RectifyDuration()
{
  var theForm = document.forms[0], duration, days, SDate, EDate;
  cellfont('null'); 
  duration = theForm.Duration;
  Evaluate(duration, num, 0);
  days = parseInt(duration.value)-1;
  if (isNaN(days) || (days<0)) days=0;
  SDate = ParseCD(theForm.DayStart, theForm.MonthStart, theForm.YearStart);
  EDate = new Date(SDate.getFullYear(),SDate.getMonth(),SDate.getDate()+days,0,0,0); 
  EvaluateCD(theForm.DayEnd, theForm.MonthEnd, theForm.YearEnd, EDate);
}

function RectifyEndDate()
{
  var theForm = document.forms[0], duration, days, SDate, EDate;
  cellfont('null'); 
  duration = theForm.Duration;
  SDate = EvaluateCompoundDate(theForm.DayStart, theForm.MonthStart, theForm.YearStart); 
  EDate = ParseCD(theForm.DayEnd, theForm.MonthEnd, theForm.YearEnd);
  if (SDate > EDate)
  {
  	SDate = EDate;
	EvaluateCD(theForm.DayStart, theForm.MonthStart, theForm.YearStart, SDate);
	days = 1;
  }
  else
    days = Math.abs(Math.round((SDate-EDate)/86400000))+1;
  duration.value = days.toString();
}

function SearchReset(theForm)
{
  ClearCode(theForm.UID2);
  ClearCode(theForm.TName1);
  ClearCode(theForm.TSurname);
  SetCheck('StartDateFlag', 0);
  EnableDate('Start');
  SetCheck('EndDateFlag', 0);
  EnableDate('End');
  SetCheck('PastAdvert', 0); 
  ClearSelector('Live');
  ClearSelector('Method');
}

function remove_conf(Conf)
{
  if (confirm("Please confirm the deletion of this conference announcement.\nNote: once this announcement has been deleted it may not be easily restored."))
    location.href = "remove.asp?Conf="+Conf;
}

function edit_conf(Conf)
{
  location.href = "add.asp?Conf="+Conf;
}

function checkall(butt)
{
  var flag = (butt.value != "None");
  var inputs = document.getElementsByTagName('input'), i;
  for (i = 0; i < inputs.length; i++)
    if ((inputs[i].type == 'checkbox') && (!inputs[i].disabled))
	  inputs[i].checked = flag;
  butt.value = flag ? "None" : "All";
}

function checkbox_tabindex()
{
  var inputs = document.getElementsByTagName('input'), i, el;
  for (i = 0; i < inputs.length; i++)
  {
    el = inputs[i];
    switch (el.type)
	{
	case 'submit':
	case 'button':	el.tabIndex = 3;
					break;
	case 'checkbox':if (el.name != 'Affiliated')
					{
					  el.tabIndex = 2;
					  break;
					}
	default:		el.tabIndex = 1;
					break;
    }
  }	
}

function limitText(id, limit)
{  
  var limitField = document.getElementById(id);
  var len = limitField.value.length;
  if (len > limit)
    limitField.value = limitField.value.substring(0, limit);
  else
  {
    var limitCount = document.getElementById(id+"Count");
	len = (limit - len);
	var str = len.toString();
    limitCount.innerHTML = len < 10 ? str.bold() : str;
  }
}

function Kwd2ID(str)
{
  return "_"+str.replace(/ /g,"_").replace(/'/g,"_");
}

function ChangeSrc(img, src)
{
  img.src = src;
}

function AddKwd(id)
{
  var txt, str, sel;
  txt = document.getElementById(id);
  if (txt)
  {
	sel = (txt.tagName == 'SELECT');
	str = sel ? (txt.selectedIndex) ? pdvalue(txt) : "" : txt.value.toString();
	AddKwdSet(str);
	if (sel)
	  txt.selectedIndex = 0;
	else
	  txt.value = "";
   }
}

function AddKwdSet(str)
{
  var c;
  while (str != "")
	{
	  c = str.indexOf(',');
	  if (c>-1)
	  {
		AddKwd1(str.substr(0, c));
		str = str.substr(c+1);
      }
	  else
	  {
		AddKwd1(str);
		break;
	  }
	}  
}


function ActionButt(label, func, param, alt)
{
  var label1, label2, cross;
  label1 = "'"+label+"1.gif'"
  label2 = "'"+label+"2.gif'"
  
  cross = "<img src="+label1+" onMouseOver=\"javascript: ChangeSrc(this,"+label2;
  cross = cross+"); Tip(\'"+alt+"\');\" onMouseOut=\"javascript: ChangeSrc(this,"+label1; 
  cross = cross+"); UnTip();\" onClick=\"javascript: "+func+"(\'"+param+"\');\">";
  return cross;
}

function AddKwd1(str)
{
  var txt, str, tags, elements, len, span, tag, str2, diff;
  str = Trim(str);
  if (str == "")
  	return;  
  str2 = Kwd2ID(str);
  tags = document.getElementById("tags");
  elements = tags.getElementsByTagName("span");
  len = elements.length;
  for (i = 0; i < len; i++)
  {
  	span = elements.item(i);
	if (span.id)
	{
	  tag = span.id.toString();
	  diff = dictcmp(tag, str2);
	  if (diff == 0)
	    break;
	  if ((diff == 1) || (tag == "AddPoint"))
	  {
		span.outerHTML = "<span id=\'"+str2+"\'><span>"+str+"</span>"+nbsp+ActionButt("../../images/x", "DelKwd", str2, "Remove keyword")+" </span>" + span.outerHTML;
	    break;
 	  }
	}
  }
}

function StoreKwds(id)
{
  var tags, elements, len, i, span, tag, html, str, c, str2;
  tags = document.getElementById("tags");
  elements = tags.getElementsByTagName("span");
  len = elements.length;
  str2="";
  for (i = 0; i < len; i++)
  {
  	span = elements.item(i);
	tag = span.id.toString();
	if (tag == "")
	{
	  html = span.innerHTML;
	  str = html.toString();
	  str2 = (str2 == "") ? str : str2+","+str;
	}
  }
  tags = document.getElementById(id);
  tags.value = str2;
}


function DelKwdSet(str)
{
  var c;
  while (str != "")
	{
	  c = str.indexOf(',');
	  if (c>-1)
	  {
		DelKwd(Kwd2ID(str.substr(0, c)));
		str = str.substr(c+1);
      }
	  else
	  {
		DelKwd(Kwd2ID(str));
		break;
	  }
	}  
}

function DelKwd(id)
{
  var span;
  span = document.getElementById(id);
  if (span)
  	span.outerHTML = "";
}

function SearchKwdSet(str)
{
  str = str.replace(/&/g,"%26");
  location.href = "/research/index.asp?KS="+str;
}

function CloudResize(addlocn, searchflag)
{
  var size, n, data, str, i, c, w, v, w2;
  size = document.getElementById('CloudSize');
  n = size.value;
  createCookie("CloudSize",n,0);
  data = document.getElementById('CloudN');
  data.innerHTML = n;

  n = parseInt(n);
  var wd, wds = new Array(n);
  data = document.getElementById('CloudData');
  str = data.value;
  i = 0;
  wds = str.split(',,',n);
  n = wds.length;
  wd = wds[0];
  c = wd.indexOf(',');
  hi = parseInt(wd.substr(c+1));
  wd = wds[n-1];
  c = wd.indexOf(',');
  lo = parseInt(wd.substr(c+1));
  wds.sort(dictcmp_break);
  str = ""
  range = (hi - lo) / 10;
  for (i=0;i<n;i++)
  {
    wd = wds[i];
	c = wd.indexOf(',');
	w = wd.substr(0, c);
	v = Math.round((parseInt(wd.substr(c+1))- lo) / range);
	w2 = w.replace(/&/g,"%26");
	if (searchflag) str += "<a href='index.asp?KS=" + w2 + "'>";
	str += "<span class=k" + v + ">" + w + "</span>";
	if (searchflag) str += "</a>";
	if (addlocn) str += nbsp + ActionButt(addlocn, "AddKwd1", w, "Add Keyword");
	str += " ";
  }
  data = document.getElementById('Cloud');
  data.innerHTML = str;
}

function CleanDecimalRT(e)
{
	var p1, p2;
	if (e.selectionStart != null)
	{
		e.focus();
		p1 = e.selectionStart;
		p2 = e.selectionEnd;			
		str = CleanDecimal(e.value, 2);
		if (parseInt(str)<5) str="5.00";
		if (str != e.value)
		{
			e.value = str;	
			e.setSelectionRange(p1, p2);
		}
	}
	else
	if (document.selection) 
	{
		var range = e.createTextRange(), stored_range;
		{
			stored_range = range.duplicate();
			str = CleanDecimal(e.value, 2);
			if (parseInt(str)<5) str="5.00";
			if (str != e.value)
			{
				e.value = str;
				range.setEndPoint("StartToStart", stored_range);
				range.setEndPoint("EndToEnd", stored_range);
				range.select();
			}
		}
	}
}


function LimitKey(e, checkOK)
{   
	var keyCode = e.charCode ? e.charCode : e.keyCode;	
	return (keyCode < 32) || (checkOK.indexOf(String.fromCharCode(keyCode)) > -1);
}

function CursorKey(e, field, minimum, maximum)
{
	if (e.charCode) return;
	var k, str, c;
	k = e.keyCode;
	if ((k == 38) || (k == 40))
	{
	   	str = field.value;
	   	c = parseInt(str);
	   	if (k == 38)
			c++;
		else 
			c--;
		if (c>maximum) c = maximum;
    	if (c<minimum) c = minimum;
		field.value = c;
	}
}

function Vote(i)
{
  var theForm, str, v, i, j, code, vote;
  theForm = document.forms[0];
  str = theForm.vote.value;
  v = document.getElementById('vote'+i);
  vote = v.innerHTML;
  code = String.fromCharCode(i+64);
  if (vote == nbsp)
  {   
	 posn = str.length;
	 v.innerHTML = posn+1;
	 str = str+code;
  }
  else
  {
	 posn = str.indexOf(code);
	 v.innerHTML = nbsp;
	 l = str.length;
	 for (j = posn+1; j<l; j++)
	 {
	 	i = str.charCodeAt(j)-64;
	 	v = document.getElementById('vote'+i);
	 	v.innerHTML = nbsp;
	 }
	 str = str.substr(0, posn); 
  }
  theForm.vote.value = str;
  v = theForm.votebutton;
  theForm.votebutton.disabled = !str.length;
}

function InitVoting()
{
   var theForm;
   theForm = document.forms[0];
   theForm.vote.value = "";
}

function show_hide_div(id, status)
{
	var status_str;
	status_str = status ? 'block' : 'none';
	if (document.getElementById)
		document.getElementById(id).style.display = status_str;
	else if (document.layers)
		document.id.display = status_str;
	else 
		document.all.id.style.display = status_str;
}



//-->