var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}

function validateForm(myform) {
var themessage = "Verified";

if (myform.interest.value.length < 1){
findDOM('Warning',1).display="block";
writetoLyr('Registration', '<li type=disc>You Must Choose a Seminar.</li>');
themessage = themessage + " Not";
}
else {
writetoLyr('Registration', '<img src=\"spacer.gif\" width=1 height=1>');
}

if (myform.company.value.length < 1){
findDOM('Warning',1).display="block";
writetoLyr('Company', '<li type=disc>Company Name</li>');
themessage = themessage + " Not";
}
else {
writetoLyr('Company', '<img src=\"spacer.gif\" width=1 height=1>');
}

if (myform.name.value.length < 1){
findDOM('Warning',1).display="block";
writetoLyr('Name', '<li type=disc>Your Name</li>');
themessage = themessage + " Not";
}
else {
writetoLyr('Name', '<img src=\"spacer.gif\" width=1 height=1>');
}

phonenumlength = myform.area.value.length + myform.exchange.value.length + myform.number.value.length;
if (phonenumlength != 10){
findDOM('Warning',1).display="block";
writetoLyr('Phone', '<li type=disc>Phone Number (Must be 10 characters in length)</li>');
themessage = themessage + " Not";
}
else {
writetoLyr('Phone', '<img src=\"spacer.gif\" width=1 height=1>');
}

if (myform.email.value.search("@") == -1 || myform.email.value.search("[.*]") == -1){
findDOM('Warning',1).display="block";
writetoLyr('Email', '<li type=disc>Email Address (Must be a valid email address)</li>');
themessage = themessage + " Not";
}
else {
writetoLyr('Email', '<img src=\"spacer.gif\" width=1 height=1>');
}

if (themessage == "Verified") {
writetoLyr('Warning', '<font class=bigred><b>Thank You. Please wait as we send the email.</b>');
myform.submit();
}
else {
return false;
}
}