startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("menublock");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="DIV") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

window.onload=startList;


function mess() // Scramble email address
{
  var a,b,c,d,e

  a='<a hr'
  a+='ef=\"mai'
  b='w'
  b+='e'
  b+='bs'
  b+='ite'
  c='\">'
  a+='lto:'
  b+='@'
  e='</' + 'a>'
  d='webs'
  d+='ite@tuto'
  d+='rhunt.c'
  d+='om'
  b+='tutorhunt.com'

  document.write(a+b+c+d+e)
}

function addto()
{
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4))
    window.external.AddFavorite("http://www.tutorhunt.com", "Tutor Hunt");
  else
  {
    var msg = "Sorry we could not bookmark Tutor Hunt automatically.";
    if(navigator.appName == "Netscape") msg += " [Please press CTRL+D]";
    javascript:alert(msg);
  }
}


function validatesearch(signupform)
{
   var error_list = false
   var errors = ""
   if (signupform.subject.value == "none")
   {
     error_list = true
     errors = errors + "-> Please select a subject\n"
   }

   if (signupform.type.value == "none")
   {
     error_list = true
     errors = errors + "-> Please select a student or tutor\n"
   }

   if (signupform.level.value == "none")
   {
     error_list = true
     errors = errors + "-> Please select a level\n"
   }

   if (signupform.postcode.value == "" || signupform.postcode.value == "Postcode")
   {
     error_list = true
     errors = errors + "-> Please select a postcode\n"
   }

   if (error_list == false)
     signupform.submit();
   else
     alert("Sorry there was a problem with the form data, the following error(s) occured;\n\n" + errors)
}



function IsNumeric(strString)
//  check for valid numeric strings
{
          var strValidChars = "£0123456789. ";
          var strChar;
          var blnResult = true;

          if (strString.length == 0) return false;

            for (i = 0; i < strString.length && blnResult == true; i++)
            {
              strChar = strString.charAt(i);
              if (strValidChars.indexOf(strChar) == -1)
              {
                blnResult = false;
              }
            }
            return blnResult;
}


function openprofilepic(userpic)
{
  popupWin = window.open(userpic, 'open_window', 'toolbar,scrollbars,resizable,dependent,width=560,height=415,left=0,top=0')
}

function toggletextdisplay(myItem, myButton)
{
  olditem = myItem
  var myItem = document.getElementById(myItem);

  var el = document.getElementById(myButton)
  if (myItem.style.display != "none")
  {
    myItem.style.display = "none";
    el.innerHTML = "<img src=\"http://www.tutorhunt.com/box-plus.gif\" alt =\"+\" />"
  }
  else
  {
    el.innerHTML = "<img src=\"http://www.tutorhunt.com/box-minus.gif\" alt =\"-\" />"
    myItem.style.display = "block";
  }
}

