
// toggle function
// requires block id
function toggle(i)
  {
//  var t = document.getElementsById(i).style;
  var list = document.getElementsByTagName('div');
  for(a=0; a<list.length; a++)
    if(HTMLDivElement.prototype.isPrototypeOf(list.a)) alert('list.'+a+' is an HTMLDivElement type object');
    else  alert('list.'+a+' is NOT an HTMLDivElement type object');
//      if(list.a.className == 'navbut docs')
//        {
//        t = list.a.style;
//        if(t.display == 'block' || t.display == '') t.display = 'none'; else t.display = 'block';
//        }
  }
// functon to reload at the top if loaded as a frame
function amtop(){if(parent.frames[1])parent.location.href = self.location.href;}
// function to close the current browser window
function shut(){window.close();}
// verify that the page is being loaded under the index
function checktop(){var p1 = /index.php/;if(!p1.test(window.top.location)) window.top.location = 'index.php';}
// go to the indicated location
function gotoloc(loc){if(window.top.location != loc) window.top.location = loc;}
// Link not yet activated
function undercon(){alert("With apologies\n This part of the site has not yet been built.");}
// Link not available
function verboten(){alert("With apologies\n This part of the site may not be accessed at your current permissions level.");}

/*
function buttflat(num) {document.getElementById('b'+num).style.borderStyle = 'inset';}
function butthigh(num)
  {
  var a = document.getElementById('b'+num).style;
  a.color = '#900';
  a.borderColor = '#58A';
  a.borderWidth = '0.2em';
  a.backgroundColor = '#6AC';
  a.cursor = 'pointer';
  }
function buttunhigh(num)
  {
  var a = document.getElementById('b'+num).style;
  a.color = '#000';
  a.borderColor = '#000';
  a.borderWidth = '0px';
  a.backgroundColor = 'transparent';
  a.cursor = 'hand';
  }
// email form validation
function validate()
  {
  with (document.forms["emailform"])
    {
    if(msgName.value == ""){alert("Name absent - please supply your name"); return false;}
    if(msgemail.value == ""){alert("Email absent - please supply an email address for a reply.");return false;}
    var pattern = /^[^@^\s]+@{1}[^@\s\.]+\.{1}[^@\s]+$/;
    if(!pattern.test(msgemail.value)){alert("Email invalid\n---------------\n The email address must be of the form:\n[any text including .]@[any text].[any text including .]\nwith no spaces.");return false;}
    var pattern = /^.+/;
    if(!pattern.test(msg.value)){alert("Please enter a message so that we know what you want.");return false;}
    }
  return true;
  }
// login form validation
function validate2()
  {
  with (document.forms["loginform"])
    {
    if(n.value == ""){alert("Name absent - please supply your character's name");return false;}
    if(p.value == ""){alert("Password absent - please supply your password (email the site administrator to obtain one).");return false;}
    }
  return true;
  }
// forum post form validation
function validate3()
  {
  with (document.forms["forumpost"])
    {
    var pattern = /^.+/;
    if(!pattern.test(msgcontent.value)){alert("Please enter a message.");return false;}
    }
  return true;
  }
// poll creation form validation
function validate4()
  {
  with (document.forms["newpoll"])
    {
    var pattern = /^.+/;
    if(!pattern.test(polltext.value)){alert("Please enter a title.");return false;}
    if(!pattern.test(opt1.value)){alert("Please enter text for the first option.");return false;}
    if(!pattern.test(opt2.value)){alert("Please enter text for the second option.");return false;}
    }
  return true;
  }
// registration form validation
function validate5()
  {
  with (document.forms["registerform"])
    {
    if(n.value == ""){alert("Login Name absent - please supply your character's name");return false;}
    if(e.value == ""){alert("Email absent - please supply an email address");return false;}
    if(r.value == ""){alert("Real Name absent - please supply your real name");return false;}
    var pattern = /^[^@^\s]+@{1}[^@\s\.]+\.{1}[^@\s]+$/;
    if(!pattern.test(e.value)){alert("Email invalid\n---------------\n The email address must be of the form:\n[any text including .]@[any text].[any text including .]\nwith no spaces.");return false;}
    }
  return true;
  }
// character edit form validation
function validate6()
  {
  with (document.forms["chareditform"])
    {
    if(n.value == ""){alert("Login Name absent - please supply your character's name");return false;}
    if(e.value == ""){alert("Email absent - please supply an email address");return false;}
    if(p.value.length < 5){alert("Password too short - please supply a password of at least 5 letters");return false;}
    if(r.value == ""){alert("Real Name absent - please supply your real name");return false;}
    var pattern = /^[^@^\s]+@{1}[^@\s\.]+\.{1}[^@\s]+$/;
    if(!pattern.test(e.value)){return confirm("Email may be invalid - please confirm.\n---------------\n If you have a fleet email only the part before the @ symbol is needed. \n Otherwise the email address must be of the form:\n[any text including .]@[any text].[any text including .]\nwith no spaces.");}
    }
  return true;
  }
  
function scrollit(id,num)
  {
  var divtomove = document.getElementById(id);
  var curtop = parseInt(divtomove.style.top);
  alert(divtomove.style.top);
  divtomove.style.top = (curtop+num)+'px';
  }

flag=0;
function rescale()
  {
  if(flag == 0) alert('View Area dimensions: '+document.getElementById('bod').offsetHeight+' high by '+document.getElementById('bod').offsetWidth+' wide.');
  flag = 1;
  }
// non operational - line-heights are not recalculated!

// function to update the number of visible option input elements
function updateopts()
  {
  var c = parseInt(document.forms['newpoll'].optcount.value);
  if(!(c > 1 && c < 10)) { document.forms['newpoll'].optcount.value = 2; c = 2; }// reset the count if an invalid number is entered
  for(i=3;i<=c;i++) document.getElementById('o'+i).style['display'] = 'inline'; // show used options
  for(i=c+1;i<=9;i++) document.getElementById('o'+i).style['display'] = 'none'; // hide unused options
  }

// question form validation
function qfvalidate(pgph)
  {
  with (document['faqform'+pgph])
    {
    if(msgName.value == ""){alert("Name absent - please supply your name"); return false;}
    if(msgEmail.value == ""){alert("Email absent - please supply an email address.");return false;}
    var pattern = /^[^@^\s]+@{1}[^@\s\.]+\.{1}[^@\s]+$/;
    if(!pattern.test(msgEmail.value)){alert("Email invalid\n---------------\n The email address must be of the form:\n[any text including .]@[any text].[any text including .]\nwith no spaces.");return false;}
    var pattern = /^.+/;
    if(!pattern.test(msg.value)){alert("Please enter a message so that we know what you want.");return false;}
    if(msg.value.length>255){alert("Please shorten the message, perhaps by simplifying what you are asking about.");return false;}
    if(msg.value.length<10){alert("The message appears to be a little short, please elaborate.");return false;}
    }
  return true;
  }

// function to add a prompted password to a url
function getpass(hr)
  {
  ps = prompt('Please enter the password for this function.');
  hr.href += '&pass='+ps;
  return true;
  }


function showall()
  {
  var s = document.getElementById('show');
  var list = document.getElementsByTagName('div');
  if(s.innerHTML == strings[3])
    {
    for(a in list) if(HTMLElement.prototype.isPrototypeOf(list[a]) && list[a].className == 'faq') show(parseInt(list[a].id.replace('f','')),0);
    s.innerHTML = strings[4];
    }
  else
    {
    for(a in list) if(HTMLElement.prototype.isPrototypeOf(list[a]) && list[a].className == 'faq') hide(parseInt(list[a].id.replace('f','')),0);
    s.innerHTML = strings[3];
    }
  }
*/
