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;
	//alert(fldName);
	document.getElementById(fldName).style.color="black";
	document.getElementById(fldName).style.fontWeight="normal";
}

function requireField(fldName)
{
	document.getElementById('lbl' + fldName).style.color="red";
	document.getElementById('lbl' + fldName).style.fontWeight="bold";
	flag = false;
}

function displayAttachmentInput()
{
	document.getElementById("dependent-upload-link").style.display = 'none';
	document.getElementById("dependent-upload").style.display = 'block';
}

function showInquiry()
{
	var selbox = document.EmailForm.inquirytype;
	selbox.length=1;

	// Thomson CompuMark Customer
	if (document.EmailForm.ClientRadio[0].checked)
	{
		selbox.options[selbox.options.length] = new Option('Products / Pricing / General Inquiry','1');
		selbox.options[selbox.options.length] = new Option('Online Services and Support','2');
		selbox.options[selbox.options.length] = new Option('Billing and Account Information','3');
		selbox.options[selbox.options.length] = new Option('Feedback and Concerns','4');
	}
	// Not Thomson CompuMark Customer
	else
	{
		selbox.length=1;
		selbox.options[selbox.options.length] = new Option('Products / Pricing / General Inquiry','1');
	}
	showDiv('0');
	document.getElementById("dependent-inquiry").style.display = 'block';
}

function showDiv(optionValue)
{
	//Reset Styles
	resetStyle("CompanyName");
	resetStyle("FirstName");
	resetStyle("LastName");
	resetStyle("EmailAddress");
	resetStyle("PhoneNumber");
	resetStyle("City");
	resetStyle("State");
	resetStyle("PostalCode");
	resetStyle("DescriptionOfRequest");
	resetStyle("LocationRadio");
	//resetStyle("ProductType");
	//resetStyle("WatchingServices");
	//resetStyle("Trademark");
	//resetStyle("Copyright");
	//resetStyle("SaegisOnline");
	resetStyle("OnlineServices");
	resetStyle("BillingInfo");
	resetStyle("FeedbackConcern");
	resetStyle("FeedbackRadio");
	resetStyle("FeedbackProduct");
	//resetStyle("IdType");
	//resetStyle("ClientId");
	//resetStyle("FirmId");
	//resetStyle("InvoiceNumber");
	//resetStyle("SerionUser");
	//resetStyle("OurFile");
	//resetStyle("MarkSearch");
	//resetStyle("EmailId");
	//resetStyle("Existing");

	// first hide all dependent divs
	document.getElementById("dependent-inquiry-attachfile").style.display = 'none';
	document.getElementById("Inquiry-Details-Fieldset").style.display = 'none';
	document.getElementById("dependent-inquiry").style.display = 'none';
	document.getElementById("dependent-inquiry-producttype").style.display = 'none';
	document.getElementById("dependent-inquiry-watchingservice").style.display = 'none';
	document.getElementById("dependent-inquiry-trademark").style.display = 'none';
	document.getElementById("dependent-inquiry-copyright").style.display = 'none';
	document.getElementById("dependent-inquiry-saegisonline").style.display = 'none';
	document.getElementById("dependent-inquiry-onlineservices").style.display = 'none';
	document.getElementById("dependent-inquiry-billinginfo").style.display = 'none';
	document.getElementById("dependent-inquiry-feedbackconcern").style.display = 'none';
	document.getElementById("dependent-inquiry-feedbackoverall").style.display = 'none';
	document.getElementById("dependent-inquiry-feedbackproduct").style.display = 'none';
	document.getElementById("dependent-inquiry-clientid").style.display = 'none';
	document.getElementById("dependent-inquiry-firmid").style.display = 'none';
	document.getElementById("dependent-inquiry-invoicenumber").style.display = 'none';
	document.getElementById("dependent-inquiry-serionuser").style.display = 'none';
	document.getElementById("dependent-inquiry-emailid").style.display = 'none';
	document.getElementById("dependent-inquiry-marksearch").style.display = 'none';
	document.getElementById("dependent-inquiry-ourfile").style.display = 'none';
	document.getElementById("dependent-inquiry-existing").style.display = 'none';
	document.getElementById("Contact-Method-Fieldset").style.display = 'none';
	document.getElementById("Submit-Buttons").style.display = 'none';
	
	var inqIdType = document.EmailForm.IdTypeDropDown;
	var inqProductType = document.EmailForm.ProductTypeDropDown;
	switch (optionValue)
	{
		case "0":
			if(document.EmailForm.ClientRadio[0].checked){
				document.getElementById("dependent-inquiry").style.display = 'block';
			}else if(document.EmailForm.ClientRadio[1].checked){
				document.getElementById("dependent-inquiry").style.display = 'block';
			}
			break
		//Products/pricing/general inquiry
		case "1":
			inqIdType.length=1;
			inqIdType.options[inqIdType.options.length] = new Option();
			document.getElementById("dependent-inquiry").style.display = 'block';
			document.getElementById("dependent-inquiry-producttype").style.display = 'block';
			inqProductType.selectedIndex = 0;
			window.document.EmailForm.FormType.value="3";
			if(document.EmailForm.ClientRadio[0].checked){
				document.getElementById("dependent-inquiry-idtype").style.display = 'block';
				document.getElementById("dependent-inquiry-attachfile").style.display = 'block';
			}else{
				document.getElementById("dependent-inquiry-idtype").style.display = 'none';
				document.getElementById("dependent-inquiry-attachfile").style.display = 'none';
			}
			window.document.EmailForm.NumDayReply.value = "1 business day";
			break

		//Online services and support
		case "2":
			inqIdType.length=1;
			inqIdType.options[inqIdType.options.length] = new Option();
			document.getElementById("dependent-inquiry").style.display = 'block';
			document.getElementById("dependent-inquiry-attachfile").style.display = 'block';
			document.getElementById("dependent-inquiry-onlineservices").style.display = 'block';
			window.document.EmailForm.NumDayReply.value = "1 business day";
			break

		//billing and account information
		case "3":
			inqIdType.length=1;
			inqIdType.options[inqIdType.options.length] = new Option();
			document.getElementById("dependent-inquiry").style.display = 'block';
			document.getElementById("dependent-inquiry-attachfile").style.display = 'block';
			document.getElementById("dependent-inquiry-billinginfo").style.display = 'block';
			window.document.EmailForm.NumDayReply.value = "1 business day";
			break

		//feedback and concerns
		case "4":
			inqIdType.length=1;
			inqIdType.options[inqIdType.options.length] = new Option();
			document.getElementById("dependent-inquiry").style.display = 'block';
			document.getElementById("dependent-inquiry-attachfile").style.display = 'block';
			document.getElementById("dependent-inquiry-feedbackconcern").style.display = 'block';
			document.getElementById("dependent-inquiry-feedbackoverall").style.display = 'block';
			window.document.EmailForm.NumDayReply.value = "1 business day";
			break

	} //switch

	if (optionValue != 0)
	{
		document.getElementById("Inquiry-Details-Fieldset").style.display = 'block';
		document.getElementById("Contact-Method-Fieldset").style.display = 'block';
		document.getElementById("Submit-Buttons").style.display = 'block';
	}

} //showDiv

function checkProductType(optionValue){
	var inqIdType = document.EmailForm.IdTypeDropDown;
	var inqWatchServ = document.EmailForm.WatchingServicesListBox;
	var inqTrademark = document.EmailForm.TrademarkListBox;
	document.getElementById("dependent-inquiry-watchingservice").style.display = 'none';
	document.getElementById("dependent-inquiry-trademark").style.display = 'none';
	document.getElementById("dependent-inquiry-copyright").style.display = 'none';
	document.getElementById("dependent-inquiry-saegisonline").style.display = 'none';
	window.document.EmailForm.FormType.value="3";
	if(optionValue == "Watching Services"){
			document.getElementById("dependent-inquiry-watchingservice").style.display = 'block';
			window.document.EmailForm.FormType.value="1";
			//window.document.EmailForm.FormType.value="7";
			if(document.EmailForm.ClientRadio[0].checked){
				//window.document.EmailForm.FormType.value="1";
				inqIdType.length=1;
				inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
				inqIdType.options[inqIdType.options.length] = new Option('Existing Watch Reference','Existing Watch Reference');
				inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
				inqWatchServ.length = 1;
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Pending Applications','USPTO Pending Applications');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Official Gazette','USPTO Official Gazette');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('International - Worldwide','International - Worldwide');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('International - Others','International - Others');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Request Translation of Watch Notice(s)','Request Translation of Watch Notice(s)');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('US Comprehensive Package','US Comprehensive Package');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Status Monitor','USPTO Status Monitor');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Web Monitoring','Web Monitoring');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('SAEGIS; Watch','SAEGIS Watch');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Internet Domain Names','Internet Domain Names');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('State Trademark Registers','State Trademark Registers');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Common Law','Common Law');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Watching E-Services','Watching E-Services');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
			}else{
				inqWatchServ.length = 1;
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Pending Applications','USPTO Pending Applications');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Official Gazette','USPTO Official Gazette');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('International - Worldwide','International - Worldwide');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('International - Others','International - Others');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('US Comprehensive Package','US Comprehensive Package');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('USPTO Status Monitor','USPTO Status Monitor');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Web Monitoring','Web Monitoring');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('SAEGIS Watch','SAEGIS Watch');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Internet Domain Names','Internet Domain Names');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('State Trademark Registers','State Trademark Registers');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Common Law','Common Law');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Watching E-Services','Watching E-Services');
				inqWatchServ.options[inqWatchServ.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
			}
	}else if(optionValue == "Trademark Availability and Screening Searches"){
		document.getElementById("dependent-inquiry-trademark").style.display = 'block';
		if(document.EmailForm.ClientRadio[0].checked){
			inqTrademark.length = 1;
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Full Availability (Text)','United States Full Availability (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Availability (Design)','United States Availability (Design)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Canadian Full Availability (Text)','Canadian Full Availability (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Canadian Availability (Design)','Canadian Availability (Design)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Worldwide Identical Screening Search (WISS)','Worldwide Identical Screening Search (WISS)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Identical Screening by Region / Country (RISS/KISS)','Identical Screening by Region / Country (RISS/KISS)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Request Publication Copies [from WISS/RISS/KISS]','Request Publication Copies [from WISS/RISS/KISS]');
			inqTrademark.options[inqTrademark.options.length] = new Option('Multi-Country Screening Search','Multi-Country Screening Search');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Screening (Text)','United States Screening (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('SAEGIS Online Screening Tool','SAEGIS Online Screening Tool');
			inqTrademark.options[inqTrademark.options.length] = new Option('International Availability by Country / Region','International Availability by Country / Region');
			inqTrademark.options[inqTrademark.options.length] = new Option('International Company Names','International Company Names');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Company Names','United States Company Names');
			inqTrademark.options[inqTrademark.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
		}else{
			inqTrademark.length = 1;
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Full Availability (Text)','United States Full Availability (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Availability (Design)','United States Availability (Design)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Canadian Full Availability (Text)','Canadian Full Availability (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Canadian Availability (Design)','Canadian Availability (Design)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Worldwide Identical Screening Search (WISS)','Worldwide Identical Screening Search (WISS)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Identical Screening by Region / Country (RISS/KISS)','Identical Screening by Region / Country (RISS/KISS)');
			inqTrademark.options[inqTrademark.options.length] = new Option('Multi-Country Screening Search','Multi-Country Screening Search');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Screening (Text)','United States Screening (Text)');
			inqTrademark.options[inqTrademark.options.length] = new Option('SAEGIS Online Screening Tool','SAEGIS Online Screening Tool');
			inqTrademark.options[inqTrademark.options.length] = new Option('International Availability by Country / Region','International Availability by Country / Region');
			inqTrademark.options[inqTrademark.options.length] = new Option('International Company Names','International Company Names');
			inqTrademark.options[inqTrademark.options.length] = new Option('United States Company Names','United States Company Names');
			inqTrademark.options[inqTrademark.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
		}
	}else if(optionValue == "Copyright, Title and Washington Services"){
		document.getElementById("dependent-inquiry-copyright").style.display = 'block';
		//window.document.EmailForm.FormType.value="5";
		window.document.EmailForm.FormType.value="3";
		if(document.EmailForm.ClientRadio[0].checked){
			inqIdType.length=1;
			inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
			inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
			inqIdType.options[inqIdType.options.length] = new Option('E-Mail Address','E-Mail Address');
		}
	}else if(optionValue == "SAEGIS Online Screening"){
		document.getElementById("dependent-inquiry-saegisonline").style.display = 'block';
		window.document.EmailForm.FormType.value="4";
			if(document.EmailForm.ClientRadio[0].checked){
				inqIdType.length=1;
				inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
				inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
			}
	}else if(optionValue == "General Inquiry"){
		window.document.EmailForm.FormType.value="3";
			if(document.EmailForm.ClientRadio[0].checked){
				inqIdType.length=1;
				inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
				inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
				inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
			}
	}
}

function checkIdType(optionValue){
	var emailValue;
	document.getElementById("dependent-inquiry-clientid").style.display = 'none';
	document.getElementById("dependent-inquiry-existing").style.display = 'none';
	document.getElementById("dependent-inquiry-firmid").style.display = 'none';
	document.getElementById("dependent-inquiry-invoicenumber").style.display = 'none';
	document.getElementById("dependent-inquiry-serionuser").style.display = 'none';
	document.getElementById("dependent-inquiry-emailid").style.display = 'none';
	document.getElementById("dependent-inquiry-marksearch").style.display = 'none';
	document.getElementById("dependent-inquiry-ourfile").style.display = 'none';

	if(optionValue == "Client ID Number"){
		document.getElementById("dependent-inquiry-clientid").style.display = 'block';
	}else if(optionValue == "Firm ID Number"){
		document.getElementById("dependent-inquiry-firmid").style.display = 'block';
	}else if(optionValue == "Invoice Number"){
		document.getElementById("dependent-inquiry-invoicenumber").style.display = 'block';
	}else if(optionValue == "E-Mail Address"){
		emailValue = window.document.EmailForm.EmailAddressTextBox.value;
		document.getElementById("dependent-inquiry-emailid").style.display = 'block';
		window.document.EmailForm.EmailIdTextBox.value = emailValue;
	}else if(optionValue == "Existing Watch Reference"){
		document.getElementById("dependent-inquiry-existing").style.display = 'block';
	}else if(optionValue == "SERION User Name"){
		document.getElementById("dependent-inquiry-serionuser").style.display = 'block';
	}else if(optionValue == "Mark Searched"){
		document.getElementById("dependent-inquiry-marksearch").style.display = 'block';
	}else if(optionValue == "Our File or Search Number"){
		document.getElementById("dependent-inquiry-ourfile").style.display = 'block';
	}
}

function checkWatchServ(optionValue){
	if(optionValue == "Request Translation of Watch Notice(s)"){
		window.document.EmailForm.NumDayReply.value = "2 to 3 business days";
	}else{
		window.document.EmailForm.NumDayReply.value = "1 business day";
	}
}

function checkTrademark(optionValue)
{
	var inqIdType = document.EmailForm.IdTypeDropDown;
	if(optionValue == "Request Publication Copies [from WISS/RISS/KISS]"){
		window.document.EmailForm.NumDayReply.value = "2 to 3 business days";
	}else{
		window.document.EmailForm.NumDayReply.value = "1 business day";
	}
	inqIdType.length=1;
	if(optionValue == "SAEGIS Online Screening Tool"){
		window.document.EmailForm.FormType.value="4";
	}else{
		window.document.EmailForm.FormType.value="3";
	}
	if(document.EmailForm.ClientRadio[0].checked){
		if(optionValue == "SAEGIS Online Screening Tool"){
			inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
			inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
			inqIdType.options[inqIdType.options.length] = new Option('E-Mail Address','E-Mail Address');
			inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
		}else{
			inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
			inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
			inqIdType.options[inqIdType.options.length] = new Option('E-Mail Address','E-Mail Address');
			document.getElementById("dependent-inquiry-serionuser").style.display = 'none';
		}
	}
}

function checkOnlineServices(optionValue)
{
	var inqIdType = document.EmailForm.IdTypeDropDown;
	inqIdType.length=1;
	
	if(optionValue == "Request Results in PDF by E-Mail"){
		window.document.EmailForm.FormType.value="8";
	}else{
		window.document.EmailForm.FormType.value="4";
	}
	
	if(optionValue == "SERION Login Information Reminder / Reset"){
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
	}else if(optionValue == "Delivery of Results to Inbox" || optionValue == "Request Results in PDF by E-Mail"){
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
		inqIdType.options[inqIdType.options.length] = new Option('Mark Searched','Mark Searched');
		inqIdType.options[inqIdType.options.length] = new Option('Our Search / File Number','Our File or Search Number');
	}else{
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
	}
	checkIdType();
}

function checkBillingInfo(optionValue)
{
	var inqIdType = document.EmailForm.IdTypeDropDown;
	inqIdType.length=1;
	if(optionValue == "Status of Invoice"){
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
	}else if(optionValue == "Request Statement of Account"){
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
	}else if(optionValue == "Request Copy of Watching Service Invoice" || optionValue == "Request Copy of Search Invoice"){
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
		inqIdType.options[inqIdType.options.length] = new Option('Mark Searched / Watched','Mark Searched');
		inqIdType.options[inqIdType.options.length] = new Option('Our File or Search Number','Our File or Search Number');
	}else{
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
	}
	
	if(optionValue == "Status of Invoice" || optionValue == "Request Statement of Account"){
		window.document.EmailForm.FormType.value="6";
	}else if(optionValue == "Request Copy of Watching Service Invoice"){
		window.document.EmailForm.FormType.value="1";
	}else if(optionValue == "Request Copy of SAEGIS Invoice"){
		window.document.EmailForm.FormType.value="4";
	}else{
		window.document.EmailForm.FormType.value="3";
	}
}

function checkFeedback(optionValue){
	document.getElementById("dependent-inquiry-clientid").style.display = 'none';
	document.getElementById("dependent-inquiry-existing").style.display = 'none';
	document.getElementById("dependent-inquiry-firmid").style.display = 'none';
	document.getElementById("dependent-inquiry-invoicenumber").style.display = 'none';
	document.getElementById("dependent-inquiry-serionuser").style.display = 'none';
	document.getElementById("dependent-inquiry-emailid").style.display = 'none';
	document.getElementById("dependent-inquiry-marksearch").style.display = 'none';
	document.getElementById("dependent-inquiry-ourfile").style.display = 'none';
	
	var inqIdType = document.EmailForm.IdTypeDropDown;
	inqIdType.length=1;
	var inqFeedback = document.EmailForm.FeedbackProductDropDown;
	inqFeedback.length=1;
	document.getElementById("dependent-inquiry-idtype").style.display = 'block';
	
	if(optionValue == "Online Ordering" || optionValue == "SERION Inbox or Analysis Tool" || optionValue == "SAEGIS Screening"){
		window.document.EmailForm.FormType.value="4";
	}else if(optionValue == "Watching Services"){
		window.document.EmailForm.FormType.value="1";
	}else if(optionValue == "Billing / Finance"){
		window.document.EmailForm.FormType.value="9";
	}else{
		window.document.EmailForm.FormType.value="3";
	}
	
	if(optionValue == "Online Ordering" || optionValue == "SERION Inbox or Analysis Tool" || optionValue == "SAEGIS Screening"){
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
	}else if(optionValue == "Search Products - Sources" || optionValue == "Search Products - Quality" || optionValue == "Search Products - Other"){
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
		inqIdType.options[inqIdType.options.length] = new Option('Mark Searched / Watched','Mark Searched');
		inqIdType.options[inqIdType.options.length] = new Option('Our File or Search Number','Our File or Search Number');
	}else{
		inqIdType.options[inqIdType.options.length] = new Option('Client ID Number','Client ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Firm ID Number','Firm ID Number');
		inqIdType.options[inqIdType.options.length] = new Option('Invoice Number','Invoice Number');
		inqIdType.options[inqIdType.options.length] = new Option('SERION User Name','SERION User Name');
	}
	
	if(optionValue == "SERION Inbox or Analysis Tool" || optionValue == "SAEGIS Screening" || optionValue == "Billing / Finance"){
		document.getElementById("dependent-inquiry-feedbackproduct").style.display = 'none';
	}else if(optionValue == "Watching Services"){
		document.getElementById("dependent-inquiry-feedbackproduct").style.display = 'block';
		inqFeedback.options[inqFeedback.options.length] = new Option('USPTO Pending Applications','USPTO Pending Applications');
		inqFeedback.options[inqFeedback.options.length] = new Option('USPTO Official Gazette','USPTO Official Gazette');
		inqFeedback.options[inqFeedback.options.length] = new Option('International - Worldwide','International - Worldwide');
		inqFeedback.options[inqFeedback.options.length] = new Option('International - Others','International - Others');
		inqFeedback.options[inqFeedback.options.length] = new Option('US Comprehensive Package','US Comprehensive Package');
		inqFeedback.options[inqFeedback.options.length] = new Option('USPTO Status Monitor','USPTO Status Monitor');
		inqFeedback.options[inqFeedback.options.length] = new Option('Web Monitoring','Web Monitoring');
		inqFeedback.options[inqFeedback.options.length] = new Option('SAEGIS Watch','SAEGIS Watch');
		inqFeedback.options[inqFeedback.options.length] = new Option('Internet Domain Names','Internet Domain Names');
		inqFeedback.options[inqFeedback.options.length] = new Option('State Trademark Registers','State Trademark Registers');
		inqFeedback.options[inqFeedback.options.length] = new Option('Common Law','Common Law');
		inqFeedback.options[inqFeedback.options.length] = new Option('Watching E-Services','Watching E-Services');
		inqFeedback.options[inqFeedback.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
	}else{
		document.getElementById("dependent-inquiry-feedbackproduct").style.display = 'block';
		inqFeedback.options[inqFeedback.options.length] = new Option('Watching Services','Watching Services');
		inqFeedback.options[inqFeedback.options.length] = new Option('United States Full Availability (Text)','United States Full Availability (Text)');
		inqFeedback.options[inqFeedback.options.length] = new Option('United States Availability (Design)','United States Availability (Design)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Canadian Full Availability (Text)','Canadian Full Availability (Text)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Canadian Availability (Design)','Canadian Availability (Design)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Worldwide Identical Screening Search (WISS)','Worldwide Identical Screening Search (WISS)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Identical Screening by Region / Country (RISS/KISS)','Identical Screening by Region / Country (RISS/KISS)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Multi-Country Screening Search','Multi-Country Screening Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('United States Screening (Text)','United States Screening (Text)');
		inqFeedback.options[inqFeedback.options.length] = new Option('SAEGIS Online Screening Tool','SAEGIS Online Screening Tool');
		inqFeedback.options[inqFeedback.options.length] = new Option('International Availability by Country / Region','International Availability by Country / Region');
		inqFeedback.options[inqFeedback.options.length] = new Option('International Company Names','International Company Names');
		inqFeedback.options[inqFeedback.options.length] = new Option('United States Company Names','United States Company Names');
		inqFeedback.options[inqFeedback.options.length] = new Option('US Full Copyright Search','US Full Copyright Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('US Copyright Screening Search','US Copyright Screening Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('US Title Availability Search','US Title Availability Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('International Title Availability','International Title Availability');
		inqFeedback.options[inqFeedback.options.length] = new Option('Document Retrieval - Certified','Document Retrieval - Certified');
		inqFeedback.options[inqFeedback.options.length] = new Option('Document Retrieval - Photocopies','Document Retrieval - Photocopies');
		inqFeedback.options[inqFeedback.options.length] = new Option('Trademark Portfolio / Ownership Search','Trademark Portfolio / Ownership Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('Copyright Portfolio / Ownership Search','Copyright Portfolio / Ownership Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('Patent Portfolio / Ownership Search','Patent Portfolio / Ownership Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('USPTO Chain of Title Search','USPTO Chain of Title Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('Music Media Search','Music Media Search');
		inqFeedback.options[inqFeedback.options.length] = new Option('Alcoholic Beverage Label Search (BATF/TTB)','Alcoholic Beverage Label Search (BATF/TTB)');
		inqFeedback.options[inqFeedback.options.length] = new Option('Other or General Inquiry','Other or General Inquiry');
	}
}

function changeInquiryDescription(FormType)
{
	switch (document.EmailForm.InquiryDescription.value)
	{
		case "Other":
			document.getElementById("dependent-inquiry-other2").style.display = 'block';
			break;
		default:
			document.getElementById("dependent-inquiry-other2").style.display = 'none';
			break;
	}
}

function SubmitForm()
{
	strFormType = document.EmailForm.FormType.value;
	//strInquiryType = document.EmailForm.InquiryDescription.value;

	strErr = ""; //clear error label
	flag = true; //unset flag

	//unset all style colors
	resetStyle("CompanyName");
	resetStyle("FirstName");
	resetStyle("LastName");
	resetStyle("EmailAddress");
	resetStyle("PhoneNumber");
	resetStyle("City");
	resetStyle("State");
	resetStyle("PostalCode");
	resetStyle("DescriptionOfRequest");
	resetStyle("LocationRadio");
	//resetStyle("ProductType");
	//resetStyle("WatchingServices");
	//resetStyle("Trademark");
	//resetStyle("Copyright");
	//resetStyle("SaegisOnline");
	resetStyle("OnlineServices");
	resetStyle("BillingInfo");
	resetStyle("FeedbackConcern");
	resetStyle("FeedbackRadio");
	resetStyle("FeedbackProduct");
	//resetStyle("IdType");
	//resetStyle("ClientId");
	//resetStyle("FirmId");
	//resetStyle("InvoiceNumber");
	//resetStyle("SerionUser");
	//resetStyle("OurFile");
	//resetStyle("MarkSearch");
	//resetStyle("EmailId");
	//resetStyle("Existing");
	
	validateForm();
	if (flag){
		document.EmailForm.action="SendEmail.asp";
		document.EmailForm.submit();
	}
	else
		alert(strErr);
}

function validateForm()
{
	validRequired("CompanyName");
	validRequired("FirstName");
	validRequired("LastName");
	validRequired("EmailAddress");
	validRequired("PhoneNumber");
	validRequired("City")
	validRequired("PostalCode")
	validRequired("DescriptionOfRequest");
	validRequired("LocationRadio");
	if(document.EmailForm.FileAttach.value!=""){
		validRequired("AttachFile");
	}
	if(document.EmailForm.InquiryTypeDropDown.value=="1"){
		//validRequired("ProductType");
		//if(document.EmailForm.ProductTypeDropDown.value=="Watching Services"){
			//validRequired("WatchingServices");
		//}else if(document.EmailForm.ProductTypeDropDown.value=="Trademark Availability and Screening Searches"){
			//validRequired("Trademark");
		//}else if(document.EmailForm.ProductTypeDropDown.value=="Copyright, Title and Washington Services"){
			//validRequired("Copyright");
		//}else if(document.EmailForm.ProductTypeDropDown.value=="SAEGIS Online Screening"){
			//validRequired("SaegisOnline");
		//}
	}else if(document.EmailForm.InquiryTypeDropDown.value=="2"){
		validRequired("OnlineServices");
	}else if(document.EmailForm.InquiryTypeDropDown.value=="3"){
		validRequired("BillingInfo");
	}else if(document.EmailForm.InquiryTypeDropDown.value=="4"){
		validRequired("FeedbackConcern");
		validRequired("FeedbackRadio");
		if((document.EmailForm.FeedbackConcernDropDown.value!="SERION Inbox or Analysis Tool") && (document.EmailForm.FeedbackConcernDropDown.value!="SAEGIS Screening") && (document.EmailForm.FeedbackConcernDropDown.value!="Billing / Finance")){
			validRequired("FeedbackProduct");
		}
	}
	if(document.EmailForm.ClientRadio[0].checked){
		//validRequired("IdType");
		if(document.EmailForm.IdTypeDropDown.value == "Client ID Number"){
			validRequired("ClientId");
		}else if(document.EmailForm.IdTypeDropDown.value == "Firm ID Number"){
			validRequired("FirmId");
		}else if(document.EmailForm.IdTypeDropDown.value == "Invoice Number"){
			validRequired("InvoiceNumber");
		}else if(document.EmailForm.IdTypeDropDown.value == "SERION User Name"){
			validRequired("SerionUser");
		}else if(document.EmailForm.IdTypeDropDown.value == "Our File or Search Number"){
			validRequired("OurFile");
		}else if(document.EmailForm.IdTypeDropDown.value == "Mark Searched"){
			validRequired("MarkSearch");
		}else if(document.EmailForm.IdTypeDropDown.value == "E-Mail Address"){
			validRequired("EmailId");
		}else if(document.EmailForm.IdTypeDropDown.value == "Existing Watch Reference"){
			validRequired("Existing");
		}
	}
	if(document.getElementById("state").value != ""){
		validRequired("State");
	}
	
	if (!flag){strErr = strErr + "Please complete all required fields (shown in bold red)";}
}

function validRequired(fldName)
{
	//Attach a File Validation
	if(fldName=="AttachFile"){
		var ext = document.EmailForm.FileAttach.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;
		}
	}
	//Existing Watch Reference Validation
	if ((fldName=="Existing") && (document.EmailForm.ExistingTextBox.value=="")){
		//requireField(fldName);
	}
	//Email ID Validation
	if ((fldName=="EmailId") && (document.EmailForm.EmailIdTextBox.value=="")){
		//requireField(fldName);
	}
	//Mark Searched Validation
	if ((fldName=="MarkSearch") && (document.EmailForm.MarkSearchTextBox.value=="")){
		//requireField(fldName);
	}
	//Our File or Search Number Validation
	if (fldName=="OurFile"){
		var ourfileRegExp = new RegExp("^[0-9-]{1,13}$");
		if(document.EmailForm.OurFileTextBox.value==""){
			//requireField(fldName);
		}
		else if(!ourfileRegExp.test(document.EmailForm.OurFileTextBox.value)){
			//requireField(fldName);
			alert("Our File or Search Number only allows numbers and dashes. Please review for accuracy and resubmit.");
		}
	}
	//SERION User Name Validation
	if ((fldName=="SerionUser") && (document.EmailForm.SerionUserTextBox.value=="")){
		requireField(fldName);
	}
	//Invoice Number Validation
	if (fldName=="InvoiceNumber"){
		var invoicenumRegExp = new RegExp("^[0-9-]{1,12}$");
		if(document.EmailForm.InvoiceNumberTextBox.value==""){
			//requireField(fldName);
		}
		else if(!invoicenumRegExp.test(document.EmailForm.InvoiceNumberTextBox.value)){
			//requireField(fldName);
			alert("Invoice Number only allows numbers and dashes. Please review for accuracy and resubmit.");
		}
	}
	//Firm ID Validation
	if (fldName=="FirmId"){
		var firmidRegExp = new RegExp("^[0-9-]{1,8}$");
		if(document.EmailForm.FirmIdTextBox.value==""){
			//requireField(fldName);
		}
		else if(!firmidRegExp.test(document.EmailForm.FirmIdTextBox.value)){
			//requireField(fldName);
			alert("Firm ID only allows numbers and dashes. Please review for accuracy and resubmit.");
		}
	}
	//Client ID Validation
	if (fldName=="ClientId"){
		var clientidRegExp = new RegExp("^[0-9-]{1,10}$");
		if(document.EmailForm.ClientIdTextBox.value==""){
			//requireField(fldName);
		}
		else if(!clientidRegExp.test(document.EmailForm.ClientIdTextBox.value)){
			//requireField(fldName);
			alert("Client ID only allows numbers and dashes. Please review for accuracy and resubmit.");
		}
	}
	//ID Type Validation
	//if(fldName=="IdType"){
	//	if ((document.EmailForm.IdTypeDropDown.value=="0") || (document.EmailForm.IdTypeDropDown.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//State Validation
	if(fldName=="State"){
		var stateRegEx = new RegExp("^[a-zA-Z]{1,2}$");
		if(!stateRegEx.test(document.EmailForm.StateTextBox.value)){
			alert("State must be of form AL. Please review your state and resubmit")
		}
	}
	//Feedback Product List Validation
	if(fldName=="FeedbackProduct"){
		if ((document.EmailForm.FeedbackProductDropDown.value=="0") || (document.EmailForm.FeedbackProductDropDown.value=="")){
			requireField(fldName);
		}
	}
	//Feedback Radio Validation
	if(fldName=="FeedbackRadio"){
		selectedButton = -1;
		for (i=document.EmailForm.FeedbackRadio.length-1; i > -1; i--)
		{
			if (document.EmailForm.FeedbackRadio[i].checked)
			{
				selectedButton = i; i = -1;
			}
		}
		if (selectedButton == -1)
		{
			requireField(fldName);
		}
	}
	//Feedback Concern Validation
	if(fldName=="FeedbackConcern"){
		if ((document.EmailForm.FeedbackConcernDropDown.value=="0") || (document.EmailForm.FeedbackConcernDropDown.value=="")){
			requireField(fldName);
		}
	}
	//Billing Info Validation
	if(fldName=="BillingInfo"){
		if ((document.EmailForm.BillingInfoDropDown.value=="0") || (document.EmailForm.BillingInfoDropDown.value=="")){
			requireField(fldName);
		}
	}
	//Online Services Validation
	if(fldName=="OnlineServices"){
		if ((document.EmailForm.OnlineServicesDropDown.value=="0") || (document.EmailForm.OnlineServicesDropDown.value=="")){
			requireField(fldName);
		}
	}
	//Saegis Online Validation
	//if(fldName=="SaegisOnline"){
	//	if ((document.EmailForm.SaegisOnlineListBox.value=="0") || (document.EmailForm.SaegisOnlineListBox.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//Copyright Validation
	//if(fldName=="Copyright"){
	//	if ((document.EmailForm.CopyrightListBox.value=="0") || (document.EmailForm.CopyrightListBox.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//Trademark Validation
	//if(fldName=="Trademark"){
	//	if ((document.EmailForm.TrademarkListBox.value=="0") || (document.EmailForm.TrademarkListBox.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//Watching Services Validation
	//if(fldName=="WatchingServices"){
	//	if ((document.EmailForm.WatchingServicesListBox.value=="0") || (document.EmailForm.WatchingServicesListBox.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//Product Type Validation
	//if(fldName=="ProductType"){
	//	if ((document.EmailForm.ProductTypeDropDown.value=="0") || (document.EmailForm.ProductTypeDropDown.value=="")){
	//		requireField(fldName);
	//	}
	//}
	//Location Radio Validation
	if(fldName=="LocationRadio"){
		selectedButton = -1;
		for (i=document.EmailForm.LocationRadio.length-1; i > -1; i--)
		{
			if (document.EmailForm.LocationRadio[i].checked)
			{
				selectedButton = i; i = -1;
			}
		}
		if (selectedButton == -1)
		{
			requireField(fldName);
		}
	}
	//City Validation
	if ((fldName=="City") && (document.EmailForm.CityTextBox.value=="")){
		requireField(fldName);
	}
	//Postal Code Validation
	if ((fldName=="PostalCode") && (document.EmailForm.PostalCodeTextBox.value=="")){
		requireField(fldName);
	}
	//Company Name Validation
	if ((fldName=="CompanyName") && (document.EmailForm.CompanyNameTextBox.value=="")){
		requireField(fldName);
	}
	// First Name Validation
	if (fldName=="FirstName"){
		var firstNameRegEx = new RegExp("^[a-zA-Z\.-]{1,20}$");
		if(document.EmailForm.FirstNameTextBox.value==""){
			requireField(fldName);
		}
		else
		{ 
			if(!firstNameRegEx.test(document.EmailForm.FirstNameTextBox.value)){
				requireField(fldName);
				alert('First Name only allows a-z, dashes, and periods. Please review your first name and resubmit.')
			}
		}
	}
	// Last Name Validation
	if (fldName=="LastName"){
		var lastNameRegEx = new RegExp("^[a-zA-Z\.-]{1,20}$");
		if(document.EmailForm.LastNameTextBox.value==""){
			requireField(fldName);
		}
		else
		{ 
			if(!lastNameRegEx.test(document.EmailForm.LastNameTextBox.value)){
				requireField(fldName);
				alert('Last Name only allows a-z, dashes, and periods. Please review your last name and resubmit.')
			}
		}
	}
	//Details and Comments Validation
	if ((fldName=="DescriptionOfRequest") && (document.EmailForm.DescrptionOfRequestTextArea.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.')
					}
			 	}
			}
		}
	}

	// Account Number Validation
	/*if ((fldName=="AccountNumber") && (document.EmailForm.AccountNumberTextBox.value!=""))
	{
		var acctNumRegEx = new RegExp("^[a-zA-Z0-9]{1,8}$");
		if (!acctNumRegEx.test(document.EmailForm.AccountNumberTextBox.value))
		{ 
			requireField(fldName);
			alert('Account numbers must contain between 1 and 8 alpha-numeric characters. Please review your account number for accuracy and resubmit.')
		}
	}

	// Inquiry Other2 Validation
	//if ((fldName=="InquiryOther2") && (document.EmailForm.InquiryOther2TextBox.value==""))
	//	if (document.EmailForm.InquiryDescriptionDropDown.value == "Other")
	//		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;;
		}
	}*/
}
