var current_page;	

function select_button () {
	var strhref = window.location.href;
	var file_array = new Array();
	var a;
	
	parts = strhref.split("/");
	file_array = parts[parts.length - 1].split(".");
	
	if (file_array[0] != '') {
		if (file_array[0] != 'index') {
			a = document.getElementById(file_array[0]);
			a.src = 'graphics/'+file_array[0]+'_hover.gif';
		}
		else {
			a = document.getElementById('home');
			a.src = 'graphics/menu/home_hover.gif';
		}
	}
	else {
		a = document.getElementById('home');
		a.src = 'graphics/menu/home_hover.gif';
	}
	current_page = file_array[0];
}
			

function swap_image (source, imid) {
	var a;
	
	if (current_page != imid) {	
		if (current_page != '') {
			a = document.getElementById(imid);
			a.src = 'graphics/menu/'+source+'.gif';
		}
		else {
			if (imid != 'index') {
				a = document.getElementById(imid);
				a.src = 'graphics/'+source+'.gif';
			}
		}
	}
}

function swap (imname) {
	var a = document.getElementById(imname);
	if (document.images) {
		a.src = eval(imname+".src");
	}
}

function restore (imname) {
	var a = document.getElementById(imname);
	a.src = "graphics/menu/"+imname+".gif";
}

function check_submission() {
	for (i=0; i<document.appform.elements.length; i++) {
		if (document.appform.elements[i].value == "") {
			alert("All fields are required!");
			return false;
		}
	}
	return true;
}