function checkForm()
{
// http://www.interspire.com/content/articles/23/1/Using-Inline-Form-Validation
hideAllErrors();
var numberForms = document.forms["upload"].length;
var formIndex;
for (formIndex = 0; formIndex < numberForms; formIndex++)
{
	var id=document.forms["upload"][formIndex].name;
	var id_value=document.forms["upload"][formIndex].value;
	switch (true)
		{
		case ((formIndex==2) || (formIndex==8) || (formIndex==10) || (formIndex==11) || (formIndex==12) || (formIndex==13) || (formIndex==14) || (formIndex==15) ||(formIndex==17)): continue;
		case (id_value==""):
				
				var id_Error=id.toString()+"Error";
				var id_Label=id.toString()+"Label";
				alert (id_Error);
				alert (formIndex);
				var elem = document.getElementById(id_Error);
				elem.style.display="inline";
				document.getElementById(id).select();
				document.getElementById(id).focus();
				var elem2 = document.getElementById(id_Label);
				elem2.style.color="red";
				return false;
				break;
		}
}
return true;
}
 
function hideAllErrors()
{
	document.getElementById("NameError").style.display = "none"
	document.getElementById("ContactError").style.display = "none"
	document.getElementById("StreetError").style.display = "none"
	document.getElementById("CityError").style.display = "none"
	document.getElementById("StateError").style.display = "none"
	document.getElementById("ZipcodeError").style.display = "none"
	document.getElementById("Phone1Error").style.display = "none"
	document.getElementById("EmailError").style.display = "none"
	document.getElementById("NameLabel").style.color="black"
	document.getElementById("ContactLabel").style.color="black"
	document.getElementById("StreetLabel").style.color="black"
	document.getElementById("CityLabel").style.color="black"
	document.getElementById("StateLabel").style.color="black"
	document.getElementById("ZipcodeLabel").style.color="black"
	document.getElementById("Phone1Label").style.color="black"
	document.getElementById("EmailLabel").style.color="black"

}

function isLetterKey2(evt,mode,len,input)
{
	//0=all keyboard characters
	//1=[a-zA-Z]
	//2=[a-z]
	//3=[A-Z]
	//4=[0-9()-.]
	//5=[a-zA-Z .'-&_©?@!]
	//sp &'!?@
	//()-.©
 	if (input.value.length >= len) {return false;}

	if (mode==0) {return true;}

        var charCode = (evt.which) ? evt.which : event.keyCode
	
	switch (true)
	{
	case ((charCode==8) || (charCode==32) || (charCode==33) || (charCode==38) || (charCode==44) || (charCode==63) || (charCode==64)) && ((mode==5)):
	return true;	
	break
	case ((charCode==40) || (charCode==41) || (charCode==45) || (charCode==46) || (charCode==169)) && ((mode==4)||(mode==5)):
	return true;	
	break
	case ((charCode> 64) && (charCode < 91))&& ((mode==1) ||(mode==3)||(mode==5)):
	return true;	
	break
	case ((charCode> 96) && (charCode < 123)) && ((mode==3)):
	charCode=charCode-32;
	event.keyCode=charCode;
	return event.keyCode;	
	break
	case ((charCode> 96) && (charCode < 123)) && ((mode==1) ||(mode==2)||(mode==5)):
	return true;	
	break
	case ((charCode> 96) && (charCode < 123)) && ((mode==3)||(mode==5)):
	return true;	
	break
	case ((charCode> 47) && (charCode < 58)) && ((mode==4)||(mode==5)):
	return true;	
	break
	default:
		var msg=String.fromCharCode(charCode)+" is not allowed in this Input Box" + String.fromCharCode(13);
		//var msg=msg+"Keypress=" + String.fromCharCode(charCode);
		//var msg=msg+String.fromCharCode(13)+"Ascii="+charCode;
		alert(msg);
		return false;
	}
		
	
}
function setFocus()
{
upload.Name.select();
upload.Name.focus();
}
