
function getTheForm (ev) {
	var theForm = null

	var browser_type = navigator.appName
	var platform = navigator.platform

	if (browser_type=="Netscape") {
		//Netscape or Compatible
		theForm = ev.target
	} else if (browser_type=="Microsoft Internet Explorer") {
		if ( platform && platform.substr(0, 2) == "Mac" ) {
			// Internet Explorer - Macintosh
			var theSrc = window.event.srcElement
			theForm = theSrc.form
		} else {
			// Internet Explorer - Windows
			theForm = window.event.srcElement
		}
	}
	
	return theForm
}

function contactusformSubmit (ev) {
	var theForm = getTheForm(ev)
	
	var subject = "Customer Questions/Comments"
	var recipient = "sales@hermleclock.com"
	//var recipient = "klint@prototypeadvertising.com"
	var body = ""

	if (! theForm.name.value) {
		alert("Please enter your name")
		theForm.name.focus()
		return false
	}

	body += "Name: "+ theForm.name.value + "\n"
	body += "Company: "+ (theForm.company.value ? theForm.company.value : "n/a") + "\n"
	body += "Address: "+ (theForm.address.value ? theForm.address.value : "n/a") + "\n"
	body += "City: "+ (theForm.city.value ? theForm.city.value : "n/a") + "\n"
	body += "State: "+ (theForm.state.value ? theForm.state.value : "n/a") + "\n"
	body += "Zip: "+ (theForm.zip.value ? theForm.zip.value : "n/a") + "\n"
	body += "Phone: "+ (theForm.phone.value ? theForm.phone.value : "n/a") + "\n"
	body += "Fax: "+ (theForm.fax.value ? theForm.fax.value : "n/a") + "\n\n"
	body += "Questions/Comments: \n\n" + theForm.comments.value

	document.location.href = "mailto:" + recipient + "?Subject=" + escape(subject) + "&Body=" + escape(body)
	return false
}

function wheretobuyformSubmit (ev) {
	var theForm = getTheForm(ev)
	
	var subject = "Dealer Location Request"
	var recipient = "sales@hermleclock.com"
	//var recipient = "klint@prototypeadvertising.com"
	var body = ""

	if (! theForm.name.value) {
		alert("Please enter your name")
		theForm.name.focus()
		return false
	}
	
	if (! theForm.email.value) {
		alert("Please enter your email address")
		theForm.email.focus()
		return false
	}

	if (! theForm.city.value) {
		alert("Please enter your city")
		theForm.city.focus()
		return false
	}
	
	if (! theForm.state.value) {
		alert("Please enter your state")
		theForm.state.focus()
		return false
	}
	
	if (! theForm.zipcode.value) {
		alert("Please enter your zip code")
		theForm.zipcode.focus()
		return false
	}
	
	body += "Name: "+ theForm.name.value + "\n"
	body += "Email: "+ theForm.email.value + "\n"
	body += "City: "+ theForm.city.value + "\n"
	body += "State: "+ theForm.state.value + "\n"
	body += "Zip Code: "+ theForm.zipcode.value + "\n\n"
	body += "Questions/Comments: \n\n" + theForm.comments.value

	document.location.href = "mailto:" + recipient + "?Subject=" + escape(subject) + "&Body=" + escape(body)
	return false
}