function autoSelectInquiry()
{
	showDiv(0);
	var iType
	iType=document.location.search;
	iType=iType.substring(7,iType.length)
	if ((iType>0)&&(iType<(document.forms['EmailForm'].InquiryTypeDropDown.length)))
	{
		document.forms['EmailForm'].InquiryTypeDropDown.options[iType].selected=true;
		for (var i=0; i < document.forms['EmailForm'].InquiryTypeDropDown.length;i++)
		{
			if((document.forms['EmailForm'].InquiryTypeDropDown.options[i].value)==iType)
			{
				document.forms['EmailForm'].InquiryTypeDropDown.options[iType].selected=true;
				showDiv(iType);
			}
		}
	}
	document.EmailForm.InquiryTypeDropDown.selectedIndex=0;
}

function resetStyle(fldName)
{
	fldName = "lbl" + fldName;
	document.getElementById(fldName).style.color = "black";
	document.getElementById(fldName).style.fontWeight = "normal";	
}

function resetStyles()
{
	//Reset Styles
	resetStyle("AccountNumber")
	resetStyle("Attachment")
	resetStyle("CDTitle");
	resetStyle("CompanyName")
	resetStyle("CourseDate");
	resetStyle("CourseName");
	resetStyle("CourseNames");
	resetStyle("DescriptionOfRequest");
	resetStyle("DVDTitle");
	resetStyle("EmailAddress");
	resetStyle("FeedbackType");
	resetStyle("FirstName");
	resetStyle("InquiryDescription");
	resetStyle("InquiryOther");
	resetStyle("InvoiceNumber");
	resetStyle("LastName");
	resetStyle("LearnersEmail");
	resetStyle("LearnersName");
	resetStyle("Media");
	resetStyle("MediaType");
	resetStyle("PhoneNumber");
	resetStyle("PracticeArea");
	resetStyle("Product");
	resetStyle("ProductLine");
	resetStyle("ProductTitles");
	resetStyle("Title");
	resetStyle("Topic");
	resetStyle("UserName");
	resetStyle("ZipCode")
}

function requireField(fldName)
{
	fldName = "lbl" + fldName;
	document.getElementById(fldName).style.color = "red";
	document.getElementById(fldName).style.fontWeight = "bold";
	flag = false;
}

function displayAttachmentInput()
{
	document.getElementById("dependent-upload-link").style.display = 'none';
	document.getElementById("dependent-upload").style.display = 'block';
}

function showDiv(optionValue)
{
	resetStyles();

	// first hide all dependent divs
	document.getElementById("dependent-inquiry-other").style.display = 'none';
	document.getElementById("Inquiry-Details-Fieldset").style.display = 'none';
	document.getElementById("dependent-inquiry-description").style.display = 'none';
	document.getElementById("dependent-product-line").style.display = 'none';
	document.getElementById("dependent-product").style.display = 'none';
	document.getElementById("dependent-media").style.display = 'none';
	document.getElementById("dependent-practice-area").style.display = 'none';
	document.getElementById("dependent-course-name").style.display = 'none';
	document.getElementById("dependent-course-date").style.display = 'none';
	document.getElementById("dependent-invoice-number").style.display = 'none';
	document.getElementById("dependent-user-name").style.display = 'none';
	document.getElementById("dependent-title").style.display = 'none';
	document.getElementById("dependent-cd-title").style.display = 'none';
	document.getElementById("dependent-dvd-title").style.display = 'none';
	document.getElementById("dependent-media-cd").style.display = 'none';
	document.getElementById("dependent-media-dvd").style.display = 'none';
	document.getElementById("dependent-media-type").style.display = 'none';
	document.getElementById("dependent-learners-name").style.display = 'none';
	document.getElementById("dependent-learners-email").style.display = 'none';
	document.getElementById("dependent-course-names").style.display = 'none';
	document.getElementById("dependent-feedback-type").style.display = 'none';
	document.getElementById("dependent-topic").style.display = 'none';
	document.getElementById("dependent-product-title").style.display = 'none';
	document.getElementById("dependent-upload-link").style.display = 'none';
	document.getElementById("dependent-upload").style.display = 'none';
	document.getElementById("Submit-Buttons").style.display = 'none';
	document.EmailForm.InquiryDescriptionDropDown.selectedIndex=0;
	document.EmailForm.ProductDropDown.selectedIndex=0;

	var inqDesc = document.EmailForm.InquiryDescriptionDropDown;
	var prod = document.EmailForm.ProductDropDown;
	
	switch (optionValue)
	{
		//Customer Service
		case "1":
			window.document.EmailForm.FormType.value="1";

			inqDesc.length=1;
			inqDesc.options[inqDesc.options.length] = new Option('User ID, PW & Access Codes','User ID, PW & Access Codes');
			inqDesc.options[inqDesc.options.length] = new Option('Billing Inquiry','Billing Inquiry');
			inqDesc.options[inqDesc.options.length] = new Option('Change Address / Contact Name','Change Address / Contact Name');
			inqDesc.options[inqDesc.options.length] = new Option('CPE Certificates / Questions','CPE Certificates / Questions');
			inqDesc.options[inqDesc.options.length] = new Option('Credit Card Confirmation','Credit Card Confirmation');
			inqDesc.options[inqDesc.options.length] = new Option('Invoice Copy Request','Invoice Copy Request');
			inqDesc.options[inqDesc.options.length] = new Option('Order Inquiry','Order Inquiry');
			inqDesc.options[inqDesc.options.length] = new Option('Payment Inquiry','Payment Inquiry');
			inqDesc.options[inqDesc.options.length] = new Option('Product Release Information Request','Product Release Information Request');
			inqDesc.options[inqDesc.options.length] = new Option('Product Return','Product Return');
			inqDesc.options[inqDesc.options.length] = new Option('Replacements / Claims','Replacements / Claims');
			inqDesc.options[inqDesc.options.length] = new Option('Shipping Status','Shipping Status');
			inqDesc.options[inqDesc.options.length] = new Option('W-9 Request','W-9 Request');
			inqDesc.options[inqDesc.options.length] = new Option('Other','Other');

			AddDefaultProducts();

			document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
			document.getElementById("dependent-inquiry-description").style.display = 'block';
			document.getElementById("dependent-upload-link").style.display = 'block';
			document.getElementById("Submit-Buttons").style.display = 'block';
			break

		//Technical Assistance
		case "2":
			window.document.EmailForm.FormType.value="2";

			inqDesc.length=1;
			inqDesc.options[inqDesc.options.length] = new Option('User ID, PW & Access Codes','User ID, PW & Access Codes');
			inqDesc.options[inqDesc.options.length] = new Option('CPE Certificates / Questions','CPE Certificates / Questions');
			inqDesc.options[inqDesc.options.length] = new Option('Error Messages','Error Messages');
			inqDesc.options[inqDesc.options.length] = new Option('Installation / Upgrade Assistance','Installation / Upgrade Assistance');
			inqDesc.options[inqDesc.options.length] = new Option('Network Support','Network Support');
			inqDesc.options[inqDesc.options.length] = new Option('Printing Problems','Printing Problems');
			inqDesc.options[inqDesc.options.length] = new Option('System Requirements','System Requirements');
			inqDesc.options[inqDesc.options.length] = new Option('Other','Other');

			AddDefaultProducts();

			document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
			document.getElementById("dependent-inquiry-description").style.display = 'block';
			document.getElementById("dependent-upload-link").style.display = 'block';
			document.getElementById("Submit-Buttons").style.display = 'block';
			break

		//Editorial & Product Usage
		case "3":
			window.document.EmailForm.FormType.value="3";

			inqDesc.length=1;
			inqDesc.options[inqDesc.options.length] = new Option('User ID, PW & Access Codes','User ID, PW & Access Codes');
			inqDesc.options[inqDesc.options.length] = new Option('Content Verification','Content Verification');
			inqDesc.options[inqDesc.options.length] = new Option('Copyright / Permissions / Reprint','Copyright / Permissions / Reprint');
			inqDesc.options[inqDesc.options.length] = new Option('Customer Product Training','Customer Product Training');
			inqDesc.options[inqDesc.options.length] = new Option('Document Request','Document Request');
			inqDesc.options[inqDesc.options.length] = new Option('Filing Assistance','Filing Assistance');
			inqDesc.options[inqDesc.options.length] = new Option('Form Status','Form Status');
			inqDesc.options[inqDesc.options.length] = new Option('Navigation / Functionality / How to','Navigation / Functionality / How to');
			inqDesc.options[inqDesc.options.length] = new Option('Replacements / Claims','Replacements / Claims');
			inqDesc.options[inqDesc.options.length] = new Option('Search Assistance (Where to locate)','Search Assistance (Where to locate)');
			inqDesc.options[inqDesc.options.length] = new Option('Other','Other');

			AddDefaultProducts();

			document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
			document.getElementById("dependent-inquiry-description").style.display = 'block';
			document.getElementById("dependent-upload-link").style.display = 'block';
			document.getElementById("Submit-Buttons").style.display = 'block';
			break

		//Feedback
		case "4":
			window.document.EmailForm.FormType.value="4";

			inqDesc.length=1;
			inqDesc.options[inqDesc.options.length] = new Option('Compliment','Compliment');
			inqDesc.options[inqDesc.options.length] = new Option('Complaint','Complaint');
			inqDesc.options[inqDesc.options.length] = new Option('Suggestion','Suggestion');
			inqDesc.options[inqDesc.options.length] = new Option('Other','Other');

			prod.length=1;

			document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
			document.getElementById("dependent-inquiry-description").style.display = 'block';
			document.getElementById("dependent-product-line").style.display = 'block';
			document.getElementById("dependent-feedback-type").style.display = 'block';
			document.getElementById("dependent-upload-link").style.display = 'block';
			document.getElementById("Submit-Buttons").style.display = 'block';
			break

		//Other
		case "5":
			window.document.EmailForm.FormType.value="5";

			inqDesc.length=1;
			prod.length=1;

			document.getElementById("dependent-inquiry-other").style.display = 'block';
			document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
			document.getElementById("dependent-product-line").style.display = 'block';
			document.getElementById("dependent-topic").style.display = 'block';
			document.getElementById("dependent-upload-link").style.display = 'block';
			document.getElementById("Submit-Buttons").style.display = 'block';
			break

	} //switch
} //showDiv

function AddDefaultProducts()
{
	var prod = document.EmailForm.ProductDropDown;
	prod.length=1;

	prod.options[prod.options.length] = new Option('Checkpoint','Checkpoint');
	prod.options[prod.options.length] = new Option('e-Form','e-Form');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for PPC','Checkpoint Tools for PPC');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for WG&L','Checkpoint Tools for WG&L');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for Tax','Checkpoint Tools for Tax');
	prod.options[prod.options.length] = new Option('MicroMash','MicroMash');
	prod.options[prod.options.length] = new Option('MicroMash Plus','MicroMash Plus');
	prod.options[prod.options.length] = new Option('Quickfinder','Quickfinder');
	prod.options[prod.options.length] = new Option('Online Grading','Online Grading');
	prod.options[prod.options.length] = new Option('Pass Online','Pass Online');
	prod.options[prod.options.length] = new Option('PPC CD','PPC CD');
	prod.options[prod.options.length] = new Option('Reqwired','Reqwired');
	prod.options[prod.options.length] = new Option('RIA/WG&L CD','RIA/WG&L CD');
	prod.options[prod.options.length] = new Option('SMART Practice Aids','SMART Practice Aids');
	prod.options[prod.options.length] = new Option('Other','Other');
}

function AddDocumentProducts()
{
	var prod = document.EmailForm.ProductDropDown;
	prod.length=1;

	prod.options[prod.options.length] = new Option('Checkpoint','Checkpoint');
	prod.options[prod.options.length] = new Option('e-Form','e-Form');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for PPC','Checkpoint Tools for PPC');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for WG&L','Checkpoint Tools for WG&L');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for Tax','Checkpoint Tools for Tax');
	prod.options[prod.options.length] = new Option('PPC CD','PPC CD');
	prod.options[prod.options.length] = new Option('PPC Print','PPC Print');
	prod.options[prod.options.length] = new Option('Quickfinder','Quickfinder');
	prod.options[prod.options.length] = new Option('RIA/WG&L CD','RIA/WG&L CD');
	prod.options[prod.options.length] = new Option('RIA/WG&L Print','RIA/WG&L Print');
	prod.options[prod.options.length] = new Option('SMART Practice Aids','SMART Practice Aids');
	prod.options[prod.options.length] = new Option('Other','Other');
}

function AddReprintProducts()
{
	var prod = document.EmailForm.ProductDropDown;
	prod.length=1;

	prod.options[prod.options.length] = new Option('Checkpoint','Checkpoint');
	prod.options[prod.options.length] = new Option('e-Form','e-Form');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for PPC','Checkpoint Tools for PPC');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for WG&L','Checkpoint Tools for WG&L');
	prod.options[prod.options.length] = new Option('Checkpoint Tools for Tax','Checkpoint Tools for Tax');
	prod.options[prod.options.length] = new Option('MicroMash','MicroMash');
	prod.options[prod.options.length] = new Option('MicroMash Plus','MicroMash Plus');
	prod.options[prod.options.length] = new Option('Quickfinder','Quickfinder');
	prod.options[prod.options.length] = new Option('Online Grading','Online Grading');
	prod.options[prod.options.length] = new Option('Pass Online','Pass Online');
	prod.options[prod.options.length] = new Option('PPC CD','PPC CD');
	prod.options[prod.options.length] = new Option('PPC Print','PPC Print');
	prod.options[prod.options.length] = new Option('Reqwired','Reqwired');
	prod.options[prod.options.length] = new Option('RIA/WG&L CD','RIA/WG&L CD');
	prod.options[prod.options.length] = new Option('RIA/WG&L Print','RIA/WG&L Print');
	prod.options[prod.options.length] = new Option('SMART Practice Aids','SMART Practice Aids');
	prod.options[prod.options.length] = new Option('Other','Other');
}

function AddFilingProducts()
{
	var prod = document.EmailForm.ProductDropDown;
	prod.length=1;

	prod.options[prod.options.length] = new Option('Quickfinder','Quickfinder');
	prod.options[prod.options.length] = new Option('PPC Print','PPC Print');
	prod.options[prod.options.length] = new Option('RIA/WG&L Print','RIA/WG&L Print');
	prod.options[prod.options.length] = new Option('Other','Other');
}

function AddFormProducts()
{
	var prod = document.EmailForm.ProductDropDown;
	prod.length=1;

	prod.options[prod.options.length] = new Option('e-Form','e-Form');
}

function AddPPCMedia()
{
	var media = document.EmailForm.MediaDropDown;
	media.length=1;

	media.options[media.options.length] = new Option('Checkpoint','Checkpoint');
	media.options[media.options.length] = new Option('Checkpoint Tools','Checkpoint Tools');
	media.options[media.options.length] = new Option('CD/DVD','CD/DVD');
	media.options[media.options.length] = new Option('Print','Print');
}

function AddCPEMedia()
{
	var media = document.EmailForm.MediaDropDown;
	media.length=1;

	media.options[media.options.length] = new Option('Checkpoint','Checkpoint');
	media.options[media.options.length] = new Option('CD/DVD','CD/DVD');
	media.options[media.options.length] = new Option('Print','Print');
	media.options[media.options.length] = new Option('Pass Online','Pass Online');
	media.options[media.options.length] = new Option('MicroMash','MicroMash');
	media.options[media.options.length] = new Option('Reqwired','Reqwired');
}

function AddQuickMedia()
{
	var media = document.EmailForm.MediaDropDown;
	media.length=1;

	media.options[media.options.length] = new Option('Web','Web');
	media.options[media.options.length] = new Option('CD/DVD','CD/DVD');
	media.options[media.options.length] = new Option('Print','Print');
}

function AddRIAMedia()
{
	var media = document.EmailForm.MediaDropDown;
	media.length=1;

	media.options[media.options.length] = new Option('eForm RS','eForm RS');
	media.options[media.options.length] = new Option('eForm DVD','eForm DVD');
	media.options[media.options.length] = new Option('Checkpoint','Checkpoint');
	media.options[media.options.length] = new Option('CD/DVD','CD/DVD');
	media.options[media.options.length] = new Option('Print','Print');
}

function changeInquiryDescription(FormType)
{
	document.getElementById("dependent-course-date").style.display = 'none';
	document.getElementById("dependent-course-name").style.display = 'none';
	document.getElementById("dependent-cd-title").style.display = 'none';
	document.getElementById("dependent-dvd-title").style.display = 'none';
	document.getElementById("dependent-invoice-number").style.display = 'none';
	document.getElementById("dependent-learners-name").style.display = 'none';
	document.getElementById("dependent-learners-email").style.display = 'none';
	document.getElementById("dependent-media").style.display = 'none';
	document.getElementById("dependent-media-cd").style.display = 'none';
	document.getElementById("dependent-media-dvd").style.display = 'none';
	document.getElementById("dependent-media-type").style.display = 'none';
	document.getElementById("dependent-practice-area").style.display = 'none';
	document.getElementById("dependent-title").style.display = 'none';
	document.getElementById("dependent-user-name").style.display = 'none';

	switch (document.EmailForm.InquiryDescription.value)
	{
		case "Payment Inquiry":
		case "Billing Inquiry":
		case "Invoice Copy Request":
		case "Order Inquiry":
			AddDefaultProducts()
			document.getElementById("dependent-invoice-number").style.display = 'block';
			break;
		case "Other":
			switch (FormType)
			{
				case "3":
					AddReprintProducts()
					break;
				default:
					AddDefaultProducts()
					break;
			}
			break;
		case "CPE Certificates / Questions":
			document.getElementById("dependent-course-date").style.display = 'block';
			document.getElementById("dependent-course-name").style.display = 'block';
			break;
		case "Change Address / Contact Name":
		case "Credit Card Confirmation":
		case "Product Release Information Request":
		case "Product Return":
		case "Shipping Status":
		case "User ID, PW & Access Codes":
			AddDefaultProducts()
			break;
		case "Document Request":
			AddDocumentProducts()
			break;
		case "Copyright / Permissions / Reprint":
		case "Customer Product Training":
		case "Navigation / Functionality / How to":
		case "Replacements / Claims":
			AddReprintProducts()
			break;
		case "Filing Assistance":
			AddFilingProducts()
			break;
		case "Form Status":
			AddFormProducts()
			break;
		case "Content Verification":
		case "Search Assistance (Where to locate)":
			document.getElementById("dependent-media").style.display = 'block';
			break;
	}

	document.EmailForm.ProductDropDown.selectedIndex = 0;
	document.getElementById("dependent-product").style.display = 'none';
	document.getElementById("dependent-product-line").style.display = 'none';
	document.getElementById("dependent-product-title").style.display = 'none';

	switch (FormType)
	{
		case "1":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "User ID, PW & Access Codes":
					document.getElementById("dependent-product").style.display = 'block';
					break;
				case "W-9 Request":
					break;
				default:
					document.getElementById("dependent-product-line").style.display = 'block';
					break;
			}
			break;
		case "2":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "CPE Certificates / Questions":
					document.getElementById("dependent-product-line").style.display = 'block';
					break;
				default:
					document.getElementById("dependent-product").style.display = 'block';
					break;
			}
			break;
		case "3":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Content Verification":
				case "Search Assistance (Where to locate)":
					document.getElementById("dependent-product-line").style.display = 'block';
					document.getElementById("dependent-product-title").style.display = 'block';
					break;
				default:
					document.getElementById("dependent-product").style.display = 'block';
					break;
					
			}
			break;
		case "4":
			document.getElementById("dependent-product-line").style.display = 'block';
			break;
	}
}

function changeProduct(FormType)
{
	document.getElementById("dependent-product-line").style.display = 'none';
	document.getElementById("dependent-media").style.display = 'none';
	document.getElementById("dependent-user-name").style.display = 'none';
	document.getElementById("dependent-title").style.display = 'none';
	document.getElementById("dependent-cd-title").style.display = 'none';
	document.getElementById("dependent-dvd-title").style.display = 'none';
	document.getElementById("dependent-media-cd").style.display = 'none';
	document.getElementById("dependent-media-dvd").style.display = 'none';
	document.getElementById("dependent-media-type").style.display = 'none';
	document.getElementById("dependent-learners-name").style.display = 'none';
	document.getElementById("dependent-learners-email").style.display = 'none';
	document.getElementById("dependent-course-name").style.display = 'none';
	document.getElementById("dependent-course-date").style.display = 'none';
	document.getElementById("dependent-course-names").style.display = 'none';

	switch (document.EmailForm.ProductDropDown.value)
	{
		case "Checkpoint":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Copyright / Permissions / Reprint":
				case "Customer Product Training":
				case "Document Request":
				case "Replacements / Claims":
					break;
				default:
					document.getElementById("dependent-user-name").style.display = 'block';
					break;
			}
			break;
		case "e-Form":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Copyright / Permissions / Reprint":
				case "Customer Product Training":
				case "Document Request":
				case "Form Status":
				case "Replacements / Claims":
					break;
				default:
					document.getElementById("dependent-media-dvd").style.display = 'block';
					document.getElementById("dependent-media-type").style.display = 'block';
					break;
			}
			break;
		case "Other":
			if (FormType = "2")
			{
				document.getElementById("dependent-product-line").style.display = 'block';
			}
		case "PPC Print":
		case "RIA/WG&L Print":
		case "Checkpoint Tools for PPC":
		case "Checkpoint Tools for WG&L":
		case "Checkpoint Tools for Tax":
		case "Reqwired":
		case "SMART Practice Aids":
		case "Online Grading":
			break;
		case "MicroMash":
		case "MicroMash Plus":
		case "Pass Online":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Copyright / Permissions / Reprint":
					document.getElementById("dependent-course-names").style.display = 'block';
					break;
				case "Customer Product Training":
				case "Navigation / Functionality / How to":
				case "Replacements / Claims":
					break;
				default:
					document.getElementById("dependent-learners-name").style.display = 'block';
					document.getElementById("dependent-learners-email").style.display = 'block';
					document.getElementById("dependent-course-names").style.display = 'block';
					break;
			}
			break;
		case "PPC CD":
		case "RIA/WG&L CD":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Customer Product Training":
				case "Replacements / Claims":
					break;
				default:
					document.getElementById("dependent-cd-title").style.display = 'block';
					break;
			}
			break;
		case "Quickfinder":
			switch (document.EmailForm.InquiryDescription.value)
			{
				case "Copyright / Permissions / Reprint":
				case "Customer Product Training":
				case "Filing Assistance":
				case "Replacements / Claims":
					break;
				default:
					document.getElementById("dependent-cd-title").style.display = 'block';
					document.getElementById("dependent-media-cd").style.display = 'block';
					document.getElementById("dependent-media-type").style.display = 'block';
					break;
			}
			break;
	}
}

function clickProductLine(value)
{
	document.EmailForm.ProductLineTextBox.value = value;
	document.getElementById("dependent-media").style.display = 'none';

	switch (document.EmailForm.FormType.value)
	{
		case "3":
			document.getElementById("dependent-user-name").style.display = 'none';
			document.getElementById("dependent-title").style.display = 'none';
			document.getElementById("dependent-cd-title").style.display = 'none';
			document.getElementById("dependent-course-names").style.display = 'none';
			document.getElementById("dependent-media").style.display = 'block';
			switch (value)
			{
				case "PPC":
					AddPPCMedia()
					break;
				case "CPE":
					AddCPEMedia()
					break;
				case "Quickfinder":
					AddQuickMedia()
					break;
				case "RIA/WG&L":
					AddRIAMedia()
					break;
			}
	}
}

function changeMedia(value)
{
	document.getElementById("dependent-practice-area").style.display = 'none';
	document.getElementById("dependent-user-name").style.display = 'none';
	document.getElementById("dependent-title").style.display = 'none';
	document.getElementById("dependent-cd-title").style.display = 'none';
	document.getElementById("dependent-course-name").style.display = 'none';
	
	switch (document.EmailForm.ProductLineTextBox.value)
	{
		case "PPC":
			switch (value)
			{
				case "Checkpoint":
				case "Checkpoint Tools":
					document.getElementById("dependent-user-name").style.display = 'block';
					break;
				case "CD/DVD":
					document.getElementById("dependent-cd-title").style.display = 'block';
					break;
				case "Print":
					document.getElementById("dependent-title").style.display = 'block';
					break;
			}
			break;
		case "CPE":
			document.getElementById("dependent-course-name").style.display = 'block';
			break;
		case "Quickfinder":
			document.getElementById("dependent-cd-title").style.display = 'block';
			break;
		case "RIA/WG&L":
			switch (value)
			{
				case "Checkpoint":
				case "CD/DVD":
				case "Print":
					document.getElementById("dependent-practice-area").style.display = 'block';
					break;
			}
			break;
	}
}

function SubmitForm()
{
	strFormType = document.EmailForm.FormType.value;
	strInquiryType = document.EmailForm.InquiryDescription.value;

	strErr = ""; //clear error label
	flag = true; //unset flag

	resetStyles();
	
	validateForm();
	
	if (flag)
	{
		document.EmailForm.action="SendEmail.asp";
		document.EmailForm.submit();
	}
	else
	{
		alert(strErr);
	}
}

function validateForm()
{

	// Required by all
	validRequired("AccountNumber");
	validRequired("AllThree");
	validRequired("CompanyName");
	validRequired("EmailAddress");
	validRequired("FirstName");
	validRequired("LastName");
	validRequired("PhoneNumber");
	validRequired("ZipCode");
	validRequired("DescriptionOfRequest");

	// Required by some
	if (document.getElementById("dependent-inquiry-description").style.display == "block")
		validRequired("InquiryDescription");
	if (document.getElementById("dependent-cd-title").style.display == "block")
		validRequired("CDTitle");
	if (document.getElementById("dependent-course-date").style.display == "block")
		validRequired("CourseDate");
	if (document.getElementById("dependent-course-name").style.display == "block")
		validRequired("CourseName");
	if (document.getElementById("dependent-course-names").style.display == "block")
		validRequired("CourseNames");
	if (document.getElementById("dependent-title").style.display == "block")
		validRequired("Title");
	if (document.getElementById("dependent-cd-title").style.display == "block")
		validRequired("CDTitle");
	if (document.getElementById("dependent-dvd-title").style.display == "block")
		validRequired("DVDTitle");
	if (document.getElementById("dependent-product-line").style.display == "block")
		validRequired("ProductLine");
	if (document.getElementById("dependent-inquiry-other").style.display == "block")
		resetStyle("InquiryOther");
	if (document.getElementById("dependent-product").style.display == "block")
		validRequired("Product");
	if (document.getElementById("dependent-media").style.display == "block")
		validRequired("Media");
	if (document.getElementById("dependent-media-type").style.display == "block")
		validRequired("MediaType");
	if (document.getElementById("dependent-practice-area").style.display == "block")
		validRequired("PracticeArea");
	if (document.getElementById("dependent-invoice-number").style.display == "block")
		validRequired("InvoiceNumber");
	if (document.getElementById("dependent-user-name").style.display == "block")
		validRequired("UserName");
	if (document.getElementById("dependent-learners-name").style.display == "block")
		validRequired("LearnersName");
	if (document.getElementById("dependent-learners-email").style.display == "block")
		validRequired("LearnersEmail");
	if (document.getElementById("dependent-feedback-type").style.display == "block")
		validRequired("FeedbackType");
	if (document.getElementById("dependent-topic").style.display == "block")
		validRequired("Topic");
	if (document.getElementById("dependent-product-title").style.display == "block")
		validRequired("ProductTitles");

	if(!flag){strErr = strErr + "Please complete all required fields (shown in bold red)";}
}

function validRequired(fldName)
{
	// First Name Validation
	if((fldName=="FirstName") && (document.EmailForm.FirstNameTextBox.value==""))
		requireField(fldName);

	// Last Name Validation
	if((fldName=="LastName") && (document.EmailForm.LastNameTextBox.value==""))
		requireField(fldName);

	// Email Validation
	if((fldName=="EmailAddress") && (document.EmailForm.EmailAddressTextBox.value==""))
		requireField(fldName);
	if((fldName=="EmailAddress") && (document.EmailForm.EmailAddressTextBox.value!=""))
	{
		var eMailRegEx = new RegExp("^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");
		if (!eMailRegEx.test(document.EmailForm.EmailAddressTextBox.value))
		{ 
			requireField(fldName);
			alert('Please enter a valid email address.')
		}
	}

	// Phone Validation
	if(fldName=="PhoneNumber"){
		if (document.EmailForm.PhoneNumberTextBox.value=="")
			requireField(fldName);
		else
		{
			if (document.EmailForm.PhoneNumberTextBox.value!="")
			{
				if (document.EmailForm.PhoneNumberTextBox.value.length < 10) 
				{ 
					requireField(fldName);
					alert('Phone numbers should include at least 10 digits.')
				}
				else
				{	
					x=0
					for (j=0; j<document.EmailForm.PhoneNumberTextBox.value.length; j++) 
					{
						x=x+1 
						if ((document.EmailForm.PhoneNumberTextBox.value.charAt(j) < "0") || (document.EmailForm.PhoneNumberTextBox.value.charAt(j) > "9")) 
						{ 
							x=x-1
						}
					}
					if (x<10)
					{
						requireField(fldName);
						alert('Phone numbers should include at least 10 digits.')
					}
			 	}
			}
		}
	}

	// All Three Validation
	if(fldName=="AllThree")
	{
		if((document.EmailForm.AccountNumberTextBox.value=="") && (document.EmailForm.CompanyNameTextBox.value=="") && (document.EmailForm.ZipCodeTextBox.value==""))
		{
			alert('Input is required in either Account Number or Company Name and Zip Code fields.  Please complete and resubmit.');
			flag = false
		}
		if((document.EmailForm.AccountNumberTextBox.value=="") && (document.EmailForm.CompanyNameTextBox.value!="") && (document.EmailForm.ZipCodeTextBox.value==""))
		{
			alert('Input is required in either Account Number or Company Name and Zip Code fields.  Please complete and resubmit.');
			flag = false
		}
		if((document.EmailForm.AccountNumberTextBox.value=="") && (document.EmailForm.CompanyNameTextBox.value=="") && (document.EmailForm.ZipCodeTextBox.value!=""))
		{
			alert('Input is required in either Account Number or Company Name and Zip Code fields.  Please complete and resubmit.');
			flag = false
		}
	}

	// Account Number Validation
	if((fldName=="AccountNumber") && (document.EmailForm.AccountNumberTextBox.value!=""))
	{
		var acctNumRegEx = new RegExp("^[0-9]{8,9}$");
		if (!acctNumRegEx.test(document.EmailForm.AccountNumberTextBox.value))
		{ 
			requireField(fldName);
			alert('Account numbers must contain 8 or 9 numeric characters (including possible "leading" zeros, i.e. 00254688).  Please review your account number for accuracy and resubmit.')
		}
	}

	// Company Name Validation
	if((fldName=="CompanyName") && (document.EmailForm.AccountNumberTextBox.value=="") && (document.EmailForm.ZipCodeTextBox.value!=""))
		if (document.EmailForm.CompanyNameTextBox.value=="")
			requireField(fldName);

	// Zip Code Validation
	if((fldName=="ZipCode") && (document.EmailForm.AccountNumberTextBox.value=="") && (document.EmailForm.CompanyNameTextBox.value!=""))
		if (document.EmailForm.ZipCodeTextBox.value=="")
			requireField(fldName);
	if((fldName=="ZipCode") && (document.EmailForm.ZipCodeTextBox.value!=""))
	{
		var zipCodeRegEx = new RegExp("^[0-9]{5,5}$");
		if (!zipCodeRegEx.test(document.EmailForm.ZipCodeTextBox.value))
		{ 
			requireField(fldName);
			alert('This field requires a 5 digit number.  Please review your zip code for accuracy and resubmit.')
		}
	}

	// Inquiry Other Validation
	if((fldName=="InquiryOther") && (document.EmailForm.InquiryOtherTextBox.value==""))
		requireField(fldName);
	
	// Inquiry Description Validation
	if ((fldName=="InquiryDescription") && (document.EmailForm.InquiryDescriptionDropDown.selectedIndex==0))
		requireField(fldName);

	// Product Line Validation
	if(fldName=="ProductLine")
	{
		selectedButton = -1;
		for (i=document.EmailForm.ProductLineRadio.length-1; i > -1; i--)
		{
			if (document.EmailForm.ProductLineRadio[i].checked)
			{
				selectedButton = i; i = -1;
			}
		}
		if (selectedButton == -1)
			requireField(fldName);
	}

	// Product Validation
	if ((fldName=="Product") && (document.EmailForm.ProductDropDown.selectedIndex==0))
	{
		requireField(fldName);
	}

	// Course Name Validation
	if((fldName=="CourseName") && (document.EmailForm.CourseNameTextBox.value==""))
	{
		requireField(fldName);
	}

	// Course Date Validation
	if((fldName=="CourseDate") && (document.EmailForm.CourseDateTextBox.value==""))
	{
		requireField(fldName);
	}

	// Invoice Number Validation
	if((fldName=="InvoiceNumber") && (document.EmailForm.InvoiceNumberTextBox.value==""))
	{
		requireField(fldName);
	}
	if((fldName=="InvoiceNumber") && (document.EmailForm.InvoiceNumberTextBox.value!=""))
	{
		var invNumRegEx = new RegExp("^([0-9]{6}|[0-9]{7}|[0-9]{10})$");
		if (!invNumRegEx.test(document.EmailForm.InvoiceNumberTextBox.value))
		{ 
			requireField(fldName);
			alert('Please review your invoice number for accuracy and resubmit. RIA invoice/order numbers should be 10 digits and PPC invoice/order numbers should be 6 digits. Please include any "leading" zeros, i.e. 00254688')
		}
	}
	
	// Learner's Name Validation
	if((fldName=="LearnersName") && (document.EmailForm.LearnersNameTextBox.value==""))
	{
		requireField(fldName);
	}

	// Learner's Email Validation
	if((fldName=="LearnersEmail") && (document.EmailForm.LearnersEmailTextBox.value==""))
	{
		requireField(fldName);
	}
	if((fldName=="LearnersEmail") && (document.EmailForm.LearnersEmailTextBox.value!=""))
	{
		var learnersEmailRegEx = new RegExp("^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$");
		if (!learnersEmailRegEx.test(document.EmailForm.LearnersEmailTextBox.value))
		{ 
			requireField(fldName);
			alert('Please enter a valid email address.')
		}
	}

	// Course Names Validation
	if((fldName=="CourseNames") && (document.EmailForm.CourseName1TextBox.value=="") && (document.EmailForm.CourseName2TextBox.value=="") && (document.EmailForm.CourseName3TextBox.value==""))
	{
		requireField(fldName);
	}

	// User Name Validation
	if((fldName=="UserName") && (document.EmailForm.UserNameTextBox.value==""))
	{
		requireField(fldName);
	}

	// Title Validation
	if((fldName=="Title") && (document.EmailForm.TitleTextBox.value==""))
	{
		requireField(fldName);
	}
	
	// CD Title Validation
	if((fldName=="CDTitle") && (document.EmailForm.CDTitleTextBox.value==""))
	{
		requireField(fldName);
	}
	
	// DVD Title Validation
	if((fldName=="DVDTitle") && (document.EmailForm.DVDTitleTextBox.value==""))
	{
		requireField(fldName);
	}

	// Media Type Validation
	if(fldName=="MediaType")
	{
		selectedButton = -1;
		for (i=document.EmailForm.MediaTypeRadio.length-1; i > -1; i--)
		{
			if (document.EmailForm.MediaTypeRadio[i].checked)
			{
				selectedButton = i; i = -1;
			}
		}
		if (selectedButton == -1)
			requireField(fldName);
	}

	// Feedback Type Validation
	if ((fldName=="FeedbackType") && (document.EmailForm.FeedbackTypeDropDown.selectedIndex==0))
		requireField(fldName);

	// Topic Validation
	if((fldName=="Topic") && (document.EmailForm.TopicTextBox.value==""))
		requireField(fldName);

	// Media Validation
	if ((fldName=="Media") && (document.EmailForm.MediaDropDown.selectedIndex==0))
		requireField(fldName);

	// Practice Area Validation
	if ((fldName=="PracticeArea") && (document.EmailForm.PracticeAreaDropDown.selectedIndex==0))
		requireField(fldName);

	// Product Title Validation
	if((fldName=="ProductTitles") && (document.EmailForm.ProductTitlesTextBox.value==""))
		requireField(fldName);

	// Requests/Comments Validation
	if((fldName=="DescriptionOfRequest") && (document.EmailForm.DescrptionOfRequestTextArea.value==""))
		requireField(fldName);

	// Attachment Validation
	if((fldName=="Attachment") && (document.EmailForm.FilAttach.value!=""))
	{
		var ext = document.EmailForm.FilAttach.value;
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();
		if ((ext == 'exe')||(ext=='.js')||(ext=='.vb')||(ext=='asp')||(ext=='dll')||(ext=='scr')||(ext=='bat')||(ext=='reg')||(ext=='cab')||(ext=='mp3'))
		{
			alert('You selected a .'+ext+
			' file; Please select a text-based file.');
			flag = false;;
		}
	}
}
