// calculate script
function countit(what){
formcontent=what.form.bio.value
what.form.displaycount.value=formcontent.length
}
//-->

// Start Form Check
	function validEmail(inEmail) {
		invalidChars = "/:,;"
		if (inEmail == "") {
			return false; }
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i)
		if (inEmail.indexOf(badChar,0) > -1) {
				return false; }
			}
			atPos = inEmail.indexOf("@",1)
		if (atPos == -1) {
				return false; }
		if (inEmail.indexOf("@",atPos+1) > -1) {
				return false; }
			periodPos = inEmail.indexOf(".",atPos)
		if (periodPos == -1) {
				return false; }
		if (periodPos+3 > inEmail.length) {
				return false; }
		else {
				return true; }
	}
	
function validForm(contact) {
		// check bio length
		var maxlength=500
			if (contact.bio.value.length>maxlength){
			alert("your bio is longer then 500 characters. please go back and edite your bio.")
			return false; }

			if (contact.first_name.value == "") {
			alert("Please enter your first name")
			contact.first_name.focus()
			return false; }
			
			if (contact.last_name.value == "") {
			alert("Please enter your last name.")
			contact.last_name.focus()
			return false; }
			
			if (contact.address.value == "") {
			alert("Please enter address.")
			contact.address.focus()
			return false; }
			
			if (contact.city.value == "") {
			alert("what city do you live in?")
			contact.city.focus()
			return false; }
			
			
			stateChoice = contact.state.selectedIndex
			if (contact.state.options[stateChoice].value == "") {
			alert("you must select a state")
			return false; }
			
			
			if (contact.zip.value == "") {
			alert("we'll need your zip code")
			contact.zip.focus()
			return false; }
			
			if (contact.state.value == "") {
				alert("you must select a state")
				return false; }

			if (contact.home_phone_areacode.value == "") {
			alert("enter you area code")
			contact.home_phone_areacode.focus()
			return false; }
			
			if (contact.home_phone_prefix.value == "") {
			alert("what are the next 3 numbers?")
			contact.home_phone_prefix.focus()
			return false; }
			
			if (contact.home_phone_sufix.value == "") {
			alert("Please enter the last 4 numbers")
			contact.home_phone_sufix.focus()
			return false; }
			
			if (contact.email.value == "") {
			alert("You must enter an email address")
			contact.email.focus()
			return false; }
			
			if (!validEmail(contact.email.value)) {
			alert("You must enter a valid email address")
			contact.email.focus()
			return false; }
			
			artistsChoice = contact.artists_type.selectedIndex
			if (contact.artists_type.options[artistsChoice].value == "") {
			alert("Select an artists type")
			return false; }
			
			if (contact.bio.value == "") {
			alert("Please enter your a brief bio 500 characters or less")
			contact.bio.focus()
			return false; }
			
			if (contact.upload_file.value == "") {
			alert("Please attach a file")
			contact.upload_file.focus()
			return false; }
			
			if (contact.foundus.value == "") {
			alert("Please let us know how you found our site")
			contact.foundus.focus()
			return false; }
			}	
//-->

//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}
