function validCount1(blankOK)
{
if (blankOK) if ( document.form1.v_sel1_count.value.length < 1 ) return true

 var num_copies = document.form1.v_selection_1.value
 var new_num_copies = num_copies.substring(0,2)
 
 if (parseInt(new_num_copies,10) > 10)
 {
  new_num_copies = new_num_copies.substring(0,1)
 }
 
 if (parseInt(document.form1.v_selection_1.value,10) == 0)
 {
  alert ("Please select a Publication before entering the number of copies.")
  document.form1.v_sel1_count.value = 0
  document.form1.v_sel1_count.focus()
  return false
 }
 else
 {
  
  if (parseInt(document.form1.v_sel1_count.value,10) > parseInt(new_num_copies,10))
  {
   alert ("Note: The maximum number of copies is " + new_num_copies + " for this publication.\n\nIf you require more, please send a request in writing noting the reason for your request to:\n\nU.S. Dept. of Labor\nESA/Wage & Hour Division\nCentral Forms and Publications Center\nRoom S3513\n200 Constitution Avenue, NW\nWashington, DC 20210\n\nor fax to: 202-693-1407.");
   document.form1.v_sel1_count.value = new_num_copies
   document.form1.v_sel1_count.focus()
   return false
  }
  else
   return true
 }
}

function validCount2(blankOK)
{
if (blankOK) if ( document.form1.v_sel2_count.value.length < 1 ) return true

 var num_copies = document.form1.v_selection_2.value
 var new_num_copies = num_copies.substring(0,2)
 
 if (parseInt(new_num_copies,10) > 10)
 {
  new_num_copies = new_num_copies.substring(0,1)
 }
 
 if (parseInt(document.form1.v_selection_2.value,10) == 0)
 {
  alert ("Please select a Publication before entering the number of copies.")
  document.form1.v_sel2_count.value = 0
  document.form1.v_sel2_count.focus()
  return false
 }
 else
 {
  if (parseInt(document.form1.v_sel2_count.value,10) > parseInt(new_num_copies,10))
  {
   alert ("Note: The maximum number of copies is " + new_num_copies + " for this publication.\n\nIf you require more, please send a request in writing noting the reason for your request to:\n\nU.S. Dept. of Labor\nESA/Wage & Hour Division\nCentral Forms and Publications Center\nRoom S3513\n200 Constitution Avenue, NW\nWashington, DC 20210\n\nor fax to: 202-693-1407.");
   document.form1.v_sel2_count.value = new_num_copies
   document.form1.v_sel2_count.focus()
   return false
  }
  else
   return true
 }
}

function validCount3(blankOK)
{
if (blankOK) if ( document.form1.v_sel3_count.value.length < 1 ) return true

 var num_copies = document.form1.v_selection_3.value
 var new_num_copies = num_copies.substring(0,2)
 
 if (parseInt(new_num_copies,10) > 10)
 {
  new_num_copies = new_num_copies.substring(0,1)
 }
 
 if (parseInt(document.form1.v_selection_3.value,10) == 0)
 {
  alert ("Please select a Publication before entering the number of copies.")
  document.form1.v_sel3_count.value = 0
  document.form1.v_sel3_count.focus()
  return false
 }
 else
 {
  if (parseInt(document.form1.v_sel3_count.value,10) > parseInt(new_num_copies,10))
  {
   alert ("Note: The maximum number of copies is " + new_num_copies + " for this publication.\n\nIf you require more, please send a request in writing noting the reason for your request to:\n\nU.S. Dept. of Labor\nESA/Wage & Hour Division\nCentral Forms and Publications Center\nRoom S3513\n200 Constitution Avenue, NW\nWashington, DC 20210\n\nor fax to: 202-693-1407.");
   document.form1.v_sel3_count.value = new_num_copies
   document.form1.v_sel3_count.focus()
   return false
  }
  else
   return true
 }
}

function validCount4(blankOK)
{
if (blankOK) if ( document.form1.v_sel4_count.value.length < 1 ) return true

 var num_copies = document.form1.v_selection_4.value
 var new_num_copies = num_copies.substring(0,2)
 
 if (parseInt(new_num_copies,10) > 10)
 {
  new_num_copies = new_num_copies.substring(0,1)
 }
 
 if (parseInt(document.form1.v_selection_4.value,10) == 0)
 {
  alert ("Please select a Publication before entering the number of copies.")
  document.form1.v_sel4_count.focus()
  return false
 }
 else
 {
  if (parseInt(document.form1.v_sel4_count.value,10) > parseInt(new_num_copies,10))
  {
   alert ("Note: The maximum number of copies is " + new_num_copies + " for this publication.\n\nIf you require more, please send a request in writing noting the reason for your request to:\n\nU.S. Dept. of Labor\nESA/Wage & Hour Division\nCentral Forms and Publications Center\nRoom S3513\n200 Constitution Avenue, NW\nWashington, DC 20210\n\nor fax to: 202-693-1407.");
   document.form1.v_sel4_count.value = new_num_copies
   document.form1.v_sel4_count.focus()
   return false
  }
  else
   return true
 }
}
function validCount5(blankOK)
{
if (blankOK) if ( document.form1.v_sel5_count.value.length < 1 ) return true

 
 var num_copies = document.form1.v_selection_5.value
 var new_num_copies = num_copies.substring(0,2)
 
 if (parseInt(new_num_copies,10) > 10)
 {
  new_num_copies = new_num_copies.substring(0,1)
 }
 
 if (parseInt(document.form1.v_selection_5.value,10) == 0)
 {
  alert ("Please select a Publication before entering the number of copies.")
  document.form1.v_sel5_count.focus()
  return false
 }
 else
 {
  if (parseInt(document.form1.v_sel5_count.value,10) > parseInt(new_num_copies,10))
  {
   alert ("Note: The maximum number of copies is " + new_num_copies + " for this publication.\n\nIf you require more, please send a request in writing noting the reason for your request to:\n\nU.S. Dept. of Labor\nESA/Wage & Hour Division\nCentral Forms and Publications Center\nRoom S3513\n200 Constitution Avenue, NW\nWashington, DC 20210\n\nor fax to: 202-693-1407.");
   document.form1.v_sel5_count.focus()
   return false
  }
  else
   return true
 }
}

function validselection1(blankOK)
{
Index_counter = document.form1.v_selection_1.selectedIndex
if (blankOK) if ( document.form1.v_selection_1.options[Index_counter].value == 0 ) return true

Index_counter2 = document.form1.v_selection_2.selectedIndex
Index_counter3 = document.form1.v_selection_3.selectedIndex
Index_counter4 = document.form1.v_selection_4.selectedIndex
Index_counter5 = document.form1.v_selection_5.selectedIndex

if (Index_counter2 > 0)
{
 select_value2 = document.form1.v_selection_2.options[Index_counter2].value
 if (document.form1.v_selection_1.options[Index_counter].value ==  select_value2)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_1.value = "0"
  document.form1.v_selection_1.focus()
  return false
 }
}

if (Index_counter3 > 0)
{
 select_value3 = document.form1.v_selection_3.options[Index_counter3].value
 if (document.form1.v_selection_1.options[Index_counter].value ==  select_value3)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_1.value = "0"
  document.form1.v_selection_1.focus()
  return false
 }
}

if (Index_counter4 > 0)
{
 select_value4 = document.form1.v_selection_4.options[Index_counter4].value
 if (document.form1.v_selection_1.options[Index_counter].value ==  select_value4)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_1.value = "0"
  document.form1.v_selection_1.focus()
  return false
 }
}

if (Index_counter5 > 0)
{
 select_value5 = document.form1.v_selection_5.options[Index_counter5].value
 if (document.form1.v_selection_1.options[Index_counter].value ==  select_value5)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_1.value = "0"
  document.form1.v_selection_1.focus()
  return false
 }
 else
  return true
}  
else
 return true

}

function validselection2(blankOK)
{
Index_counter = document.form1.v_selection_2.selectedIndex
if (blankOK) if ( document.form1.v_selection_2.options[Index_counter].value == 0 ) return true

Index_counter1 = document.form1.v_selection_1.selectedIndex
Index_counter3 = document.form1.v_selection_3.selectedIndex
Index_counter4 = document.form1.v_selection_4.selectedIndex
Index_counter5 = document.form1.v_selection_5.selectedIndex

if (Index_counter1 > 0)
{
 select_value1 = document.form1.v_selection_1.options[Index_counter1].value
 if (document.form1.v_selection_2.options[Index_counter].value ==  select_value1)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_2.value = "0"
  document.form1.v_selection_2.focus()
  return false
 }
}

if (Index_counter3 > 0)
{
 select_value3 = document.form1.v_selection_3.options[Index_counter3].value
 if (document.form1.v_selection_2.options[Index_counter].value ==  select_value3)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_2.value = "0"
  document.form1.v_selection_2.focus()
  return false
 }
}

if (Index_counter4 > 0)
{
 select_value4 = document.form1.v_selection_4.options[Index_counter4].value
 if (document.form1.v_selection_2.options[Index_counter].value ==  select_value4)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_2.value = "0"
  document.form1.v_selection_2.focus()
  return false
 }
}

if (Index_counter5 > 0)
{
 select_value5 = document.form1.v_selection_5.options[Index_counter5].value
 if (document.form1.v_selection_2.options[Index_counter].value ==  select_value5)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_2.value = "0"
  document.form1.v_selection_2.focus()
  return false
 }
 else
  return true
}  
else
 return true

}

function validselection3(blankOK)
{
Index_counter = document.form1.v_selection_3.selectedIndex
if (blankOK) if ( document.form1.v_selection_3.options[Index_counter].value == 0 ) return true

Index_counter1 = document.form1.v_selection_1.selectedIndex
Index_counter2 = document.form1.v_selection_2.selectedIndex
Index_counter4 = document.form1.v_selection_4.selectedIndex
Index_counter5 = document.form1.v_selection_5.selectedIndex

if (Index_counter1 > 0)
{
 select_value1 = document.form1.v_selection_1.options[Index_counter1].value
 if (document.form1.v_selection_3.options[Index_counter].value ==  select_value1)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_3.value = "0"
  document.form1.v_selection_3.focus()
  return false
 }
}

if (Index_counter2 > 0)
{
 select_value2 = document.form1.v_selection_2.options[Index_counter2].value
 if (document.form1.v_selection_3.options[Index_counter].value ==  select_value2)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_3.value = "0"
  document.form1.v_selection_3.focus()
  return false
 }
}

if (Index_counter4 > 0)
{
 select_value4 = document.form1.v_selection_4.options[Index_counter4].value
 if (document.form1.v_selection_3.options[Index_counter].value ==  select_value4)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_3.value = "0"
  document.form1.v_selection_3.focus()
  return false
 }
}

if (Index_counter5 > 0)
{
 select_value5 = document.form1.v_selection_5.options[Index_counter5].value
 if (document.form1.v_selection_3.options[Index_counter].value ==  select_value5)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_3.value = "0"
  document.form1.v_selection_3.focus()
  return false
 }
 else
  return true
}  
else
 return true

}

function validselection4(blankOK)
{
Index_counter = document.form1.v_selection_4.selectedIndex
if (blankOK) if ( document.form1.v_selection_4.options[Index_counter].value == 0 ) return true

Index_counter1 = document.form1.v_selection_1.selectedIndex
Index_counter2 = document.form1.v_selection_2.selectedIndex
Index_counter3 = document.form1.v_selection_3.selectedIndex
Index_counter5 = document.form1.v_selection_5.selectedIndex

if (Index_counter1 > 0)
{
 select_value1 = document.form1.v_selection_1.options[Index_counter1].value
 if (document.form1.v_selection_4.options[Index_counter].value ==  select_value1)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_4.value = "0"
  document.form1.v_selection_4.focus()
  return false
 }
}

if (Index_counter2 > 0)
{
 select_value2 = document.form1.v_selection_2.options[Index_counter2].value
 if (document.form1.v_selection_4.options[Index_counter].value ==  select_value2)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_4.value = "0"
  document.form1.v_selection_4.focus()
  return false
 }
}

if (Index_counter3 > 0)
{
 select_value3 = document.form1.v_selection_3.options[Index_counter3].value
 if (document.form1.v_selection_4.options[Index_counter].value ==  select_value3)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_4.value = "0"
  document.form1.v_selection_4.focus()
  return false
 }
}

if (Index_counter5 > 0)
{
 select_value5 = document.form1.v_selection_5.options[Index_counter5].value
 if (document.form1.v_selection_4.options[Index_counter].value ==  select_value5)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_4.value = "0"
  document.form1.v_selection_4.focus()
  return false
 }
 else
  return true
}  
else
 return true

}

function validselection5(blankOK)
{
Index_counter = document.form1.v_selection_5.selectedIndex
if (blankOK) if ( document.form1.v_selection_5.options[Index_counter].value == 0 ) return true

Index_counter1 = document.form1.v_selection_1.selectedIndex
Index_counter2 = document.form1.v_selection_2.selectedIndex
Index_counter3 = document.form1.v_selection_3.selectedIndex
Index_counter4 = document.form1.v_selection_4.selectedIndex

if (Index_counter1 > 0)
{
 select_value1 = document.form1.v_selection_1.options[Index_counter1].value
 if (document.form1.v_selection_5.options[Index_counter].value ==  select_value1)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_5.value = "0"
  document.form1.v_selection_5.focus()
  return false
 }
}

if (Index_counter2 > 0)
{
 select_value2 = document.form1.v_selection_2.options[Index_counter2].value
 if (document.form1.v_selection_5.options[Index_counter].value ==  select_value2)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_5.value = "0"
  document.form1.v_selection_5.focus()
  return false
 }
}

if (Index_counter3 > 0)
{
 select_value3 = document.form1.v_selection_3.options[Index_counter3].value
 if (document.form1.v_selection_5.options[Index_counter].value ==  select_value3)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_5.value = "0"
  document.form1.v_selection_5.focus()
  return false
 }
}

if (Index_counter4 > 0)
{
 select_value4 = document.form1.v_selection_4.options[Index_counter4].value
 if (document.form1.v_selection_5.options[Index_counter].value ==  select_value4)
 {
  alert ("I'm Sorry you have already chosen this publication, please select a different publication")
  document.form1.v_selection_5.value = "0"
  document.form1.v_selection_5.focus()
  return false
 }
 else
  return true
}  
else
 return true

}

function validArea_code (blankOK)
{
 var validChars = /^[0-9][0-9][0-9]$/
 var allValid = true
 if (blankOK) if ( document.form1.v_phone1.value.length < 1 ) return true
 
 if (validChars.exec(document.form1.v_phone1.value)!=null)
   return true
 else
 {
  allValid = false
  alert ("Please enter a 3-digit Area Code")
  document.form1.v_phone1.focus()
  return false
 }

}

function validPrefix (blankOK)
{
 var validChars = /^[0-9][0-9][0-9]$/
 var allValid = true
 if (blankOK) if ( document.form1.v_phone2.value.length < 1 ) return true
 
 if (validChars.exec(document.form1.v_phone2.value)!=null)
   return true
 else
 {
  allValid = false
  alert ("Please enter a 3-digit Prefix.")
  document.form1.v_phone2.focus()
  return false
 }

}

function validSuffix (blankOK)
{
 var validChars = /^[0-9][0-9][0-9][0-9]$/
 var allValid = true
 if (blankOK) if ( document.form1.v_phone3.value.length < 1 ) return true
 
 if (validChars.exec(document.form1.v_phone3.value)!=null)
   return true
 else
 {
  allValid = false
  alert ("Please enter a 4-digit Suffix.")
  document.form1.v_phone3.focus()
  return false
 }
}

function validZIP (blankOK)
{
 var validChars = "0123456789-"
 var allValid = true
 var numDashes = 0
 if (blankOK) if ( document.form1.v_zip_code.value.length < 1 ) return true
   for ( i = 0;  i < document.form1.v_zip_code.value.length;  i++ )
   {
   	ch = document.form1.v_zip_code.value.charAt(i)
   	for ( j = 0;  j < validChars.length;  j++ )
   	{
   		if ( ch == validChars.charAt(j) ) break
   		if ( j == (validChars.length - 1))
   		{
   			allValid = false
   			break
   		}
   	}
       if ( ch == "-" )
   	{
   		numDashes++
   		if ( i != 5 || document.form1.v_zip_code.value.length != 10 )
   		{
   			allValid = false
   			break
   		}
   	}
   }
   if ( numDashes == 0 && document.form1.v_zip_code.value.length != 5 )
   	allValid = false
   if ( !allValid )
   {
   	alert ("Please enter either a 5-digit ZIP code or a 5+4 ZIP code.")
   	document.form1.v_zip_code.focus()
   	return false
   }
   return true
  }

function validEmail(blankOK)
{
if (blankOK) if ( document.form1.v_email.value.length < 1 ) return true
var validChars = "@0123456789-_.,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
var allValid = true
var numAts = 0
for ( i = 0;  i < document.form1.v_email.value.length;  i++ )
{
	ch = document.form1.v_email.value.charAt(i)
	for ( j = 0;  j < validChars.length;  j++ )
	{
		if ( ch == validChars.charAt(j) ) break
		if ( j == (validChars.length - 1))
		{
			allValid = false
			break
		}
	}
    if ( ch == "@" )	numAts++
}
if ( numAts != 1 )
	allValid = false
if ( !allValid || document.form1.v_email.value.length == 1)
{
	alert ("Please enter a return email address of the form name@domain.")
	document.form1.v_email.focus()
	return false
}
return true
}

function validform( frm ) {
// force validation of all fields
var i
validated=true
for (i=0;i<frm.elements.length && validated;i++)
if (frm.elements[i].onchange!=null)
frm.elements[i].onchange()  // force execution of onchange event handler
return validated
}
