// JavaScript Document

function toggle(a, id){
	if(a.firstChild.src.indexOf('minus') > 0){
		document.getElementById(id).style.display = 'none';
		a.parentNode.style.paddingBottom = '20px';
		a.firstChild.src = a.firstChild.src.replace('minus', 'plus');
	}else{
		document.getElementById(id).style.display = 'block';
		a.parentNode.style.paddingBottom = '0px';
		a.firstChild.src = a.firstChild.src.replace('plus', 'minus');
	}
}

//sets the focus to the first text input of a form
function SetFormFocus() {
	/*
	var iStart = 0;
	if (document.forms[0]) {
		if(document.forms[0].elements[1] && document.forms[0].elements[1].id == 'Name') iStart = 1;
		for (count = iStart; count < document.forms[0].length; count++) {
			if (document.forms[0].elements[count].type.toUpperCase() == "TEXT" || document.forms[0].elements[count].type.toUpperCase() == "PASSWORD" ) {
				if ( document.forms[0].elements[count].readonly != true ){
					document.forms[0].elements[count].focus();
					break;
				}
			}
		}
	}*/
	$('#Name').focus();
}
function textFocus(txt){
	txt.className += ' focus';
}
function textBlur(txt){
	txt.className = txt.className.replace(' focus','');
}
function sendMessage(){
	// Loop through all fields on form and display info
	var str = '';
	var elem = document.getElementById('frmEmail').elements;
	str = "<br />Thank you for your request for information.  The following information was sent to Shawn Steward: <br /><em>(IADT Note: Since this is an assignment running on a local computer this does not actually send an email)</em><br /><br />";
	for(var i = 0; i < elem.length; i++){
		if(elem[i].name != 'Submit' && elem[i].name != undefined){
			str += "<b>" + elem[i].name + "</b>" + ":&nbsp;&nbsp;" + elem[i].value.replace("\r", "<br />");
			str += "<br />";
		}
	} 
	document.getElementById('form-data').innerHTML = str;
}
