// Rollover Pre-loads
header_purchase_off = new Image
header_purchase_on = new Image
header_demo_off = new Image
header_demo_on = new Image
header_contact_off = new Image
header_contact_on = new Image
navigation_secondary_off = new Image
navigation_secondary_on = new Image

header_purchase_off = "images/header_purchase_off.gif"
header_purchase_on = "images/header_purchase_on.gif"
header_demo_off = "images/header_demo_off.gif"
header_demo_on = "images/header_demo_on.gif"
header_contact_off = "images/header_contact_off.gif"
header_contact_on = "images/header_contact_on.gif"
navigation_secondary_off = "images/navigation_secondary_off.gif"
navigation_secondary_on = "images/navigation_secondary_on.gif"

if (document.images)
    {
	  button_submit_off = new Image
	  button_submit_on = new Image
	  button_reset_off = new Image
	  button_reset_on = new Image
	  button_submit_off.src = "images/button_submit_off.gif"
	  button_submit_on.src = "images/button_submit_on.gif"
	  button_reset_off.src = "images/button_reset_off.gif"
	  button_reset_on.src = "images/button_reset_on.gif"
	}
	else 
	{
	  button_submit_off = ""
	  button_submit_on = ""
	  button_reset_off = ""
	  button_reset_on = ""
	}

// Pop-up Medium Size Window
function openmedium(url)
  { 
  if ((navigator.appVersion.indexOf("Mac") != -1)) 
    { 
    nwW = window.open(url,"openmedium","toolbar=no,scrollbars=yes,width=300,height=400")
    } 
  else 
    { 
    nwW = window.open(url,"openmedium","toolbar=no,scrollbars=yes,width=327,height=400")
    } 
  }

// Pop-up Large Size Window
function openlarge(url) 
    {
    nwW = window.open(url,"opensmall","toolbar=no,scrollbars=no,width=700,height=590")
    self.name = "main";
    }

// Pop-up T.H.E. Journal Size Window
function openjournal(url)
  { 
  nwW = window.open(url,"openjournal","toolbar=no,scrollbars=yes,width=685,height=800")
  }

// Pop-up Mathematics Teacher Size Window
function openmathematics(url)
  { 
  nwW = window.open(url,"openmathematics","toolbar=no,scrollbars=no,width=625,height=450")
  }

// Navigation Rollover Effect
function SwitchMenu(obj)
  {
  if(document.getElementById)
    {
	var elmnt = document.getElementById(obj);
	var area = document.getElementById("nav").getElementsByTagName("DIV");
	if(elmnt.style.display == "none")
	  {
	  for (var i=0; i<area.length; i++)
	    {
		area[i].style.display = "none";
		}
	  elmnt.style.display = "block";
	  }
	else
	  {
	  elmnt.style.display = "none";
	  }
    }
  }

function ChangeClass(menu, newClass) 
  {
  if (document.getElementById)
    { 
	document.getElementById(menu).className = newClass;
	} 
  }

document.onselectstart = new Function("return true");

//Form Validations
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function FormValidator(theForm)
{

  if (theForm.email.value == "")
  {
    alert("Please enter your e-mail address.");
    theForm.email.focus();
    return (false);
  }

  if (!isEmailAddr(theForm.email.value))
  {
    alert("Please enter a complete e-mail address in the form: yourname@yourdomain.com");
    theForm.email.focus();
    return (false);
  }
    
  return (true);
}

  




  