

function countChoices(obj) {

max = 1; // max. number allowed at a time



box1 = obj.form.firewall.checked;  // your checkboxes here

box2 = obj.form.dmz.checked;





count = (box1 ? 1 : 0) + (box2 ? 1 : 0) ;

// If you have more checkboxes on your form

// add more  (box_ ? 1 : 0)  's separated by '+'



if (count > max) {

alert("Oops!  You can only select " + max + " choice! \nUncheck an option if you want to pick another.");

obj.checked = false;

   }

}




// This script focuses on the first input box.

function startHere()

	{

		document.dmzForm.sysadmin_name.focus();

		return true;

	}



// Check for valid email address: look for @ and .

function isEmail(elm) {

    if (elm.value.indexOf("@") != "-1" &&

	    elm.value.indexOf(".") != "-1") {

		return true;

    }

	else {

	    return false;

	}

}

//Check for blank fields

function isFilled(elm) {

    if (elm.value == "" || elm.value == null) {

	    return false;

	}

	else {

	    return true;

	}

}



//Check entire form

function isReady(form) {

    if (isFilled(form.sysadmin_name) == false) {          //A system administrator name?

	    alert("Please enter the System Administrator name.");			

	    form.sysadmin_name.focus();

		return false;

	}



    if (isEmail(form.sysadmin_email) == false) {          //A real system administrator email address?

	    alert("Please enter a valid email address.");			

	    form.sysadmin_email.focus();

		return false;

	}

	

	if (isFilled(form.sysadmin_phone) == false) {          //A system administrator phone?

	    alert("Please enter the System Administrator phone.");			

	    form.sysadmin_phone.focus();

		return false;

	}

	

	if (isFilled(form.system_name) == false) {             //A real system name?

	    alert("Please enter a system name.");			

	    form.system_name.focus();

		return false;

	}

	

   	if (isFilled(form.ip_address) == false) {             //A real system IP address?

        alert("Please enter a valid system IP address.");			

	    form.ip_address.focus();

		return false;

	}

	

	if (isFilled(form.approval) == false) {              //An approved authority name?

	    alert("Please enter the Approved Authority name.");			

	    form.approval.focus();

		return false;

	}

	

	if (isEmail(form.approval_email) == false) {       //An Approved Authority email address?

	    alert("Please enter a valid Approved Authority Email address.");			      

		form.approval_email.focus();

		return false;

	}



// Check status of checkboxes

   if (form.box1.checked == false && form.box2.checked == false) {

       alert("You must choose either:\n\n A. Move machine behind firewall\n\t or\n B. Move machine into DMZ \n\t and\n check 'I agree to the disclaimer.'");

	   return false;

	}



    if (form.box1.checked == true && form.agree.checked == false) {

       alert("You must check the 'I agree with the disclaimer' checkbox\n\n for this machine to be moved into the DMZ!");

	   return false;

	}



    if (form.box2.checked == true && form.agree.checked == false) {

       alert("You must check the 'I agree with the disclaimer' checkbox\n\n for this machine to be moved into the DMZ!");

	   return false;

	}



    if (isFilled(form.security) == false) {       //Must state your security counter measures.

	    alert("Please enter your security counter measures.");			      

		form.security.focus();

		return false;

	}

 

    if (isFilled(form.rq_purpose) == false) {       //Must state the purpose/justification for the request.

	    alert("Please enter your purpose/justification for this request.");			      

		form.rq_purpose.focus();

		return false;

	}

        return true;

}		

				
