// Global variables
var logURL       = "http://www.etherica.net/cgi-bin/loadimage.pl";

var ownerName    = "Kim Hyland";
var businessName = "Denver Wigs Plus";
var companyName  = "Professional Hair Institute";
var companyAddr1 = "6740 E Hampden Ste #102";
var companyAddr2 = "Denver, CO 80224";
var companyPhone = "(303) 782-4858";
var companyFax   = "(303) 782-4877";
var infoEmail    = "";
var salesEmail   = "";

// Tracking years
var today = new Date();
var yearsSurviving =  today.getElapsedYears(1992);
var yearsExperience = today.getElapsedYears(1977);

function displayNewWindow(theWebSite) {
  win =   window.open(theWebSite,"website","toolbar,menubar,scrollbars,resizable,status,location,copyhistory,directories,width=700,height=500");
}

// Display sample web sites
function displaySample(theWebsite) {
  var winDow = window.open(theWebsite,'samplewebsite','toolbar,status,menubar,resizable,scrollbars, height=600,width=800');
}

// For dynamic button depressons.
function changePic (oldName, newName) {
  if (document.images) {
    newSource = eval (newName + ".src");
    document [oldName].src = newSource;
  }
  if (changePic.arguments.length == 2) {
    self.status = changePic.arguments[2];
    return true;
  }
}

// Display update date
function displayUpdate() {
  document.write('<span class="comment"><b>Updated:</b> '+document.lastModified+'</span>');
}

// Log visit - don't include any personal information
function logVisit() {
  document.write('<img src="'+logURL+'" width="1" height="1">');
}

// Validate email form
function checkemailform (form) {
  if (form.email.value == "") {
    alert("Missing email address. Please enter your email address.");
    form.email.focus();
    return false;
  }
  // Check for malformed email address
  var str = form.email.value;
  var ead=/.+\@.+\..{2,4}/ig;
  if (!str.match(ead)) {
    form.email.value = prompt("The email address you provided appears to be malformed. Correct if necessary and click OK.",str);
    form.email.focus();
  }
  // Check for comments
  if (form.comments.value == "") {
    alert("Missing question or comments. Please enter your question or comments.");
    form.comments.focus();
    return false;
  }
}
