function toggle(id)
{
for (var idx = 0; idx < 12; idx++)
{
	var thisTitle = document.getElementById("title_" + id);
	thisTitle.style.display = 'none';
}

var contents = document.getElementById('div_' + id);//check boxes
var titles = document.getElementById('title_' + id);
var state = (contents.style.display == 'block') ? 'expanded' : 'collapsed';
var thisStat = eval("document.awards.stat_" + id);

contents.style.display = (state == 'expanded') ? 'none' : 'block';
contents.style.width = '100%';
titles.style.display = 'block';

thisStat.style.display = 'none';

if (state == 'expanded')
{
	plusSymbols(0,id);

	thisStat.style.display = 'block';

	for (var idx = 0; idx < 12; idx++)
	{
		var thisTitle = document.getElementById("title_" + id);
		thisTitle.style.display = 'block';
	}
}
else {
	plusSymbols(1,id);
}
}

function subtoggle(type,place)
{
	if (type == 'attc')
		tempVar = critStates1;
else
	tempVar = critStates2;

for (var idx = 0; idx < tempVar.length; idx++)
{
	var thisState = document.getElementById("div_" + type + "_" + tempVar[idx]);
	thisState.style.display = 'none';
}

var contents = document.getElementById('div_' + type + "_" + place);
var state = (contents.style.display == 'block') ? 'expanded' : 'collapsed';

contents.style.display = (state == 'expanded') ? 'none' : 'block';
contents.style.width = '100%';
}

function plusSymbols(state,id)
{
msg = '..return to categories'
var thisPlus = eval("document.awards.plus_" + id);

if (state == 1)
{
	thisPlus.value = msg;
}
else
{
	thisPlus.value = '';
}
}

function update(id)
{
var thisCriteria = eval("document.awards.criteria_" + id);
var thisCriteriaValue = eval("document.awards.criteriaValue_" + id);
var thisStat = eval("document.awards.stat_" + id);
var thisStatValue = eval("document.awards.statValue_" + id);
var totalChecked = 0;
var maxchars = 43;
var statusHeight = 43;

thisStat.value = '';
thisStatValue.value = '';

for (var i = 0; i < thisCriteria.length; i++)
{
	if (thisCriteria[i].checked == true)
	{
		thisStat.value = thisStat.value + " " + thisCriteria[i].value.substring(0,maxchars);
		thisStatValue.value = thisStatValue.value + "," + thisCriteriaValue[i].value;

		if (thisCriteria[i].value.length > maxchars)
		{
			thisStat.value = thisStat.value + "...\n";
		}

		else
		{
			thisStat.value = thisStat.value + "\n";
		}

		thisStat.style.color = "#0066FF"
		totalChecked++;
	}
}
thisStatValue.value = thisStatValue.value.substring(1);


if (totalChecked != 0)
	thisStat.style.height = 28 + totalChecked*13;

else
{
	thisStat.style.height = statusHeight;
	thisStat.value = ' (No Criteria Specified)';
	thisStat.style.color = "#707070"
}
}

function showOther(category_select){
	if(category_select.options[category_select.selectedIndex].value == 99){
		document.getElementById('suggest_category').style.display="";
		document.awards.suggest_c.focus();
	}else document.getElementById('suggest_category').style.display="none";
}

function updateAll(){
	for(var i=1; i < 12; i++){
		update(i);
	}
}


function addbookmark(url)
{
	title="Welcome To Scholarship Search Tool";
	
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}