/****************** code for Enrollment Form *****************************/

function menuSet()
{
	spec_menu = document.getElementById("Spec")
	spec = spec_menu.options[spec_menu.selectedIndex].value
	if (spec=="Other"||spec=="Multi")
		{document.getElementById("SpecOther").style.visibility = 'visible'}
	else {document.getElementById("SpecOther").style.visibility = 'hidden'}
	document.Fullform.Practice_Specialty.value = spec_menu.options[spec_menu.selectedIndex].text
}

/*
function billPref(x)
{
	var loc = document.getElementById("BillTxt")
	if (x==1||x==2) {loc.innerHTML ="After clicking the Sign Up button, you may print out the credit card form available from the confirmation screen, or we will send it to you later."}
	if (x==3||x==4) {loc.innerHTML ="We will send you an invoice after we receive this enrollment form."}
}
*/

function checkValid()
{
	if (!document.Fullform.Practice_Name.value)
		{document.Fullform.Practice_Name.focus()
		alert("Section 1.\nPlease enter the name of your practice.")
		return false}
	if (document.Fullform.Practice_Specialty.value == "Choose" || document.Fullform.Practice_Specialty.value == "")
		{document.Fullform.Spec.focus()
		alert("Section 1.\nPlease select your practice specialty.")
		return false}
	if (!document.Fullform.Website_Creation[0].checked && !document.Fullform.Website_Creation[1].checked)
		{jumpto('Website_Pref'); document.getElementById("Running_Start").focus()
		alert("Section 2.\nPlease select a Design Package.")
		return false}
	if (!document.Fullform.Service_Package[0].checked && !document.Fullform.Service_Package[1].checked && !document.Fullform.Service_Package[2].checked)
		{jumpto('Website_Pref'); document.getElementById("Professional_Package").focus()
		alert("Section 2.\nPlease select a Service Package.")
		return false}
	if (!document.Fullform.Contact_Name.value)
		{document.Fullform.Contact_Name.focus()
		alert("Section 3.\nPlease enter the name of the website contact for your practice.")
		return false}
	if (!document.Fullform.Contact_Fax.value)
		{document.Fullform.Contact_Fax.focus()
		alert("Section 3.\nPlease enter your fax number.")
		return false}
	if (!document.Fullform.Contact_Email.value)
		{document.Fullform.Contact_Email.focus()
		alert("Section 3.\nPlease enter your email address.")
		return false}
	if (!document.Fullform.Agreement_read.checked)
		{document.Fullform.Agreement_read.focus()
		alert("Section 6.\nPlease verify that you have read and agree to the Website Service Agreement.")
		return false}

	var confirmed = confirm("Is the form complete and accurate?\n\nDid you print a copy for your records?\n\nClick OK to continue or Cancel to return to the form.")

	if (confirmed) {
		var profilestr = 'Practice_Name=' + escape(document.Fullform.Practice_Name.value)
		profilestr += '&Specialty=' + escape(document.Fullform.Practice_Specialty.value) + '+' + escape(document.Fullform.Specialty_Other.value)
		profilestr += '&Spec=' + document.Fullform.Spec.value

		profilestr += '&Preferred_URL=www%2E' + escape(document.Fullform.Preferred_URL.value) + '%2Ecom'
		if (document.Fullform.Website_Creation[0].checked) var Website_Creation = document.Fullform.Website_Creation[0].value
		if (document.Fullform.Website_Creation[1].checked) var Website_Creation = document.Fullform.Website_Creation[1].value
		profilestr += '&Website_Creation=' + escape(Website_Creation)

		document.Fullform.Profile_String.value = profilestr

		return true // confirm(document.Fullform.Profile_String.value)
	}
	else return false
}


function jumpto(id)
{
	if (obj = document.getElementById(id))
	{
		var curleft = curtop = 0;
		if (obj.offsetParent)
		{
			do {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
			} while (obj = obj.offsetParent)

		window.scroll(curleft,curtop)
		}
	}
}



/****************** code for Practice Profile *****************************/

function selectAll()
{
	var yesno = document.Fullform.Select_All.checked

	for (var i=0; i< document.Fullform.elements.length; i++)
	{
		var thisone = document.Fullform.elements[i]
		if (thisone.name=="Article")
			{thisone.checked = yesno}
	}
}
function auxSelectAll()
{
	document.Fullform.Select_All.checked=!document.Fullform.Select_All.checked
	selectAll()
}


function compilePtEd()
{
	document.Fullform.Selected_Articles.value = ""
	for (var i=0; i< document.Fullform.elements.length; i++)
	{
		var thisone = document.Fullform.elements[i]
		if (thisone.name=="Article")
		{	if (thisone.checked||thisone.type=="hidden")
		 {document.Fullform.Selected_Articles.value += thisone.value+'\n\n'}
		}
	}
}



/****************** code for Locator Form *****************************/

function LcheckValid()
{
	if (!document.Fullform.Contact_Name.value)
		{document.Fullform.Contact_Name.focus()
		alert("Section 1.\nPlease enter the name of the contact person for your practice.")
		return false}
	if (!document.Fullform.Practice_Name.value)
		{document.Fullform.Practice_Name.focus()
		alert("Section 1.\nPlease enter the name of your practice.")
		return false}
	if (!document.Fullform.Contact_Fax.value)
		{document.Fullform.Contact_Fax.focus()
		alert("Section 1.\nPlease enter your fax number.")
		return false}
	if (!document.Fullform.Contact_Email.value)
		{document.Fullform.Contact_Email.focus()
		alert("Section 1.\nPlease enter your email address.")
		return false}
	if (!document.Fullform.Agreement_read.checked)
		{document.Fullform.Agreement_read.focus()
		alert("Section 8.\nPlease verify that you have read and agree to the Website Service Agreement.")
		return false}

	return confirm("Is the form complete and accurate?\n\nDid you print a copy for your records?\n\nClick OK to continue or Cancel to return to the form.")
}
