function toggleVisibility (objectId)
{
	object = document.getElementById(objectId);
	if ( object.style.display == 'block' )
		object.style.display = 'none';
	else
		object.style.display = 'block';
}

function click_to_enlarge(image){
	window.open('/showimage.php?src='+image+'', '', 'menubar=no,toolbar=no,location=no,directories=yes,status=no,scrollbars=yes,fullscreen=no,channelmode=no,width=50,height=50,left=100,top=100').focus();
	return false;
}
var previous_comment;

function showComment(id)
{
	if (!id) return;

	if(!previous_comment)
		previous_comment = 1;

	if (previous_comment == id)
		return;

	if (document.getElementById('comment_' + id))
		document.getElementById('comment_' + id).innerHTML='<b>[' + id + ']</b>';

	if (document.getElementById('comment_' + previous_comment))
		document.getElementById('comment_' + previous_comment).innerHTML='[' + previous_comment + ']';

	document.getElementById('visible_comments').innerHTML = document.getElementById('hidden_comments_' + id).innerHTML;
	document.getElementById('current_page').innerHTML = id;

	previous_comment = id;
}

function confirmDelete(sName, iId) {
	confirmation = confirm('Are you sure to delete "' + sName + '"?');
	if (confirmation == true) {
		document.location = '?delete=' + iId;
		return true;
	}
	document.location = '';
	return false;
}

function showHideBox(name) {
	var boxDisplayState = document.getElementById(name).style.display;
	if (boxDisplayState == 'none' || boxDisplayState == '') {
		document.getElementById(name).style.display = 'block';
	} else {
		document.getElementById(name).style.display = 'none';
	}
	return true;
}

function checkAll(id, key) {
	var list = document.getElementById(key).elements['college[]'];
	for (var i = 0; i < list.length; i++) {
		if (list[i].id.search('_' + id) > 0) {
			document.getElementById(key).elements['college[]'][i].checked = true;
		}
	}
}

function unCheckAll(id, key) {
	var list = document.getElementById(key).elements['college[]'];
	for (var i = 0; i < list.length; i++) {
		if (list[i].id.search('_' + id) > 0) {
			document.getElementById(key).elements['college[]'][i].checked = false;
		}
	}
}

function showSchools(id) {
	if (document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}

	return true;
}