function initCareers(){
	$$('.infotext').each(function(elem) {
		var	infotext = $(elem).getProperty('infotext');
		if(infotext == null){infotext = '';}
		elem.value = infotext;
		elem.addClass('infotext_empty');
		elem.addEvent('focus', function() {
            infoTextFocus(elem);
        });
        elem.addEvent('blur', function() {
            infoTextBlur(elem);
        });
		if(elem.hasClass('numeric')){
			elem.addEvent('keypress', function(e) {
			   return isNumeric(e.key);
			});
		}
    });
}

function infoTextFocus(elem){
	$('FormErrorsMessage').setStyle('display','none');
	var infotext = elem.getProperty('infotext');
	if(infotext == null){infotext = '';}
	if(elem.value == infotext){
		elem.removeClass('infotext_empty');
		elem.value = '';
	}
}

function infoTextBlur(elem){
	elem = $(elem);
	if(elem.value == null || elem.value == ''){
		var infotext = elem.getProperty('infotext');
		if(infotext == null){infotext = '';}
		elem.value = infotext;
		elem.addClass('infotext_empty');
	}
}

function isNumeric(key)
{
	if('1234567890'.indexOf(key) > -1 || key == 'backspace' || key == 'tab'){
		return true;
	} else {
		return false;
	}
}

function formReset(){
	window.location.href=window.location.href;
}

function checkResumeForm(form){
	var isValid = true;
	$$('.infotext').each(function(elem) {
		if(elem.id == 'StateSelect'){
			var wrapper = elem.getParent();
			wrapper.removeClass('infotext_error');
			var	infotext = $(elem).getProperty('infotext');
			if(infotext == null){infotext = '';}
			if(elem.value == infotext){
				isValid = false;
				wrapper.addClass('infotext_error');
			}
		} else {
			if(elem.hasClass('required')){
				elem.removeClass('infotext_error');
				var	infotext = $(elem).getProperty('infotext');
				if(infotext == null){infotext = '';}
				if(elem.value == infotext){
					isValid = false;
					elem.addClass('infotext_error');
				}
			}
		}
    });
	if(!isValid){
		$('FormErrorsMessage').setStyle('display','block');
	} else {
		// clear the infotext fields that haven't been filled out so the back-end isn't confused
		$$('.infotext').each(function(elem) {
			if(!elem.hasClass('required')){
				var	infotext = $(elem).getProperty('infotext');
				if(infotext == null){infotext = '';}
				if(elem.value == infotext){
					elem.value = '';
				}
			}
		});
		
		// submit the form here or return true
		if (SubmitForm())
		{
			document.ResumeForm.submit();
		}
		return false;
		
		//window.location.href='resume_thanks.html';
		//return isValid;
	}
}

function SubmitForm()
{
	//document.ResumeForm.btnSubmit.disabled = true;
	var length = document.ResumeForm.RESUME.value.length;
	if (length < 255) 
	{
		alert("Please don't forget to copy and paste your resume.\nYour resume is either missing or too short.")
		return false;
	} 
	return true;
}

function toggleCareer(prefix){
	var desc = $(prefix + '_Description');
	if(desc.getStyle('display') == 'block'){
		// close
		desc.setStyle('display','none');
		$(prefix+'_Arrow').setProperty('src','images/arrow_closed.gif');
	} else {
		// open	
		desc.setStyle('display','block');
		$(prefix+'_Arrow').setProperty('src','images/arrow_open.gif');
	}
}
