
function changeColor(obj, oi) {

	if(oi == 'i') {
		obj.style.backgroundColor='#003876';
		obj.style.color='white';
	} else {
		obj.style.backgroundColor='#E7E7E7';
		obj.style.color='#003876';
	}
	
}

function notifyInvalidInput(msg, fld) {
	alert(msg);
	fld.style.background = 'yellow';
	fld.focus();
}

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function sendURL(dest) {

	switch(dest) {
		case 'home':
			document.location='index.php';
			break;
		case 'about':
			document.location = 'about_aw.php';
			break;
		case 'contribute':
			document.location = 'contribute.php';
			break;
		case 'contact_us':
			document.location = 'contact_us.php';
			break;
		case 'volunteer':
			document.location = 'volunteer.php';
			break;
		
	}
}

function submitChange(todo, form) {

	if(todo == "delete") {
		
		form.action = "deleterecord.php";
		
	} else {
	
		form.action = "index.php?page=updateitem";
	
	}
	
	form.submit();
}

//checks if passed extension array exists in filename extention
function extensionExists(filename, ext_ary) {

	var dotLoc = filename.lastIndexOf('.');
	var ext = filename.substr(dotLoc+1, 3).toLowerCase();
	var ext_found = false;
	
	for(var i = 0;i < ext_ary.length; i++) {
		
		if(ext_ary[i] == ext) {
			ext_found = true;
		}
		
	}
	
	return ext_found;
	
}
