function toggleMAC(){
		
	  obj= document.getElementById('a1');
      alert(obj.className.value);
}      
      
function toggleDisplay() { 
if( document.getElementById("a2").style.display == "none" ) {
    document.getElementById("a2").style.display = "block";
    document.getElementById("a3").style.display = "block"; 
  } else { 
    document.getElementById("a2").style.display = "none"; 
	document.getElementById("a3").style.display = "none"; 
	
	document.getElementById("mac2").value='';
	document.getElementById("mac3").value='';
  }
 }   

function toggleForm(which){
	
 
 	if(which == 1){
			Element.show($('p1'));
			Element.show($('p2'));
			Element.show($('p3'));
			Element.show($('p4'));
			Element.show($('p5'));
			Element.show($('p6'));
			Element.show($('p7'));
			Element.hide($('b1'));
		}

	if (which == 2){
		Element.hide($('p1'));
		Element.hide($('p2'));
		Element.hide($('p3'));
		Element.hide($('p4'));
		Element.hide($('p5'));
		Element.hide($('p6'));
		Element.hide($('p7'));
		Element.show($('b1'));
	}
	
	if (which == 3){
	
		Element.toggle($('p2'));
		Element.toggle($('p3'));
		Element.toggle($('p4'));
		Element.toggle($('p5'));

	}
	
	
	
}
 
 


function setCheckValue(chk ,chkfld){
	
	if (chk.checked) {
		document.form1.dist_known.value = 1;
	}else{
		document.form1.dist_known.value = 0;
	}
}

function checkMACformat(theMAC){
	ipaddr = theMAC.value;

	var re = /^[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}$/;
   if (re.test(ipaddr)) {
      return true;
   } else {
      return false;
   }

}

function testMac(){
		ipaddr = $F('mac1');
		

	
		var mac = /^[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}:?[0-9A-Fa-f]{2}$/;
		var can = /^00:?0[a|A]:?3[e|E]/;
		var allzero = /^00:?00:?00:?00:?00:?00:?/;
		var allff = /^[FF|ff]:?[FF|ff]:?[FF|ff]:?[FF|ff]:?[FF|ff]:?[FF|ff]:?/;
		var good = 0;


	   if (mac.test(ipaddr)) {  // its a valid MAC address at least
		
			if (can.test(ipaddr)) {
				alert('Cannot be a Canopy Radio');
			}else{
				
				if (allzero.test(ipaddr)) {
					alert('Cannot be all zeros');
				}else{
					if (allff.test(ipaddr)) {
						alert('Cannot be all FF\'s');
					}else{
						alert('Valid MAC address');	
					};
				
				};
			}
	     
	   } else {
	      alert('Must be at least 12 characters 0-9, A-F\nwith or without colons as delimiters\neg:XX:XX:XX:XX:XX:XX or XXXXXXXXXXXX');
	   }

}

function checkField( oInput ) {
	return oInput.value;
}

function checkForm( theForm, thePage ) {

	if(thePage == 1){
	
		if (!checkField( theForm.cust_name ) ) {
			window.alert( 'You have not entered your Name.' );
			return false;
		}
		if (!checkField( theForm.cust_company ) ) {
			window.alert( 'You have not entered your Company name.' );
			return false;
		}
		if (!checkField( theForm.cust_address1 ) ) {
			window.alert( 'You have not entered your organization.' );
			return false;
		}
	
		if (!checkField( theForm.cust_city ) ) {
			window.alert( 'You have not entered your city.' );
			return false;
		}
		if (!checkField( theForm.cust_state ) ) {
			window.alert( 'You have not entered your state/ province.' );
			return false;
		}
		
		if (!checkField( theForm.cust_zip ) ) {
			window.alert( 'You have not entered your postal / ZIP code.' );
			return false;
		}
		
		if (!checkField( theForm.cust_country ) ) {
			window.alert( 'You have not entered your country.' );
			return false;
		}
		
		if (!checkField( theForm.cust_email ) ) {
			window.alert( 'You have not entered your email address.' );
			return false;
		}
		if (!checkField( theForm.cust_phone ) ) {
			window.alert( 'You have not entered your phone number.' );
			return false;
		}
		
	} // end PAGE 1

	if(thePage == 2){
		if (!checkField( theForm.acsp_name ) ) {
			window.alert( 'You have not entered the ACSPs Name.' );
			return false;
		}
	
		
		
		
	}// end PAGE 2
	
	if (thePage == 3 && !theForm.dist_check.checked){
	
		if (!checkField( theForm.dist_name ) ) {
			window.alert( 'You have not entered the Distributors Name.' );
			return false;
		}

	}// end PAGE 3
	
	
if(thePage == 4){
		rd = document.getElementById("rd").checked;
		
		if (rd){
			if (!checkField( theForm.mac1 ) ) {
				window.alert( 'You must enter all 3 addresses to use the Redundant Server Option.' );
				return false;
			}
			
			if (!checkMACformat( theForm.mac1 ) ) {
				window.alert( 'Address #1 is not a valid 12 digit MAC address in the form 00:00:00:00:00:00 or 000000000000' );
				return false;
			}
			
		
			if (!checkField( theForm.mac2 ) ) {
				window.alert( 'You must enter all 3 addresses to use the Redundant Server Option.' );
				return false;
			}
			
			if (!checkMACformat( theForm.mac2 ) ) {
				window.alert( 'Address #2 is not a valid 12 digit MAC address in the form 00:00:00:00:00:00 or 000000000000' );
				return false;
			}
		
			if (!checkField( theForm.mac3 ) ) {
				window.alert( 'You must enter all 3 addresses to use the Redundant Server Option.' );
				return false;
			}
			
			if (!checkMACformat( theForm.mac3 ) ) {
				window.alert( 'Address #3 is not a valid 12 digit MAC address in the form 00:00:00:00:00:00 or 000000000000' );
				return false;
			}
			
		}else{
				
			if (!checkField( theForm.mac1 ) ) {
					window.alert( 'You must enter 1 BAM Address' );
					return false;
			}
			
			if (!checkMACformat( theForm.mac1 ) ) {
				window.alert( 'The address is not a valid 12 digit MAC address in the form 00:00:00:00:00:00 or 000000000000' );
				return false;
			}
			
		}
	


	} //end PAGE 4
	
	
	
	
} // end Function