function disableAll(num){
  for(i=0;i<document.forms[num].elements.length;i++){
    document.forms[num].elements[i].disabled=true
  }
}

function enableAll(num){
  for(i=0;i<document.forms[num].elements.length;i++){
    document.forms[num].elements[i].disabled=false
  }
}

function alphaNum(){
  tempString=""
  good="0123456789abcdefghijklmnopqrustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0){
	  alert('Please enter letters and numbers only!')
	  event.srcElement.value=tempString
	  return
	}
	tempString+=event.srcElement.value.charAt(i)
  }  
}

function text(){
  //for (i=0;i<event.srcElement.value.length;i++){
 //   alert(escape(event.srcElement.value.charAt(i)))
 // }
  
  tempString=""
  good="*@$=,()!?abcdefghijklmnopqrustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ _&#;/1234567890\".\\'-’”"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0&&(escape(event.srcElement.value.charAt(i))!="%0D")&&(escape(event.srcElement.value.charAt(i))!="%0A")){
      //alert(event.srcElement.value.charAt(i))
	  alert('Sorry, you cannot use that character here!')
	  event.srcElement.value=tempString
	  return
	}
	tempString+=event.srcElement.value.charAt(i)
  }  
}

function emailChars(){
  good="abcdefghijklmnopqrustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890-.@"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0){
      //alert(event.srcElement.value.charAt(i))
      disableAll(0)
	  alert('Please check the e-mail address.\nIt contains an invalid character!')
      event.srcElement.disabled=false
      event.srcElement.focus()
	  enableAll(0)  
	  return
	}
  }  
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function checkWebsite(){
  if(!event.srcElement.value){
    return
  }
  myString=event.srcElement.value
  if(myString.indexOf("http://")<0){
    disableAll(0)
    alert('Please add http:// in front of the website address!')
    event.srcElement.disabled=false
    event.srcElement.focus()
    enableAll(0)
  }
}


function phone(){
  tempString=""
  good="0123456789 ()-"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0){
      //alert(event.srcElement.value.charAt(i))
	  alert('Please check the phone/fax number.\nIt contains an invalid character!')
	  event.srcElement.value=tempString
	  return
	}
	tempString+=event.srcElement.value.charAt(i)
  }
}

function numeric(){
  tempString=""
  good="0123456789"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0){
      //alert(event.srcElement.value.charAt(i))
	  alert('Please check input.\nOnly numbers are valid here!')
	  event.srcElement.value=tempString
	  return
	}
	tempString+=event.srcElement.value.charAt(i)
  }
}

function postal(){
  tempString=""
  good="abcdefghijklmnopqrustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -1234567890"
  for(i=0;i<event.srcElement.value.length;i++){
    if(good.indexOf(event.srcElement.value.charAt(i))<0){
      //alert(event.srcElement.value.charAt(i))
	  alert('Please check the Zip/Postal code.\n It contains an invalid character!')
	  event.srcElement.value=tempString
	  return
	}
	tempString+=event.srcElement.value.charAt(i)
  }  
}

<!--
function Validator(theForm)
{

  if (theForm.salutation.selectedIndex < 0)
  {
    alert("Please select one of the \"Salutation\" options.");
    theForm.salutation.focus();
    return (false);
  }

  if (theForm.salutation.selectedIndex == 0)
  {
    alert("The first \"Salutation\" option is not a valid selection.  Please choose one of the other options.");
    theForm.salutation.focus();
    return (false);
  }

  if (theForm.first_name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.first_name.focus();
    return (false);
  }

  if (theForm.first_name.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"First Name\" field.");
    theForm.first_name.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzfSOZsozYÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.first_name.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and whitespace characters in the \"First Name\" field.");
    theForm.first_name.focus();
    return (false);
  }

  if (theForm.last_name.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.last_name.focus();
    return (false);
  }

  if (theForm.last_name.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Last Name\" field.");
    theForm.last_name.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzfSOZsozYÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.last_name.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and whitespace characters in the \"Last Name\" field.");
    theForm.last_name.focus();
    return (false);
  }

// if (theForm.address.value == "")
// {
//    alert("Please enter a value for the \"Address\" field.");
//    theForm.address.focus();
//    return (false);
//  }
//
//  if (theForm.address.value.length < 3)
//  {
//    alert("Please enter at least 3 characters in the \"Address\" field.");
//    theForm.address.focus();
//    return (false);
//  }
//
  if (theForm.city.value == "")
  {
    alert("Please enter a value for the \"city\" field.");
    theForm.city.focus();
    return (false);
  }

  if (theForm.city.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"city\" field.");
    theForm.city.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzfSOZsozYÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var checkStr = theForm.city.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter and whitespace characters in the \"city\" field.");
    theForm.city.focus();
    return (false);
  }

  if (theForm.state_country_name.selectedIndex < 0)
  {
    alert("Please select one of the \"State\", \"Province\" or \"Country\" options.");
    theForm.state_country_name.focus();
    return (false);
  }

  if (theForm.state_country_name.selectedIndex == 0)
  {
    alert("Please select one of the \"State\", \"Province\" or \"Country\" options.");
    theForm.state_country_name.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length > 50)
  {
    alert("Please enter at most 50 characters in the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }
  return (true);
}
//-->
