	 function getIndexByValue(selectlist, valfind) {
		//This functions returns the index number for a submitted option box value
		i=0;
		while (selectlist.options[i] != null) {
			if (selectlist.options[i].value == valfind) {
				return i
			}
			i++
		}
		return 0;
	 
	 }
 
	function showhidedropdown(state_max, docform) {
	//to get an option value:   document.form_name.select_id.options[option ID starts with 1].value
	//to get current option ID:   document.form_name.select_id.selectedIndex
	//to get current option value:  document.form_name.select_id.options[document.form_name.select_id.selectedIndex].value
	//pain in the ass, huh?
		
		
		new_id=document.getElementById(docform.thisstate.options[docform.thisstate.selectedIndex].value)
		//new_id=eval(thisstate.value)

		for(i=0;i < state_max+1; i++){

			allunv = document.getElementById("thisunv"+i)
			allunv.selectedIndex = 0


			cur_id = document.getElementById("university"+i)
			
			
			//cur_id=eval("university"+i)
			
			if (cur_id==new_id){
				cur_id.style.display = "inline"
			}
			else{
				cur_id.style.display = "none"
			} 
		} 
		docform.school.value = ""
	}

	function selectschool(curunv, docform) {

		docform.school.value = curunv.options[curunv.selectedIndex].value

		
		scale = parseInt(curunv.options[curunv.selectedIndex].getAttribute('value2'))
		pricegrid(scale, docform)
		showstep3 = document.getElementById("step3")
		showstep3.style.display = "block";
		
		changerow = docform.level.selectedIndex
		changecol = docform.hours.selectedIndex

		if (changerow && changecol) {
			temp = "g"+changerow+changecol
			cell = document.getElementById(temp)
			docform.rate.value = cell.innerHTML.replace("$","")
		}	

		

	}
	
	function setschool(schoollist, unvfrm) { //a simple version of select school
		unvfrm.school.value = schoollist.options[schoollist.selectedIndex].value
	}
	
	
	function pricegrid(scale, docform) {
		
		for(row=1;row <= 4; row++){
			for(col=1;col <= 5; col++){
				cell = document.getElementById("g"+row+col)
				cell.innerHTML = "$"+priceary[row+scale-1][col]
			}
		}
	
	}

	function changecolor(docform) {

		changerow = docform.level.selectedIndex

		changecol = docform.hours.selectedIndex

		for(row=1;row <= 4; row++){
			for(col=1;col <= 5; col++){
				cell = document.getElementById("g"+row+col)

				if (row == changerow) {
					cell.style.backgroundColor = "#FF8588"
				}
				else if (col == changecol) {
					cell.style.backgroundColor = "#B9C3FF"
				}
				else {
					cell.style.backgroundColor = "#D6D6D6"
				}
				cell.style.color = "#000000"
			}
		}
		
		if (changerow && changecol) {
			cell = document.getElementById("g"+changerow+changecol)
			cell.style.backgroundColor = "purple"
			cell.style.color = "white"
			docform.rate.value = cell.innerHTML.replace("$","")
		}
		else {
			docform.rate.value = "";
		}
	}
	
	
	function clickflipbar(the_id_name) {
		//version 2, changes img and div at same time
		//this will hide/show an element with name the_id_name
		//and it will switch the picture on an element with the_id_namei
		
		the_id = document.getElementById(the_id_name)
		the_img = document.getElementById(the_id_name + "i")
		
		if (the_img.src.indexOf('open') > 0) {
			if (the_id) the_id.style.display = "none"
			the_img.src = 'images/tutors-college-close.gif';
		}
		else {
			if (the_id) the_id.style.display = "block"
			the_img.src = 'images/tutors-college-open.gif';
		}
	}//*/

	function hoverflip1bar(the_img) {
		if (the_img.src.indexOf('close') > 0) { /*the_img.src = 'images/tutors-college-subjects.gif'; */ }
	}
	function hoverflip2bar(the_img) {
		if (the_img.src.indexOf('subjects') > 0) { the_img.src = 'images/tutors-college-close.gif';  }
	}