function activateBlurbField()
{
  var ref1 = document.getElementById("showblurb");
  var ref2 = document.getElementById("checkblurb");
  var str = 'To add a blurb link to database, you must ensure the page already exists in the website.\nPlease pay careful attention to the PATH of the blurb php page.\n\nFor example, if it is in www.aad.org.au/info/blurb.php, then your blurb page \nshould be specified as "/info/blurb.php". Note the forward slash at the front of it.';
  
  if (!confirm (str))
  {
    var obj = ref2.childNodes[1];
    obj.checked = false;
    return false;
  }

  ref1.style.display = 'block';
  ref2.style.display = 'none';
  return true;
}

function clearField(obj)
{
  var pattern = /^\[[\w\W]+\]$/; 
  var regMark = new RegExp(pattern);

  if (regMark.test(obj.value)) obj.value='';
  else false;
  
  return true;
}

function blurSearch(obj)
{
  if (obj.value=='')
  {
    obj.value='Enter Text';
    obj.style.backgroundColor='#F8F8FF';				
  }
}
  
function focusSearch(obj)
{
  if ((obj.value=='') || (obj.value=='Enter Text'))
  {
    obj.value='';
    obj.style.backgroundColor='#FFE';
  }
}

function resetSearch()
{
  var obj = document.getElementById("q");
  
  obj.value='Enter Text';
  obj.style.backgroundColor='#F8F8FF';
}

function goSearch()
{
  var obj=document.getElementById("q");

  if (obj.value=='Enter Text' || obj.value=='') return;
  obj.parentNode.parentNode.submit();
}

function RandomizeSplash()
{
  var maxN = 3;
  var r = Math.round(Math.random() * (maxN -1));
  var splash = new Array();
  
  // It is very important to ensure that the suffix is available to correctly complete the URL
  // You may need to do a trial and error experiment until you get the right URL

  var suffix = '/';  
  var url = 'http://' + location.hostname + suffix;  

  splash[0] = '<img src="' + url + 'graphics/splash1.gif" width="760" height="140" alt="Click to go home" title="Click to go home" style="display: block;" />';
  splash[1] = '<img src="' + url + 'graphics/splash2.gif" width="760" height="140" alt="Click to go home" title="Click to go home" style="display: block;" />';
  splash[2] = '<img src="' + url + 'graphics/splash3.gif" width="760" height="140" alt="Click to go home" title="Click to go home" style="display: block;" />';
  document.write('<a href="' + url + 'index.php" accesskey="h">' + splash[r] + '</a>');	
}

function clearForm(f)
{
  var i, fld;
  // Clear all form elements.

  for (i = 0; i < f.elements.length; i++)
  {
    fld = f.elements[i];
				
    if ((fld.type == "checkbox" || fld.type == "radio") && fld.checked) fld.checked = false;
    if (fld.type == "select-one" || fld.type == "select-multiple") fld.selectedIndex = 0;
    if (fld.type == "hidden" || fld.type == "password" || fld.type == "text" || fld.type == "textarea") fld.value = "";
  }
  return false;
}


// An array of colours that will be applied to H1 tags. 
var h1Cols = ['#CCC','#009933']; 

// Main script. 
var h1Arr = []; 

function h1Setup() 
{ 
  h1Arr = document.getElementsByTagName('h1'); 
  for (var h = 0; h < h1Arr.length; h++) 
  { 
    var h1 = h1Arr[h], text = h1.firstChild.nodeValue; 
    h1.removeChild(h1.firstChild); 
    h1.animNodes = []; 
    
    for (var i = 0; i < text.length; i++) 
    { 
      var span = document.createElement('span'); 
      span.appendChild(document.createTextNode(text.substring(i, i+1))); 
      h1.appendChild(span); 
      h1.animNodes[h1.animNodes.length] = span; 
    } 
    
    h1.animCount = 0; 
    h1.animTimer = setInterval('h1Anim(' + h + ')', 50); 
  } 
} 

function h1Anim(h) 
{ 
  var h1 = h1Arr[h], c = h1.animCount++, noAnim = 1; 

  for (var i = 0; i < h1.animNodes.length; i++) 
  { 
    var s = h1.animNodes[i], frac = Math.max(0, Math.min(1, (c-i)/10)), 
    marg = document.all && !window.opera ? 'marginRight' : 'marginLeft'; 

    if (s.animDone) continue; 
    noAnim = 0; 
    s.style.color = h1Cols[Math.floor(frac * h1Cols.length)]; 

    if (frac == 1) 
    { 
      s.style[marg] = '0'; 
      s.animDone = 1; 
    } 
    
    else s.style[marg] = 0.6*(1-frac) + 'em';
  } 

  if (noAnim) clearInterval(h1.animTimer); 
  h1.style.visibility = 'inherit'; 
} 

function centraliseLoad()
{
  h1Setup();
  initaliseMenu();
}

window.onload = centraliseLoad;

/*
if (document.documentElement) 
{ 
  // Hide H1 elements for animation and trigger show on load. 
//  document.write('<style type="text/css"> h1 { visibility: hidden } </style>'); 
  
		var h1aOL = window.onload; 
  window.onload = function() 
  { 
    if (h1aOL) h1aOL();
    h1Setup(); 
  } 
}
*/	
	

		