document.write('<script type="text/javascript" src="js/lib/standard.scripts.js"></script>');
document.write('<script type="text/javascript" src="js/lib/sortable.table.js"></script>');

        function toggleDivStates($value) {
                if ($value == "studentid") {
                        modifyDivState('studentid','block');
                        modifyDivState('name','none');
                }
                if ($value == "name") {
                        modifyDivState('name','block');
                        modifyDivState('studentid','none');
                }
        }


function modifyDivState(div,style) {
	if (document.getElementById) {
		hza = document.getElementById(div);
		hza.style.display = style;
	}
}

function is_graduated(value) {
	college_div = document.getElementById('college');
	no_college_div = document.getElementById('no_college');

	if (value == 'Y') { college_div.style.display = 'block'; no_college_div.style.display = 'none'; }
	if (value == 'N') { no_college_div.style.display = 'block'; college_div.style.display = 'none'; }

}

function toggleDivState(div) {
	if (document.getElementById) {

		hza = document.getElementById(div);
		myState = hza.style.display;

		if(myState == 'none') {
			hza.style.display = 'block';
		}
		else {
			hza.style.display = 'none';
		}
	}
}

function record_editor(action,table,value,urlext) {
	if (value <= 0) {
		alert("You must select a "+table+" to use the editor.");
	} else {
		window.location.href='?action='+action+'&'+table+'_dbformid='+value+'&'+urlext;
	}
}

/*********************************************/
	function confirmDelete(action,url,url_decline) {
	
		var answer = confirm("Are you sure you want to "+action+" this record?");
		
		if(answer) {
			
			window.location = url;
			
			return true;
			
		}

		window.location=url_decide;
		return false;
		
	}

/*********************************************/

	function survey_type_options_display(value) {
		hza = document.getElementById('options');

		if (value == 'heading') {
			hza.style.display = 'none';
		} else {
			hza.style.display = 'block';
		}
	}

	function textCounter(field,cntfield,maxlimit) {
		if (field.value.length > maxlimit) // if too long...trim it!
			field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
		else
			cntfield.value = Math.round((maxlimit - field.value.length)/5);
}
