function randomNumber(number)
{
	return parseInt(number * Math.random()+1);
}
	
function genImage()
{
	var num=5;
	var markup='';
	for(var i=0; i<num; i++)
	{
		img = randomNumber(10)-1;
		markup += '<img id="img'+i+'" src="forms/validation/'+img+'.png" alt="'+img+'" />'
	}
	document.getElementById('numImages').innerHTML=markup;
}

function validate(form) 
{
	if(form.single.checked == false && form.multi.checked == false) // Checks if both are not checked
	{
		alert('Please select Single Section or Multi Section Enrollments.')
		form.single.focus();
		return false;
	}
		
	if (form.requestorname.value == '') // Checks if there is text in the name textbox
	{
		alert('Please enter your name.')
		form.requestorname.focus();
		return false;
	}
	
	if (form.username.value == '') // Checks if there is text in the username textbox
	{
		alert('Please enter your Blackboard Username.')
		form.username.focus();
		return false;
	}
	
	if (form.email.value == '') // Checks if there is text in the email textbox
	{
		alert('Please enter your e-mail address.  We need it to send you a confirmation.')
		form.email.focus();
		return false;
	}
	
	if (form.status.value == 0) // Checks if an Instructor Status was chosen
	{
	   alert('Please specify the status of the instructor')
	   form.status.focus();
	   return false;
	}
	
	if (form.destinationcoursecode.value == '') // Checks if there is text in the Destination Course Code textbox
	{
		alert('Please enter the destination course code.')
		form.destinationcoursecode.focus();
		return false;
	}
	
	if (form.destinationcoursetitle.value == '') // Checks if there is text in the Destination Course Title textbox
	{
		alert('Please enter the destination course title.')
		form.destinationcoursetitle.focus();
		return false;
	}
	
	if (form.destinationcrn.value == '') // Checks if there is text in the Destination CRN textbox
	{
		alert('Please enter the destination CRN.')
		form.destinationcrn.focus();
		return false;
	}
	
	if (form.destinationterm.value == 0) // Checks if a term was chosen
	{
	   alert('Please specify the term of this course')
	   form.destinationterm.focus();
	   return false;
	}
	
	if (form.college.value == 0) // Checks if a college was chosen
	{
	   alert('Please specify the college for this course') 
	   form.college.focus();
	   return false;
	}
	
	var altStr = (document.getElementById('img0').alt+document.getElementById('img1').alt+document.getElementById('img2').alt+document.getElementById('img3').alt+document.getElementById('img4').alt).toString();
	
	var formText = form.validtext.value;
	

	if (formText != altStr)
	{
		alert('Security digits incorrect.  Please enter the digits shown.') 
		form.validtext.focus();
		return false;
	}

}
