///////////////////////////////////////////////////////////////////////////////
//	schedule.js - Schedule of Classes Javascript source 
//	Author: Zhenqing chen
//  Date: Dec. 2, 2004
///////////////////////////////////////////////////////////////////////////////
function xyz(){
	alert("xyz");
}

function valid(){
//	alert("xyzvalid");
if(window.document.selectnumber.coursenumber.options[0].selected) 
{
	alert("Please choose one of Career Service Classification.");
	return false;
	}
}

function changeState()
{	/*msg = "Reloading the form based on new term selection.\n";
	msg += "Please wait until the page reloads before choosing another option.\n";
	msg += "Click 'Ok' to continue and wait for the message that the form has finished reloading.";
	alert(msg);*/
	document.selectstate.submit();
}
function changeSchool()
{	/*msg = "Reloading the form based on new term selection.\n";
	msg += "Please wait until the page reloads before choosing another option.\n";
	msg += "Click 'yes' to continue and wait for the message that the form has finished reloading.";
	alert(msg);
		alert(document.selectschool.action);*/
/*if(window.document.selectstate.stateab.value == "choose one please")
	{
		msg = "Please choose a state first";
		alert(msg);
	}
else*/
	document.selectschool.submit();
}
function changeCourse()
{	/*msg = "Reloading the form based on new term selection.\n";
	msg += "Please wait until the page reloads before choosing another option.\n";
	msg += "Click 'yes' to continue and wait for the message that the form has finished reloading.";
	alert(msg);
		alert(document.selectschool.action);*/

	document.selectcourse.submit();
}
function changeNumber()
{	/*msg = "Reloading the form based on new term selection.\n";
	msg += "Please wait until the page reloads before choosing another option.\n";
	msg += "Click 'yes' to continue and wait for the message that the form has finished reloading.";
	alert(msg);
		alert(document.selectschool.action);*/

	document.selectnumber.submit();
}

/*
function formLoaded()
{
	status = "Page has finished loading.  Please make your selections.";
	alert(status);
}
function initializeControls()
{

	//alert("initializeControls start");
	initializeStateComboBox();
	initializeSchoolComboBox();
	initializeCourseComboBox()
	//initializeNumberComboBox();
	//initializeTitleAndCourseNumComboBox();
	//formLoaded();
}*/
///////////////////////////////////////////////////////////////////////////////
//	Function: initializeTermComboBox()
//	Purpose: initialize the semester select box
///////////////////////////////////////////////////////////////////////////////
function initializeStateComboBox()
{
	with (document.coursetransfer)
	{
		stateab.options.length = 0;
		for(rowNum = 0; rowNum < aState.getRowCount(); rowNum++)
		{
			NewOpt = new Option;
			NewOpt.value = aState.stateab[rowNum];
			NewOpt.text = aState.statename[rowNum];
			stateab.options[stateab.options.length] = NewOpt;
			
			/*if(Default_Term == aTerms.terms_id[rowNum])
			{				
				Term.selectedIndex = rowNum;
				}
			else
			{
			
			}*/
			
		}
	
	}
}

///////////////////////////////////////////////////////////////////////////////
//	Function: initializeLocationComboBox()
//	Purpose: initialize the location select box
///////////////////////////////////////////////////////////////////////////////
function initializeSchoolComboBox()
{

	with (document.coursetransfer)
	{
		school.options.length = 0;
		for(rowNum = 0; rowNum < aSchool.getRowCount(); rowNum++)
		{	
			//if( aUniqueSchool[aSchool.INSTSTATE[rowNum]] == true )
			//{	
				NewOpt = new Option;
				NewOpt.value = aSchool.inststate[rowNum];
				NewOpt.text = aSchool.instname[rowNum];
				school.options[school.options.length] = NewOpt;
			//}
		}
		
		//school.selectedIndex = 0;
	}
	/*aUniqueSchool=new Array();
	for(rowNum = 0; rowNum < aSchool.getRowCount(); rowNum++ )
	{
		aUniqueSchool[aSchool.INSTSTATE[rowNum]] = false;
	}
	for(rowNum = 0; rowNum < aCourse.getRowCount(); rowNum++ )
	{
		aUniqueSchool[aCourse.INSTST[rowNum]] = true;
	}

	//with (document.coursetransfer)
	//{
		school.options.length = 0;
		for(rowNum = 0; rowNum < aSchool.getRowCount(); rowNum++)
		{	
			if( aUniqueSchool[aSchool.INSTSTATE[rowNum]] == true )
			{	
				NewOpt = new Option;
				NewOpt.value = aSchool.INSTSTATE[rowNum];
				NewOpt.text = aSchool.INSTNAME[rowNum];
				school.options[school.options.length] = NewOpt;
			}
		}
		
		school.selectedIndex = 0;
	//}*/
}
///////////////////////////////////////////////////////////////////////////////
//	Function: initializeAcademicLevelComboBox()
//	Purpose: initialize the academic level select box
///////////////////////////////////////////////////////////////////////////////
function initializeCourseComboBox()
{
	with (document.coursetransfer)
	{
		course.options.length = 0;
		for(rowNum = 0; rowNum < aCourse.getRowCount(); rowNum++)
		{	
			//if( aUniqueSchool[aSchool.INSTSTATE[rowNum]] == true )
			//{	
				NewOpt = new Option;
				NewOpt.value = aCourse.trcourse[rowNum];
				NewOpt.text = aCourse.trtitle[rowNum];
				course.options[course.options.length] = NewOpt;
			//}
		}
		
		//school.selectedIndex = 0;
	}
	/*uniqueLevel=new Array();
	for(rowNum = 0; rowNum < aLevels.getRowCount(); rowNum++ )
	{
		uniqueLevel[aLevels.acad_level[rowNum]] = false;
	}
	
	with (document.SelectLists)
	{	
		for(rowNum = 0; rowNum < aClasses.getRowCount(); rowNum++ )
		{
			if(aClasses.location[rowNum] == Location.options[Location.selectedIndex].value)
			{
				uniqueLevel[aClasses.acad_level[rowNum]] = true;
			}
		}
		prevSelLevelValue = Level.options[Level.selectedIndex].value;
		Level.options.length = 0;
		for(rowNum = 0; rowNum < aLevels.getRowCount(); rowNum++ )
		{
			if( uniqueLevel[aLevels.acad_level[rowNum]] == true )
			{
				NewOpt = new Option;
				NewOpt.value = aLevels.acad_level[rowNum];
				NewOpt.text = aLevels.acad_level_text[rowNum];
				Level.options[Level.options.length] = NewOpt;
			}
		}
		for(rowNum = 0; rowNum < Level.options.length; rowNum++)
		{
			if(Level.options[rowNum].value == prevSelLevelValue)
			{
				Level.selectedIndex = rowNum;
				break;
			}
			
		}
		if(Level.selectedIndex < 0)
		{
			Level.selectedIndex = 0;
		}
	}
	delete uniqueLevel;*/
}
///////////////////////////////////////////////////////////////////////////////
//	Function: initializeSubjectComboBox()
//	Purpose: initialize the subject select box
///////////////////////////////////////////////////////////////////////////////
/*function initializeNumberComboBox()
{
	uniqueSubject=new Array();
	for(rowNum = 0; rowNum < aSubjects.getRowCount(); rowNum++ )
	{
		uniqueSubject[aSubjects.subjects[rowNum]] = false;
	}
	
	with (document.SelectLists)
	{
	for(rowNum = 0; rowNum < aClasses.getRowCount(); rowNum++ )
		{
			if(aClasses.location[rowNum] == Location.options[Location.selectedIndex].value)
			{
				if(aClasses.acad_level[rowNum] == Level.options[Level.selectedIndex].value)
				{
					uniqueSubject[aClasses.subject[rowNum]] = true;
				}
			}
		}
		prevSelSubjectValue = Subject.options[Subject.selectedIndex].value;
		Subject.options.length = 0;	
		for(rowNum = 0; rowNum < aSubjects.getRowCount(); rowNum++)
		{
			if( uniqueSubject[aSubjects.subjects[rowNum]] == true )
			{
				NewOpt = new Option;
				NewOpt.value = aSubjects.subjects[rowNum];
				NewOpt.text = aSubjects.subjects_mix[rowNum];
				Subject.options[Subject.options.length] = NewOpt;
			}
		}
		for(rowNum = 0; rowNum < Subject.options.length; rowNum++)
		{
			if(Subject.options[rowNum].value == prevSelSubjectValue)
			{
				Subject.selectedIndex = rowNum;
				break;
			}
			
		}
		if(Subject.selectedIndex < 0)
		{
			Subject.selectedIndex = 0;
		}
	}
	
	delete uniqueSubject;	
}
///////////////////////////////////////////////////////////////////////////////
//	Function: initializeTitleCourseNumComboBox()
//	Purpose: initialize the title and course number select boxes
///////////////////////////////////////////////////////////////////////////////
function initializeTitleAndCourseNumComboBox()
{
	with (document.SelectLists)
	{
		Title.options.length = 0;
		CourseNumber.options.length = 0;
		NewTitleOpt = new Option;
		NewTitleOpt.value = "";
		NewTitleOpt.text = "----- All Courses -----";
		
		NewCourseNumOpt = new Option;
		NewCourseNumOpt.value = "";
		NewCourseNumOpt.text = "----- All Courses -----";
		
		Title.options[Title.options.length] = NewTitleOpt;
		CourseNumber.options[CourseNumber.options.length] = NewCourseNumOpt;
		
		for(rowNum = 0; rowNum < aClasses.getRowCount(); rowNum++ )
		{
			if(aClasses.location[rowNum] == Location.options[Location.selectedIndex].value)
			{
				if(aClasses.acad_level[rowNum] == Level.options[Level.selectedIndex].value)
				{
					if(aClasses.subject[rowNum] == Subject.options[Subject.selectedIndex].value)
					{
						NewTitleOpt = new Option;
						NewTitleOpt.value = aClasses.short_title[rowNum];
						NewTitleOpt.text = aClasses.short_title[rowNum];
						
						//Create course number option
						NewCourseNumOpt = new Option;
						NewCourseNumOpt.value = aClasses.course_no[rowNum];
						NewCourseNumOpt.text = aClasses.course_no[rowNum];
						
						//Add the new object to the select list
						Title.options[Title.options.length] = NewTitleOpt;
						CourseNumber.options[CourseNumber.options.length] = NewCourseNumOpt;
					}					
				}
			}
			Title.selectedIndex = 0;
			CourseNumber.selectedIndex = 0;
		}
	}

}

///////////////////////////////////////////////////////////////////////////////
//	List creation functions
//	
///////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////
//	Select functions
//	
///////////////////////////////////////////////////////////////////////////////
locationSelected = "";

/*function changeDebug()
{	msgchangeDebug = "Reloading the form based on new debug selection.\n";
	msgchangeDebug += "Please wait until the form reloads before choosing another option.\n";
	msgchangeDebug += "Click Ok to continue.";
}*/
/*

function changeLocation()
{	
	initializeCourseComboBox()
	initializeNumberComboBox();
	initializeTitleAndCourseNumComboBox();
}

function changeLevel()
{	
	initializeNumberComboBox();
	initializeTitleAndCourseNumComboBox();
}


function changeSubject()
{	
	initializeTitleAndCourseNumComboBox();
}


function changeTitle()
{	
	with (document.SelectLists)
	{
		CourseNumber.selectedIndex = Title.selectedIndex;
	}
}


function changeCourseNum()
{	
	with (document.SelectLists)
	{
		Title.selectedIndex = CourseNumber.selectedIndex;
	}
}*/