  	// Initialize classes array to hold course dates in the form classes[month][day][year]
	var classes = new Array(13);
	for ( var i=1; i < classes.length; i++ )
		classes[i] = new Array(32);
	for ( var i=1; i < classes.length; i++ )
		for ( var j=1; j < 32; j++ )
			classes[i][j] = new Array(10);
		
	// This section of the code determines which dates have classes based on the month
	// Codes:
	//			cp 		= 2-Day Comptent Person
	//			cpf		= 2-Day Comptent Person - FULL
	//			ir 		= 2-Day Competent Rescuer
	//			irf 	= 2-Day Competent Rescuer - FULL
	//			si		= 1-Day Scaffold Inspector
	//			sif		= 1-Day Scaffold Inspector - FULL
	//			cs		= 2-Day Confined Space
	//			csf		= 2-Day Confined Space - FULL
	//			afp 	= 1-Day Authorized Person
	//			afpf	= 1-Day Authorized Person - FULL
	//			afpr 	= 1-Day Authorized Person at Shell Robert Training Center
	//			afprf	= 1-Day Authorized Person at Shell Robert Training Center - FULL
	//			faa		= 3-Day Expert Climber
	//			faaf	= 3-Day Expert Climber - FULL
	//			cfprt   = 3-Day Crane Fall Protection and Rescue Training
	//			cfprtf  = 3-Day Crane Fall Protection and Rescue Training - FULL
	//			cct		= 2-Day Competent Climber (Tower)
	
	// *NOTE*	Any Fall Protection Authorized Person Course with an m in front of its code, ex. mafp, is Moved back one day and starts the same day
	//			as another class.
	
	//			classes[month][day][year] where day is the first day of the class, ex. classes[24] = 'cp' is October 24th-25th, competent person class
	//  _NOTE_  only enter the first day for the class that will be going on, the code will fill in for the rest based
	//  		on what kind of class is being held
	
	// Only clear out class dates for a month once that month is over
	

//		
	//------------------------------- November 09
		classes[11][10][9] = 'cp';
		classes[11][12][9] = 'ir';
		
	//------------------------------- December 09
		classes[12][8][9] = 'cpf';
		classes[12][10][9] = 'irf';
	//------------------------------- January 10
		classes[1][12][10] = 'cp';
		classes[1][14][10] = 'ir';
		classes[1][26][10] = 'cp';
	//------------------------------- February 10
		classes[2][16][10] = 'cp';
		classes[2][18][10] = 'ir';
		classes[2][23][10] = 'cp';
	//------------------------------- March 10
	//	classes[3][9][10] = 'cp';
	//	classes[3][11][10] = 'ir';
	//	classes[3][23][10] = 'ir';
	//-------------------------------- April 10
		classes[4][12][10] = 'cp';
		classes[4][14][10] = 'ir';
		classes[4][27][10] = 'cp';
		classes[4][29][10] = 'ir';
	//-------------------------------- May 10
		classes[5][3][10] = 'cp';
		classes[5][5][10] = 'ir';
		classes[5][11][10] = 'cp';
		classes[5][13][10] = 'ir';
	//	classes[5][25][10] = 'cp';
	//	classes[5][27][10] = 'ir';
	//-------------------------------- June 10
		classes[6][15][10] = 'cp';
		classes[6][17][10] = 'ir';
		classes[6][29][10] = 'cp';
	//-------------------------------- July 10
		classes[7][13][10] = 'cp';
		classes[7][15][10] = 'ir';
		classes[7][27][10] = 'cp';
	//-------------------------------- August 10
		classes[8][10][10] = 'cp';
		classes[8][12][10] = 'ir';
		classes[8][17][10] = 'cs';
		classes[8][24][10] = 'cp';
	//-------------------------------- September 10
		classes[9][14][10] = 'cp';
		classes[9][16][10] = 'ir';
		classes[9][28][10] = 'cp';
	//-------------------------------- October 10
		classes[10][12][10] = 'cp';
		classes[10][14][10] = 'ir';
		classes[10][26][10] = 'cp';
	//-------------------------------- November 10
		classes[11][9][10] = 'cp';
		classes[11][11][10] = 'ir';
		classes[11][30][10] = 'cp';
	//-------------------------------- December 10
		classes[12][14][10] = 'cp';
		classes[12][16][10] = 'ir';


function buildCal(m, y)  //buildCal(4, 2003)
{
	//Initialize variables
	var tab; var count = 1; var holdate = null; var pastm; var pasty; var todaydate=new Date();
	
	//Make dates usable
	y += '';
	var FY = y.substr(2,2);
	var shorty = y.substr(3,1);
	var FM = parseInt(m); 
	if ( FM < 10 ) { FM.toString(); FM = "0" + FM; } 
	var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0
	first_day = new Date(y,m-1,1)
	var first = first_day.getDay();

	//Begin table for calendar
	tab='<table cols="7" cellpadding="0" border=1 cellspacing="0" width="100%" bgcolor="#F5F5F5"><tr align="center">';
	tab+='<td colspan="7" align="center" bgcolor=#000000><font color=#FFFFFF><b>'+returnMonth(m)+' - '+y+'</b></font></td></tr><tr align="center">';
	tab+='<td width="10%" class="Bmain">Sun</td><td width="16%" class="Bmain">Mon</td><td width="16%" class="Bmain">Tues</td><td width="16%" class="Bmain">Wed</td><td width="16%" class="Bmain">Thu</td><td width="16%" class="Bmain">Fri</td><td width="10%" class="Bmain">Sat</td>';
	tab+='</tr><tr align="center">';
	
	//Get the number of days in the month
	var dd = new Date(y, m, 0);												
	var DIM = dd.getDate();
	
	//Get the number of days in the previous month
	if ( m == 1 ) { pastm = 12; pasty = y - 1; }
	else { pastm = m - 1; pasty = y; }
	var pm = new Date(pasty, pastm, 0);												
	var DILM = pm.getDate();

	//Begin for loop to write calendar days
	for ( var b = 1; b <= ( DIM + first ); b++ ){
		
		//Check to see if course overlaps to next month
		var secday = count + 1;
		var thrday = secday + 1; 
		
		if ( classes[m][DIM][shorty] && DIM == count ) { secday.toString(); secday = returnMonth(m+1) + " 1"; }
		
		//Write blank spots until first day of month is hit
		if ( b <= first ){
			
			tab+='<td bgcolor="#FFFFCC" height="40" rowspan="2">&nbsp;</td>';
		
		//If day is today, make it visible
		} else if ( count == scanfortoday && !classes[m][count][shorty] ){
			
			tab+='<td class="courses" height="40" bgcolor="#000000" rowspan="2"><font color="#FFFFFF" size="2">Today<br>'+count+'</font></td>';
			count++;
		
		//Write course dates for past courses, if day has no course write default
		} else if ( count <= scanfortoday ) {

	
			
			//Check classes array to see if date has a course scheduled
			switch ( classes[m][count][shorty] ) {
				case 'cp'				:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Competent Person / Tower Climber</font></td>'; b++; count++; break;
				case 'ir'				: 	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Competent Rescue</td>'; b++; count++; break;
				case 'si'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Scaffold Inspector</td>'; break;
				case 'cs'				:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Confined Space</font></td>'; b++; count++; break;
				case 'afp'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Fall Protection</td>'; break;
				case 'afpr'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Fall Protection -R-</td>'; break;
				case 'cpf'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Competent Person / Tower Climber - FULL</font></td>'; b++; count++; break;
				case 'irf' 				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Competent Rescue - FULL</font></td>'; b++; count++; break;
				case 'sif'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Scaffold Inspector - FULL</font></td>'; break;
				case 'csf'				:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="2" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Confined Space - FULL</font></td>'; b++; count++; break;
				case 'afpf'				:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Fall Protection - FULL</font></td>'; break;
				case 'afprf'			:	tab+='<td bgcolor="#FFFFCC" class="courses" height="40" rowspan="2"><font color="#000000">'+count+'<br>Fall Protection -R- - FULL</font></td>'; break;
				case 'cfprt'			:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="3" rowspan="2"><font color="#000000">'+count+' - '+secday+' - '+thrday+'<br>Crane Fall Protection and Rescue</font></td>'; b++; count++; break;
				case 'cfprtf'			:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="3" rowspan="2"><font color="#000000">'+count+' - '+secday+' - '+thrday+'<br>Crane Fall Protection and Rescue - FULL</font></td>'; b++; count++; break;
				case 'cct'				:	tab+='<td class="courses" height="40" bgcolor="#FFFFCC" colspan="3" rowspan="2"><font color="#000000">'+count+' - '+secday+'<br>Competent Climber (Tower)</font></td>'; b++; count++; break;
				default					:	
											if (check3day(classes, m, count, shorty))
												tab+='<td bgcolor="#FFFFCC" height="40" rowspan="2">'+count+'</td>'; 
											break;
				
			}
			count++;
		
		//Write course dates for upcoming courses, if day has no course write default
		} else {
			
			//Make day variable usable in link
			var FD = parseInt(count); 
			if ( FD < 10 ) { FD.toString(); FD = "0" + FD; }
			
			if(shorty == "0"){
				var testToday = classes[m][count][FY];	
			} else {
				var testToday = classes[m][count][shorty];	
			}
			
			//Check classes array to see if date has a course scheduled
			switch ( testToday ){ //classes[m][count][shorty]
				case	'cp'	:	tab+='<td bgcolor="#FFFFFF" height="20" bordercolor="#000066" colspan="2" class="courses"><a href="openenrollreg.html#CP'+FM+'_'+FD+'_'+FY+'"><font color="#000000">' + count + " - " + secday + '<br>Competent Person</font></td>'; b++; count++;  break;
				case	'ir'	:	tab+='<td bgcolor="#FFFFFF" height="40" rowspan="2" bordercolor="#000066" colspan="2" class="courses"><a href="openenrollreg.html#IR'+FM+'_'+FD+'_'+FY+'"><font color="#0312a3">' + count + " - " + secday + '<br>Competent Rescue</font></td>'; b++; count++; break;
				case	'cs'	:	tab+='<td bgcolor="#FFFFFF" height="40" rowspan="2" bordercolor="#000066" colspan="2" class="courses"><a href="openenrollreg.html#CS'+FM+'_'+FD+'_'+FY+'"><font color="#006600">' + count + " - " + secday + '<br>Confined Space</font></td>'; b++; count++; break;
				case	'afp'	:	tab+='<td bgcolor="#FFFFFF" height="40" rowspan="2" bordercolor="#000066" class="courses"><a href="openenrollreg.html#AF'+FM+'_'+FD+'_'+FY+'"><font color="#990000">' + count + '<br>Authorized Person</font></td>'; break;
				case	'si'	:	tab+='<td bgcolor="#FFFFFF" height="40" rowspan="2" bordercolor="#000066" class="courses"><a href="openenrollreg.html#SI'+FM+'_'+FD+'_'+FY+'"><font color="#9900FF">' + count + '<br>Scaffold Inspection -R-</font></td>'; break;
				case 	'cpf'	:	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" colspan="2" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+' - '+secday+'<br>Competent Person / Tower Climber - FULL</font></td>'; b++; count++; break;
				case 	'irf' 	:	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" colspan="2" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+' - '+secday+'<br>Competent Rescue - FULL</font></td>'; b++; count++; break;
				case 	'sif'	:	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+'<br>Scaffold Inspector -R- - FULL</font></td>'; break;
				case 	'csf'	:	tab+='<td class="courses" height="40" bgcolor="#CCCCCC" colspan="2" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+' - '+secday+'<br>Confined Space - FULL</font></td>'; b++; count++; break;
				case 	'afpf'	:	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+'<br>Fall Protection - FULL</font></td>'; break;
				case 	'afprf'	:	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" rowspan="2" bordercolor="#FF0000"><font color="#000000">'+count+'<br>Fall Protection -R- - FULL</font></td>'; break;
				case	'cct'	:	tab+='<td bgcolor="#FFFFFF" height="20" bordercolor="#000066" colspan="2" class="courses"><a href="openenrollreg.html#CT'+FM+'_'+FD+'_'+FY+'"><font color="#000000">' + count + " - " + secday + '<br>Competent Climber (Tower)</font></td>'; b++; count++;  break;
				case 	'cfprt'	:	
									if(thrday > daysInMonth(m)) { thrday = thrday - daysInMonth(m);}
									tab+='<td bgcolor="#FFFFFF" class="courses" height="40" rowspan="2" colspan="3"><a href="openenrollreg.html#CF'+FM+'_'+FD+'_'+FY+'"><font color="#66cc66">'+count+' - '+thrday+'<br>Crane Fall Protection and Rescue</font></td>'; b++; count++; count++; b++;  break;
				case 	'cfprtf':	tab+='<td bgcolor="#CCCCCC" class="courses" height="40" rowspan="2" colspan="3"><a href="openenrollreg.html#CF'+FM+'_'+FD+'_'+FY+'"><font color="#66cc66">'+count+' - '+thrday+'<br>Crane Fall Protection and Rescue - FULL</font></td>'; b++; count++; count++; b++;  break;				
				default			:	
									if (check3day(classes, m, count, shorty))
										tab+='<td bgcolor="#FFFFCC" height="40" rowspan="2">'+count+'</td>'; break;
			}
			count++;
		
		}
		
		//Check to see if end of week
		if ( (b % 7) == 0 ){ 
			
			//If two course scheduled on the same day is true, retrieve date and make it usable in a link
			if ( holdate ){
				var usedate = holdate - 1;
				var FD = parseInt(usedate); 
				if ( FD < 10 ) { FD.toString(); FD = "0" + FD; }
			
				//Check classes array to see if date has a course scheduled
				switch ( classes[m][holdate][shorty] ){
					case	'mafp'	:	tab+='</tr><tr><td bgcolor="#FFFFFF" height="20" bordercolor="#000066" class="courses"><a href="openenrollreg.html#AF'+FM+'_'+FD+'_'+FY+'"><font color="#990000">' + usedate + '<br>Authorized Person</font></td><td bgcolor="#FFFFCC"></td></tr><tr align="center">'; break;
					case	'mafp'	:	tab+='</tr><tr><td bgcolor="#FFFFFF" height="20" bordercolor="#000066" class="courses"><a href="openenrollreg.html#AF'+FM+'_'+FD+'_'+FY+'"><font color="#990000">' + usedate + '<br>Authorized Person -R-</font></td><td bgcolor="#FFFFCC"></td></tr><tr align="center">'; break;
					case	'si'	:	tab+='</tr><tr><td bgcolor="#FFFFFF" height="20" bordercolor="#000066" class="courses"><a href="openenrollreg.html#SI'+FM+'_'+FD+'_'+FY+'"><font color="#9900FF">' + usedate + '<br>Scaffold Inspection -R-</font></td><td bgcolor="#FFFFCC"></td></tr><tr align="center">'; break;
				}
				
				holdate = null;
			} else { tab+='</tr><tr><td></td></tr><tr align="center">'; }
		}
		
	}
	
	//End table
	tab+='</tr></table>';
	
	return tab;
}




// Scrollable calendar code
function moveCal( position, month, year ){
	
	//Get current month and year
	var todaydate=new Date();
	var curmonth=todaydate.getMonth()+1;
	var curyear=todaydate.getFullYear();
	
	//Prepare variables
	var filled = false;
	if(curmonth > 12){curmonth=curmonth-12; curyear=curyear+1;}
	month = parseInt( month ); year = parseInt( year ); position = parseInt( position );
	var x=document.getElementById("calendar").rows[1].cells;
	
	// Code to scroll backward 1 month
	if ( position != 1 ){
		if ( month > curmonth || year > curyear ){
			month += position;
			if(month < 1){month=12; year=year-1;}
			document.buttons.month.value = month; document.buttons.year.value = year;
			
			var calstr = buildCal(month ,year, "main", "month", "daysofweek", "days", 1, 1, "CP");
			document.getElementById("thisveryspot").innerHTML = calstr;
			
		//	x[1].innerHTML = buildCal(month ,year, "main", "month", "daysofweek", "days", 1, 1, "CP");
			filled = true;
		}
		
	// Code to scroll forward 1 month
	} else {
		if ( year == curyear && curmonth - month > -6 && filled == false ){
			month += position;
			if(month > 12){month=month-12; year=year+1;}
			document.buttons.month.value = month; document.buttons.year.value = year;
			
			var calstr = buildCal(month ,year, "main", "month", "daysofweek", "days", 1, 1, "CP");
			document.getElementById("thisveryspot").innerHTML = calstr;
	
		//	x[1].innerHTML = buildCal(month ,year, "main", "month", "daysofweek", "days", 1, 1, "CP");
			filled = true;
		}
		
		//Change number here to change how far ahead calendar can scroll
		if ( year > curyear && month < 12 && filled == false ){
			month += position;
			if(month > 12){month=month-12; year=year+1;}
			document.buttons.month.value = month; document.buttons.year.value = year;

			x[1].innerHTML = buildCal(month ,year, "main", "month", "daysofweek", "days", 1, 1, "CP");
			filled = true;
		}
	}
}




//Function simply returns month name when given number
function returnMonth(number){
	switch (number){
		case 1:		return "January ";
		case 2:		return "February "; 
		case 3:		return "March "; 
		case 4:		return "April "; 
		case 5:		return "May "; 
		case 6:		return "June ";
		case 7:		return "July "; 
		case 8:		return "August "; 
		case 9:		return "September "; 
		case 10:	return "October "; 
		case 11:	return "November "; 
		case 12:	return "December ";
	}
}

function daysInMonth(month)
{
	switch (month) 
	{
		case 1 : return 31;
		case 2 : 
				var d = new Date();
				if (isLeapYear(d.getYear()))
					return 29;
				else
					return 28;
				
		case 3 : return 31;
		case 4 : return 30;
		case 5 : return 31;
		case 6 : return 31;
		case 7 : return 31; 
		case 8 : return 31;
		case 9 : return 30;
		case 10 : return 31;
		case 11 : return 31;
		case 12 : return 31;
		default : return 31;
	}
}

function isLeapYear(year)
{
	if (year % 400 == 0)
		return true;
	else if (year % 100 == 0)
		return true;
	else if (year % 4 == 0)
		return true;
	else
		return false;
}




//Function writes a drop down menu listing available course dates
function buildCourses(course){
	
	//Initialize variables
	var x=document.getElementById('registrar').rows[12].cells
	var output = '<select name="Classes" size="1"><option value="No course selected">Please select a date (change course type above)...</option>';
	var opWhite = '<option value="';
	var opColor = '<option style="background:#F5F5F5" value="';
	var opEnd = '</option>';
	var cp = '2-Day Competent Person Course ';
	var ir = '2-Day Industrial Rescue Course ';
	var si = '1-Day Scaffold Inspection for Hazard Recognition & User Awareness ';
	var cs = '2-Day Confined Space Course ';
	var cpir = '4-Day Competent Person / Industrial Rescue Course ';
	var afp = '1-Day Fall Protection Authorized Person Course ';
	var cf = '3-Day Crane Fall Protection and Resuce';
	var cct = '2-Day Competent Climber (Tower) ';
	var month; var fx; var count = 0; var front;
	var todaydate = new Date();
	var curyear=todaydate.getFullYear();
	curyear += '';
	var shorty = curyear.substr(2,1);
	var nextyear = parseInt(shorty) + 1;
	var showyear;
	
	//Switch to which course type was sent
	switch(course){
		
		//For case "CP" scan classes array for all instances of 'cp' and include in drop down menu
		case "CP": 	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "cp" || classes[i][j][nextyear] == "cp" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){ 
									if ( shorty < 10 ) { shorty.toString(); showyear = "200" + shorty; }
									else { shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 ) { nextyear.toString(); showyear = "200" + nextyear; }
									else { nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare for courses that overlap to next month
								var dd = new Date(showyear, i, 0);												
								var z = j + 1;
								if ( z > dd.getDate() ){
									z = 1;
									var nextMonth = returnMonth(i+1);
									z.toString(); z = nextMonth + z;
								}
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + cp + fm + '_' + fx + '_' + schedyear + '">' + month + j + ' - ' + z + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
				
	//For case "CCT" scan classes array for all instances of 'cct' and include in drop down menu 
		case "CT": 	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "cct" || classes[i][j][nextyear] == "cct" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){ 
									if ( shorty < 10 ) { shorty.toString(); showyear = "200" + shorty; }
									else { shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 ) { nextyear.toString(); showyear = "200" + nextyear; }
									else { nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare for courses that overlap to next month
								var dd = new Date(showyear, i, 0);												
								var z = j + 1;
								if ( z > dd.getDate() ){
									z = 1;
									var nextMonth = returnMonth(i+1);
									z.toString(); z = nextMonth + z;
								}
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + cct + fm + '_' + fx + '_' + schedyear + '">' + month + j + ' - ' + z + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
		

		//For case "IR" scan classes array for all instances of 'ir' and include in drop down menu
		case "IR":	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "ir" || classes[i][j][nextyear] == "ir" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare for courses that overlap to next month
								var dd = new Date(showyear, i, 0);												
								var z = j + 1;
								if ( z > dd.getDate() ){
									z = 1;
									var nextMonth = returnMonth(i+1);
									z.toString(); z = nextMonth + z;
								}
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + ir + fm + '_' + fx + '_' + schedyear + '">' + month + j + ' - ' + z + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
		
		//For case "CPIR" scan classes array for all instances of 'cp' followed by 'ir' and include in drop down menu
		case "CPIR":for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							if ( j < 30 ) 
								var bigJ = j + 2;
							else
								var bigJ = j;
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "cp" && classes[i][bigJ][shorty] == "ir" || classes[i][j][nextyear] == "cp" && classes[i][bigJ][nextyear] == "ir" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare for courses that overlap to next month
								var dd = new Date(showyear, i, 0);												
								var z = j + 3;
								if ( z > dd.getDate() ){
									z = 2;
									var nextMonth = returnMonth(i+1);
									z.toString(); z = nextMonth + z;
								}
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + cpir + fm + '_' + fx + '_' + schedyear + '">' + month + j + ' - ' + z + ', ' + showyear + opEnd;
							}
						}
					}
				
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
		
		//For case "AFP" scan classes array for all instances of 'afp' or 'mafp' and include in drop down menu
		case "AFP":	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "afp" || classes[i][j][nextyear] == "afp" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + afp + fm + '_' + fx + '_' + schedyear + '">' + month + j + ', ' + showyear + opEnd;
							}
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "mafp" || classes[i][j][nextyear] == "mafp" ){
								month = returnMonth(i);
								
								var z = j-1;
								if ( z < 10 ) 
									{ z.toString(); fx = "0" + z; }
								else 
									{ fx = z; }
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare variables for output
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + afp + fm + '_' + fx + '_' + schedyear + '">' + month + z + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
		
		//For case "CS" scan classes array for all instances of 'cs' and include in drop down menu
		case "CS":	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "cs" || classes[i][j][nextyear] == "cs" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare for courses that overlap to next month
								var dd = new Date(showyear, i, 0);												
								var z = j + 1;
								if ( z > dd.getDate() ){
									z = 1;
									var nextMonth = returnMonth(i+1);
									z.toString(); z = nextMonth + z;
								}
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + cs + fm + '_' + fx + '_' + schedyear + '">' + month + j + ' - ' + z + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
		
		//For case "SI" scan classes array for all instances of 'si' and include in drop down menu
		case "SI":	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "si" || classes[i][j][nextyear] == "si" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + si + fm + '_' + fx + '_' + schedyear + '">' + month + j + ', ' + showyear + ' in Robert, LA' + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;

		//For case "CF" scan classes array for all instances of 'cf' and include in drop down menu
		case "CF":	for ( var i = 1; i < 13; i++ ){
						for ( var j = 1; j < 32; j++ ){
							
							//Check this year and next year
							if ( classes[i][j][shorty] == "cfprt" || classes[i][j][nextyear] == "cfprt" ){
								month = returnMonth(i);
								
								if ( classes[i][j][shorty] != null ){
									if ( shorty < 10 )
										{ shorty.toString(); showyear = "200" + shorty; }
									else
										{ shorty.toString(); showyear = "20" + shorty; }
								} else {
									if ( nextyear < 10 )
										{ nextyear.toString(); showyear = "200" + nextyear; }
									else
										{ nextyear.toString(); showyear = "20" + nextyear; }
								}
								
								//Make schedyear usable in link
								schedyear = showyear.substr(2,2);
								
								//Prepare variables for output
								if ( j < 10 ) 
									{ j.toString(); fx = "0" + j; }
								else 
									{ fx = j; }
								if ( count % 2 == 0 ) 
									front = opWhite;
								else 
									front = opColor;
								count++;
								
								var fm = parseInt(i);
								if ( fm < 10 ) { fm.toString(); fm = "0" + fm; }
								
								output += front + cf + fm + '_' + fx + '_' + schedyear + '">' + month + j + ', ' + showyear + opEnd;
							}
						}
					}
					
					//If no courses of this type are found, write this
					if ( count == 0 )
					output = '<select name="Classes" size="1"><option value="Call for scheduling">Please call for scheduling information ...</option>';
				'</select>'; break;
				
								
		}
		
		//Write output to document
		x[0].innerHTML = output;
}

function check3day(classes, m, count, shorty)
{
		if (count > 3)
		{
			if (classes[m][count-1][shorty] == "cfprt")
				return false;
			if (classes[m][count-2][shorty] == "cfprtf")
				return false;


			return true;
		}
		return true;
		
		
}

function checkOverlap(classes, m, count, shorty)
{
	var numdays = daysInMonth(m);
}
	
	
	
