// builds the appropriate amount of up-a-level for the URL 
function levelsDeep(level) {
 var L = "";
 for (i = 1; i <= level; i++)
  {
  L = L + "../";
  }
 return L
}

//  'load' is deprecated, called from an href
function load(foo, level) {
 var mynewwindow = window.open(levelsDeep(level) + 'classDescriber.php?className=' + foo,foo,'scrollbars=1,menubar=no,height=400,width=650,resizable=1,toolbar=no,location=no,status=no');
 mynewwindow.focus();
}
 
 //  makes a callwithout the safety surpression call, called from an href
function showClass(foo, level) {
 var mynewwindow = window.open(levelsDeep(level) + 'classDescriber.php?className=' + foo,foo,'scrollbars=1,menubar=no,height=400,width=650,resizable=1,toolbar=no,location=no,status=no');
 mynewwindow.focus();
}

//  makes a call WITH the safety surpression call, called from an href
function showInfo(foo, level) {
 var mynewwindow = window.open(levelsDeep(level) + 'classDescriber.php?className=' + foo + '&surpressSafety=1',foo,'scrollbars=1,menubar=no,height=400,width=650,resizable=1,toolbar=no,location=no,status=no');
 mynewwindow.focus();
}

//  Calls item Describer to display an staffGallery Item
function showItem(foo, level) {
 var mynewwindow = window.open(levelsDeep(level) + 'itemDescriber.php?itemName=' + foo,"item",'scrollbars=1,menubar=no,height=580,width=750,resizable=1,toolbar=no,location=no,status=no');
 mynewwindow.focus();
}

//  Makes it easy to build a mail link, the body is optional(to put a return in the body, use %0a
function mailhide(name,subject,body,text) {
 var theBody =""
 var domain='prospecthillforge.com'; 
  if (body) {theBody = '\&body=' + body}
  if (text) { 
  document.write('<a href=\"mailto:' + name + '@' + domain +'\?Subject=' + subject + theBody +'\">' + text + '<' + '/a>.');
  }
 else {//sftp://ccw:@prospecthillforge.wiglaf.org//apps/home/phf/public_html/PHFjs.js
 document.write('<a href=\"mailto:' + name + '@' + domain +'\?Subject=' + subject + theBody +'\">' + name + '@' + domain + '<' + '/a>.');
 }
}

// *** Depricated*** the error was in my code (cw) all seems happy now. the calls to this have been commented out of the pages.
// Check for Internet explorer and add in a warning that Forms don't seem to work, and supply a mail-link

function IEFormWarn()
// determines whether and what version of Internet Explorer is being used
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }

  if ( rv > -1 )
 
  {
      document.write ("<p> ");
      document.write ("<big><strong><center> <p><br>");
      document.write ("Due to a bug in Internet Explorer it probably won't submit this form properly to our server.<br>");
      document.write ("<p></center></big></strong>");
      document.write ("Instead, please either send us an");
 document.write ("\n<a href=mailto:office@prospecthilforge.com\?Subject=\"From%20the%20" + encodeURI(document.title) + "%20page\"><big><big>email</big></big></a> ");
 
document.write ("\n with the information this form is asking for, or open this page in a different web browser.");
      document.write ("\n<p>We're really sorry about the inconvenience, but this is an incompatibility between Microsoft's software and our server that we are <span title=\"if we were web professionals instead of blacksmiths...\">currently unable to overcome</span>.<hr><p>");
  }
}
// *********   /Depricated   ************  

   
// checks to see if a pre-filled field has been changed from the default, if it hasn't, it blanks the field. used in an onfocus tag in form input fields

function fieldset(theObject,defaultValue)
{
if (theObject.value==defaultValue) {theObject.value='';}
}