
// classes.js
// Class Project for CS193C
// Created by David Trieu

function findClass()
{
	var course1 = new Object();
	course1.coursetitle = new String("Chemistry 31A");
	course1.courseprof = new Array();
	course1.courseprof[0] = new String("Chidsey");
	course1.description = new String("The general chemistry sequence covers all of the basic foundations necessary for students interested in organic, environmental,  or agricultural chemistry, molecular or cellular biology, material or bio-engineering, or condensed-phase physics.  Both classes are paced for freshman and have homework and tests on a frequent basis.  Anyone with analytic background at the level of AP Chemistry or AP Physics will probably prefer 31X over A,B.  People with good ability in math or a strong interest in science should start by enrolling in 31X and then switching to A if the pace is too fast.  Lectures by Professor Zare in 31A are especially entertaining, the other professors teaching these classes are less animated.");
	
	var course2 = new Object();
	course2.coursetitle = new String("Chemistry 31B");
	course2.courseprof = new Array();
	course2.courseprof[0] = new String("Chidsey");
	course2.description = new String("The general chemistry sequence covers all of the basic foundations necessary for students interested in organic, environmental,  or agricultural chemistry, molecular or cellular biology, material or bio-engineering, or condensed-phase physics.  Both classes are paced for freshman and have homework and tests on a frequent basis.  Anyone with analytic background at the level of AP Chemistry or AP Physics will probably prefer 31X over A,B.  People with good ability in math or a strong interest in science should start by enrolling in 31X and then switching to A if the pace is too fast.  Lectures by Professor Zare in 31A are especially entertaining, the other professors teaching these classes are less animated.");
	
	var course3 = new Object();
	course3.coursetitle = new String("Chemistry 31X");
	course3.courseprof = new Array();
	course3.courseprof[0] = new String("Boxer");
	course3.courseprof[1] = new String("Waymouth");
	course3.description = new String("The general chemistry sequence covers all of the basic foundations necessary for students interested in organic, environmental,  or agricultural chemistry, molecular or cellular biology, material or bio-engineering, or condensed-phase physics.  Both classes are paced for freshman and have homework and tests on a frequent basis.  Anyone with analytic background at the level of AP Chemistry or AP Physics will probably prefer 31X over A,B.  People with good ability in math or a strong interest in science should start by enrolling in 31X and then switching to A if the pace is too fast.  Lectures by Professor Zare in 31A are especially entertaining, the other professors teaching these classes are less animated.");
	
	var course4 = new Object();
	course4.coursetitle = new String("Chemistry 33");
	course4.courseprof = new Array();
	course4.courseprof[0] = new String("Stack");
	course4.courseprof[1] = new String("Kool");
	course4.courseprof[2] = new String("Wender");
	course4.description = new String("The organic chemistry sequence has the worst reputation of any chemistry classes offered at Stanford, much of this reputation is not deserved if you can take the classes from the right professors (although some people are determined to hate all chemistry. No professor can help them).  Chem 33 covers most of the concepts of organic chemistry, while 35 and 131 are devoted to memorizing and applying chemical reactions.  The memorization often frustrates people who like science theory.  131 builds directly on reactions learned in 35, so we advise taking them as closely together as possible.  Organic chemistry is geared toward students in chemistry and biology.  33 is a good general interest class (or for filling an Area 2 GER) because it covers a lot of chemical principles, both 35 and 131 are not the best classes to take for interest because the subject matter is very specific and not generally applicable to other fields.");
	
	var course5 = new Object();
	course5.coursetitle = new String("Chemistry 35");
	course5.courseprof = new Array();
	course5.courseprof[0] = new String("Huestis");
	course5.courseprof[1] = new String("DuBois");
	course5.description = new String("The organic chemistry sequence has the worst reputation of any chemistry classes offered at Stanford, much of this reputation is not deserved if you can take the classes from the right professors (although some people are determined to hate all chemistry. No professor can help them).  Chem 33 covers most of the concepts of organic chemistry, while 35 and 131 are devoted to memorizing and applying chemical reactions.  The memorization often frustrates people who like science theory.  131 builds directly on reactions learned in 35, so we advise taking them as closely together as possible.  Organic chemistry is geared toward students in chemistry and biology.  33 is a good general interest class (or for filling an Area 2 GER) because it covers a lot of chemical principles, both 35 and 131 are not the best classes to take for interest because the subject matter is very specific and not generally applicable to other fields.");
	
	var course6 = new Object();
	course6.coursetitle = new String("Chemistry 131");
	course6.courseprof = new Array();
	course6.courseprof[0] = new String("Huestis");
	course6.courseprof[1] = new String("Trost");
	course6.description = new String("The organic chemistry sequence has the worst reputation of any chemistry classes offered at Stanford, much of this reputation is not deserved if you can take the classes from the right professors (although some people are determined to hate all chemistry. No professor can help them).  Chem 33 covers most of the concepts of organic chemistry, while 35 and 131 are devoted to memorizing and applying chemical reactions.  The memorization often frustrates people who like science theory.  131 builds directly on reactions learned in 35, so we advise taking them as closely together as possible.  Organic chemistry is geared toward students in chemistry and biology.  33 is a good general interest class (or for filling an Area 2 GER) because it covers a lot of chemical principles, both 35 and 131 are not the best classes to take for interest because the subject matter is very specific and not generally applicable to other fields.");

	var course7 = new Object();
	course7.coursetitle = new String("Chemistry 36");
	course7.courseprof = new Array();
	course7.courseprof[0] = new String("Moylan");
	course7.description = new String("The organic lab sequence covers basic methods of purification, identification, and synthesis.  None of these classes are terribly work intensive outside of class, but they all have a lot of time in lab.  Unless you have a specific interest or use for organic lab experience there is very little reason to take any of these classes.  Professor Moylan teaches both 36 and 130.  He is generally one of the better lecturers in the department but students often complain that he is unnecessarily strict about grading lab reports.  Neither 36 nor 130 requires any actual writting because the lab reports are either formulaic or based on fill-in-the-blank worksheets.");
	
	var course8 = new Object();
	course8.coursetitle = new String("Chemistry 130");
	course8.courseprof = new Array();
	course8.courseprof[0] = new String("Moylan");
	course8.description = new String("The organic lab sequence covers basic methods of purification, identification, and synthesis.  None of these classes are terribly work intensive outside of class, but they all have a lot of time in lab.  Unless you have a specific interest or use for organic lab experience there is very little reason to take any of these classes.  Professor Moylan teaches both 36 and 130.  He is generally one of the better lecturers in the department but students often complain that he is unnecessarily strict about grading lab reports.  Neither 36 nor 130 requires any actual writting because the lab reports are either formulaic or based on fill-in-the-blank worksheets.");
	
	var course9 = new Object();
	course9.coursetitle = new String("Chemistry 136");
	course9.courseprof = new Array();
	course9.courseprof[0] = new String("Yandulov");
	course9.description = new String("Chem 136 is a synthesis lab in organic and inorganic chemistry. Chem 136 changes completely every year depending on the professor and TA.  It has two afternoons in lab every week but no lectures.  Dmitry Yandulov is teaching it for the first time this year.  He is a new professor and 136 is the first class he has taught so no one is sure what to expect.  Professor Yandulov has been having trouble recruiting graduate students, again we don't know if that is reflective of his ability as a teacher.");
	
	var course10 = new Object();
	course10.coursetitle = new String("Chemistry 135");
	course10.courseprof = new Array();
	course10.courseprof[0] = new String("Pecora");
	course10.description = new String("Chem 135 is the physical chemistry class that is taken by most life sciences majors and pre-med students. Chem 135 is generally hated for having boring and off-topic lectures.  If you have any tolerance for abstract math then take 171 instead because Professor Pande is recognized as a very good lecturer.  Only take 135 if it is required for your degree program, otherwise you would do much better to take one or more of 171,3,5 or courses in the Physics Department.");
	
	var course11 = new Object();
	course11.coursetitle = new String("Chemistry 171");
	course11.courseprof = new Array();
	course11.courseprof[0] = new String("Pande");
	course11.description = new String("The physical chemistry lecture sequence 171, 173, 175 is heavily math-based and often doesn't feel like chemistry to people coming off of two years of organic chemistry.  Professor Pande usually teaches Chem 171 and is thought of as a very good lecturer.  Professor Boxer usually teaches 173 and Moerner teaches 175.  Both professors are competent lecturers but neither is especially inspiring.  The course structure is traditional, with weekly problem set, two midterms, and a final.  The 170 lectures are taken almost exclusively by majors in Chemistry, Chemical Engineering, and Material Science, and by Chemistry graduate students who failed the P-Chem qualifying exam.  This mix of scientists and engineers makes the grading curve in the P-Chem sequence quite a bit more challenging than it was for organic chemistry (although there are fewer pre-med students).");
	
	var course12 = new Object();
	course12.coursetitle = new String("Chemistry 173");
	course12.courseprof = new Array();
	course12.courseprof[0] = new String("Boxer");
	course12.description = new String("The physical chemistry lecture sequence 171, 173, 175 is heavily math-based and often doesn't feel like chemistry to people coming off of two years of organic chemistry.  Professor Pande usually teaches Chem 171 and is thought of as a very good lecturer.  Professor Boxer usually teaches 173 and Moerner teaches 175.  Both professors are competent lecturers but neither is especially inspiring.  The course structure is traditional, with weekly problem set, two midterms, and a final.  The 170 lectures are taken almost exclusively by majors in Chemistry, Chemical Engineering, and Material Science, and by Chemistry graduate students who failed the P-Chem qualifying exam.  This mix of scientists and engineers makes the grading curve in the P-Chem sequence quite a bit more challenging than it was for organic chemistry (although there are fewer pre-med students).");
	
	var course13 = new Object();
	course13.coursetitle = new String("Chemistry 175");
	course13.courseprof = new Array();
	course13.courseprof[0] = new String("Moerner");
	course13.description = new String("The physical chemistry lecture sequence 171, 173, 175 is heavily math-based and often doesn't feel like chemistry to people coming off of two years of organic chemistry.  Professor Pande usually teaches Chem 171 and is thought of as a very good lecturer.  Professor Boxer usually teaches 173 and Moerner teaches 175.  Both professors are competent lecturers but neither is especially inspiring.  The course structure is traditional, with weekly problem set, two midterms, and a final.  The 170 lectures are taken almost exclusively by majors in Chemistry, Chemical Engineering, and Material Science, and by Chemistry graduate students who failed the P-Chem qualifying exam.  This mix of scientists and engineers makes the grading curve in the P-Chem sequence quite a bit more challenging than it was for organic chemistry (although there are fewer pre-med students).");
	
	var course14 = new Object();
	course14.coursetitle = new String("Chemistry 174");
	course14.courseprof = new Array();
	course14.courseprof[0] = new String("Moylan");
	course14.description = new String("These classes are by far the most difficult and time-consuming classes in the Chemistry major.  If you are not majoring in Chemistry then do not take them.  The lecture material in Chem 174 is not difficult but it does tend to be disjointed and it is easy to get lost.  The 174 labs themselves are not very difficult, although the pre-labs often require information that has never been covered in class.  Lab reports are what make 174 hard.  There is a written or oral lab report due almost every week.  Often these require six to ten hours just to understand the data analysis.  Writing is extra on top of that, and there is a range of additional assignments like written summaries of visits taken by the class to P-Chem labs around the school.  Figure that Chem 174 will leave you with no life for a quarter.");
	
	var course15 = new Object();
	course15.coursetitle = new String("Chemistry 176");
	course15.courseprof = new Array();
	course15.courseprof[0] = new String("Dai");
	course15.description = new String("These classes are by far the most difficult and time-consuming classes in the Chemistry major. Chem 176 is much less work intensive than 174.  It only has four lab reports and no extra assignments.  The material in lecture however is much more challenging.  Professor Dai is an excellent lecturer.  He doesn't take attendance but you MUST attend every lecture because the material is incomprehensible from handouts and there is no textbook.  The topics covered in class, largely the quantum theory behind various forms of spectroscopy, brings together much of the material from all the preceeding lab classes but it is also difficult conceptually.  How much you enjoy this class will be determined by how well you like quantum mechanics.");
	
	var course16 = new Object();
	course16.coursetitle = new String("Chemistry 151");
	course16.courseprof = new Array();
	course16.courseprof[0] = new String("Stack");
	course16.description = new String("The inorganic courses do not deserve to be considered a sequence.  Chem 151, usually taught by Professor Stack, is very descriptive and feels a lot the classes from the organic sequence, although with much less rote memorization.  It deals mostly with descriptive and qualitative aspects of chemical structures and bonding, as well as underlying theory behind a lot of chemical processes.  Stack is a good lecturer and the material is clear and easy to follow.  151 is a reasonable class for people to take for interest, especially anyone interested in understanding chemistry in real-world situations.  Chem 153 is taught by Professor Solomon.  It is very boring and makes very little sense.  It would properly be titled 'Group Theory and Inorganic Spectroscopy' and the material is of no use to anyone not going planning a career in spectroscopy.  A small consolation is that the course content does come together around the sixth week and by the end of the course most people feel less than completely lost.");
	
	var course17 = new Object();
	course17.coursetitle = new String("Chemistry 153");
	course17.courseprof = new Array();
	course17.courseprof[0] = new String("Solomon");
	course17.description = new String("The inorganic courses do not deserve to be considered a sequence.  Chem 151, usually taught by Professor Stack, is very descriptive and feels a lot the classes from the organic sequence, although with much less rote memorization.  It deals mostly with descriptive and qualitative aspects of chemical structures and bonding, as well as underlying theory behind a lot of chemical processes.  Stack is a good lecturer and the material is clear and easy to follow.  151 is a reasonable class for people to take for interest, especially anyone interested in understanding chemistry in real-world situations.  Chem 153 is taught by Professor Solomon.  It is very boring and makes very little sense.  It would properly be titled 'Group Theory and Inorganic Spectroscopy' and the material is of no use to anyone not going planning a career in spectroscopy.  A small consolation is that the course content does come together around the sixth week and by the end of the course most people feel less than completely lost.");
	
	var course18 = new Object();
	course18.coursetitle = new String("Chemistry 188");
	course18.courseprof = new Array();
	course18.courseprof[0] = new String("Kohler");
	course18.description = new String("Biochemistry should be a very interesting class but for some reason it really doesn't come together.  Professor Khosla would be an engaging lecturer if the entirety of the content was not taken directly from the textbook.  If you can read on your own then really only the Wednesday lectures about disease biochemistry are worth attending.  Even those are hit-and-miss.  The lectures on less common diseases are usually good and include detailed biochemistry.  The lectures on diseases like cancer, AIDS, and malaria are so basic that anyone with even a passing interest will already know the material in greater depth.  It is laudable that Professor Khosla tries to teach general principles instead of piling on specific information to be memorized.  The exams clearly reflect this approach and they test very little rote memorization.  Overall the material here is important for anyone interested in research in biochemistry or molecular biology, but the class itself is not exciting.  If you have specific interests then you would probably do better to take the relevant classes from the Medical School or Department of Biology.");
	
	var course_list = new Array(course1, course2, course3, course4, course5, course6, course7, course8, course9, course10, course11, course12, course13, course14, course15, course16, course17, course18);
		
	var first = 0;
	var second = 0;
	
	for(var x = 0; x < course_list.length; x++)
	{
		var lowercasetitle = document.classForm.course.value.toString();
		
		if(lowercasetitle.toLowerCase() == "")
		{
			first = -1;
		}
				
		if(lowercasetitle.toLowerCase() == course_list[x].coursetitle.toLowerCase())
		{
			first = x + 1;
		}
				
		if(first != 0)
		{
			break;
		}
	}

	for(var y = 0; y < course_list.length; y++)
	{
		var lowercaseprof = document.classForm.prof.value.toString();
		
		for (var z = 0; z < course_list[y].courseprof.length; z++)
		{
			if(lowercaseprof.toLowerCase() == "")
			{
				second = -1;
			}
			
			if(lowercaseprof.toLowerCase() == course_list[y].courseprof[z].toLowerCase())
			{
				second = y + 1;
			}
				
			if(second != 0)
			{
				break;
			}
		}
		
		if(second != 0)
		{
			break;
		}
	}
	
	if(first > 0 & second > 0 && first == second)
	{
		document.classForm.info.value = course_list[first-1].description;
	}
	
	if(first > 0 && second == -1)
	{
		document.classForm.info.value = "Professor: " + course_list[first-1].courseprof + "\n" + course_list[first-1].description;
	}
	
	if(first == -1 && second > 0)
	{
		document.classForm.info.value = "Course Title: " + course_list[second-1].coursetitle + "\n" + course_list[second-1].description;
	}
	
	if(first > 0 && second > 0 && first != second)
	{
		var special = 0;
		
		for(var r = first; r < course_list.length; r++)
		{
			if(lowercasetitle.toLowerCase() == course_list[x].coursetitle.toLowerCase())
			{
				special = 1;
			}
		}
		
		if(special == 1)
		{
			document.classForm.info.value = course_list[first-1].description;
		}
		else
		{
			document.classForm.info.value = "Your search did not match any results. Please try again.";
		}
		
	}
	if(first == 0 || second == 0)
	{
		document.classForm.info.value = "Your search did not match any results. Please try again.";
	}	
	
}
		
function clearInfo()
{
	document.classForm.prof.value = "";
	document.classForm.course.value = "";
	document.classForm.info.value = "";
}