



function testthis(form) {

//inputStr = form.testfield.value
inputStr = form.testfield.value
form.testfield.value = ""
//document.write (inputStr)
//document.write (inputStr)
//document.write ('<br><br>')

var strWorking = new String();
strPrintRequested = "Printed Literature Requested: "
strPDFRequested = "PDF Requested (automatically fulfilled): "
locEndPrintRequested = (inputStr.indexOf(strPrintRequested) + strPrintRequested.length)
locEndPDFRequested = (inputStr.indexOf(strPDFRequested) + strPDFRequested.length)
locPDFRequested = inputStr.indexOf(strPDFRequested)
strPrintRequestedSet = (inputStr.substr(locEndPrintRequested, locPDFRequested - locEndPrintRequested))
var PrintRequestedArray = strPrintRequestedSet.split(" ")
for (i = 0; i < PrintRequestedArray.length ; i++) { 
	if (PrintRequestedArray[i].match('C01')) {
	form.PrintedLiterature[0].checked = true
	}
	if (PrintRequestedArray[i].match('CF0')) {
	form.PrintedLiterature[1].checked = true
	}
	if (PrintRequestedArray[i].match('VIS')) {
	form.PrintedLiterature[2].checked = true
	}
	if (PrintRequestedArray[i].match('ACA')) {
	form.PrintedLiterature[3].checked = true
	}
	if (PrintRequestedArray[i].match('TBI')) {
	form.PrintedLiterature[4].checked = true
	}
	if (PrintRequestedArray[i].match('T00')) {
	form.PrintedLiterature[5].checked = true
	}
	if (PrintRequestedArray[i].match('OVR')) {
	form.PrintedLiterature[6].checked = true
	}
	if (PrintRequestedArray[i].match('RGE')) {
	form.PrintedLiterature[7].checked = true
	}	
}

strInterests = "Interests: "
locInterests = inputStr.indexOf(strInterests)

strPDFRequestedSet = (inputStr.substr(locEndPDFRequested, locInterests - locEndPDFRequested))
var PDFRequestedArray = strPDFRequestedSet.split(" ")
for (i = 0; i < PDFRequestedArray.length ; i++) { 
	if (PDFRequestedArray[i].match('I01')) {
	form.DownloadLiterature[0].checked = true
	}	
	if (PDFRequestedArray[i].match('C01')) {
	form.DownloadLiterature[1].checked = true
	}
	if (PDFRequestedArray[i].match('CF0')) {
	form.DownloadLiterature[2].checked = true
	}
	if (PDFRequestedArray[i].match('VIS')) {
	form.DownloadLiterature[3].checked = true
	}
	if (PDFRequestedArray[i].match('ACA')) {
	form.DownloadLiterature[4].checked = true
	}
	if (PDFRequestedArray[i].match('T00')) {
	form.DownloadLiterature[5].checked = true
	}
	if (PDFRequestedArray[i].match('RGE')) {
	form.DownloadLiterature[6].checked = true
	}	
}



strFirstName = "First Name: "
locFirstName = inputStr.indexOf(strFirstName)

strInterestsSet = inputStr.substr(locInterests + strInterests.length, locFirstName - (locInterests + strInterests.length))
var strInterestsArray = strInterestsSet.split(" ")
for (i = 0; i < strInterestsArray.length ; i++) { 
	if (strInterestsArray[i].match('LocateDistributor')) {
		form.interests[0].checked = true
	}
	if (strInterestsArray[i].match('LocateInstaller')) {
		form.interests[1].checked = true
	}
	if (strInterestsArray[i].match('BecomeInstaller')) {
		form.interests[2].checked = true
	}
	if (strInterestsArray[i].match('LocateConsultant')) {
		form.interests[3].checked = true
	}
	if (strInterestsArray[i].match('BecomeConsultant')) {
		form.interests[4].checked = true
	}
	if (strInterestsArray[i].match('SpeakWithRep')) {
		form.interests[5].checked = true
	}
}

strLastName = "Last Name: "
locLastName = inputStr.indexOf(strLastName)

form.FirstName.value = inputStr.substr(locFirstName + strFirstName.length, locLastName - (locFirstName + strFirstName.length))

strTitle = "Title: "
locTitle = inputStr.indexOf(strTitle)

form.LastName.value = inputStr.substr(locLastName + strLastName.length, locTitle - (locLastName + strLastName.length))

strCompany = "Company: "
locCompany = inputStr.indexOf(strCompany)

form.Title.value = inputStr.substr(locTitle + strTitle.length, locCompany - (locTitle + strTitle.length))

strAddress1 = "Address1: "
locAddress1 = inputStr.indexOf(strAddress1)

form.Company.value = inputStr.substr(locCompany + strCompany.length, locAddress1 - (locCompany + strCompany.length))

strAddress2 = "Address2: "
locAddress2 = inputStr.indexOf(strAddress2)

form.Address1.value = inputStr.substr(locAddress1 + strAddress1.length, locAddress2 - (locAddress1 + strAddress1.length))

strCity = "City: "
locCity = inputStr.indexOf(strCity)

form.Address2.value = inputStr.substr(locAddress2 + strAddress2.length, locCity - (locAddress2 + strAddress2.length))

strState = "State: "
locState = inputStr.indexOf(strState)

form.City.value = inputStr.substr(locCity + strCity.length, locState - (locCity + strCity.length))

strProvince = "Province: "
locProvince = inputStr.indexOf(strProvince)

formStatevalue = inputStr.substr(locState + strState.length, locProvince - (locState + strState.length))

if (formStatevalue.match('AE') ) {
form.State.options[1].selected = 'AE'
}
if (formStatevalue.match('AK') ) {
form.State.options[2].selected = 'AK'
}
if (formStatevalue.match('AL') ) {
form.State.options[3].selected = 'AL'
}
if (formStatevalue.match('AP') ) {
form.State.options[4].selected = 'AP'
}
if (formStatevalue.match('AR') ) {
form.State.options[5].selected = 'AR'
}
if (formStatevalue.match('AZ') ) {
form.State.options[6].selected = 'AZ'
}
if (formStatevalue.match('CA') ) {
form.State.options[7].selected = 'CA'
}
if (formStatevalue.match('CO') ) {
form.State.options[8].selected = 'CO'
}
if (formStatevalue.match('CT') ) {
form.State.options[9].selected = 'CT'
}
if (formStatevalue.match('DC') ) {
form.State.options[10].selected = 'DC'
}
if (formStatevalue.match('DE') ) {
form.State.options[11].selected = 'DE'
}
if (formStatevalue.match('FL') ) {
form.State.options[12].selected = 'FL'
}
if (formStatevalue.match('GA') ) {
form.State.options[13].selected = 'GA'
}
if (formStatevalue.match('HI') ) {
form.State.options[14].selected = 'HI'
}
if (formStatevalue.match('IA') ) {
form.State.options[15].selected = 'IA'
}
if (formStatevalue.match('ID') ) {
form.State.options[16].selected = 'ID'
}
if (formStatevalue.match('IL') ) {
form.State.options[17].selected = 'IL'
}
if (formStatevalue.match('IN') ) {
form.State.options[18].selected = 'IN'
}
if (formStatevalue.match('KS') ) {
form.State.options[19].selected = 'KS'
}
if (formStatevalue.match('KY') ) {
form.State.options[20].selected = 'KY'
}
if (formStatevalue.match('LA') ) {
form.State.options[21].selected = 'LA'
}
if (formStatevalue.match('MA') ) {
form.State.options[22].selected = 'MA'
}
if (formStatevalue.match('MD') ) {
form.State.options[23].selected = 'MD'
}
if (formStatevalue.match('ME') ) {
form.State.options[24].selected = 'ME'
}
if (formStatevalue.match('MI') ) {
form.State.options[25].selected = 'MI'
}
if (formStatevalue.match('MN') ) {
form.State.options[26].selected = 'MN'
}
if (formStatevalue.match('MO') ) {
form.State.options[27].selected = 'MO'
}
if (formStatevalue.match('MS') ) {
form.State.options[28].selected = 'MS'
}
if (formStatevalue.match('MT') ) {
form.State.options[29].selected = 'MT'
}
if (formStatevalue.match('NC') ) {
form.State.options[30].selected = 'NC'
}
if (formStatevalue.match('ND') ) {
form.State.options[31].selected = 'ND'
}
if (formStatevalue.match('NE') ) {
form.State.options[32].selected = 'NE'
}
if (formStatevalue.match('NH') ) {
form.State.options[33].selected = 'NH'
}
if (formStatevalue.match('NJ') ) {
form.State.options[34].selected = 'NJ'
}
if (formStatevalue.match('NM') ) {
form.State.options[35].selected = 'NM'
}
if (formStatevalue.match('NV') ) {
form.State.options[36].selected = 'NV'
}
if (formStatevalue.match('NY') ) {
form.State.options[37].selected = 'NY'
}
if (formStatevalue.match('OH') ) {
form.State.options[38].selected = 'OH'
}
if (formStatevalue.match('OK') ) {
form.State.options[39].selected = 'OK'
}
if (formStatevalue.match('OR') ) {
form.State.options[40].selected = 'OR'
}
if (formStatevalue.match('PA') ) {
form.State.options[41].selected = 'PA'
}
if (formStatevalue.match('RI') ) {
form.State.options[42].selected = 'RI'
}
if (formStatevalue.match('SC') ) {
form.State.options[43].selected = 'SC'
}
if (formStatevalue.match('SD') ) {
form.State.options[44].selected = 'SD'
}
if (formStatevalue.match('TN') ) {
form.State.options[45].selected = 'TN'
}
if (formStatevalue.match('TX') ) {
form.State.options[46].selected = 'TX'
}
if (formStatevalue.match('UT') ) {
form.State.options[47].selected = 'UT'
}
if (formStatevalue.match('VA') ) {
form.State.options[48].selected = 'VA'
}
if (formStatevalue.match('VT') ) {
form.State.options[49].selected = 'VT'
}
if (formStatevalue.match('WA') ) {
form.State.options[50].selected = 'WA'
}
if (formStatevalue.match('WI') ) {
form.State.options[51].selected = 'WI'
}
if (formStatevalue.match('WV') ) {
form.State.options[52].selected = 'WV'
}
if (formStatevalue.match('WY') ) {
form.State.options[53].selected = 'WY'
}

strZipCode = "Zip Code: "
locZipCode = inputStr.indexOf(strZipCode)

form.State_1.value = inputStr.substr(locProvince + strProvince.length, locZipCode - (locProvince + strProvince.length))

strCountry = "Country: "
locCountry = inputStr.indexOf(strCountry)

form.ZipCode.value = inputStr.substr(locZipCode + strZipCode.length, locCountry - (locZipCode + strZipCode.length))

strPhone = "Phone: "
locPhone = inputStr.indexOf(strPhone)

formCountryvalue = inputStr.substr(locCountry + strCountry.length, locPhone - (locCountry + strCountry.length))

if (formCountryvalue.match('US') ) {
form.Country.options[1].selected = 'US'
}

strPhoneExtension = "Phone Extension: "
locPhoneExtension = inputStr.indexOf(strPhoneExtension)

form.DirectPhone.value = inputStr.substr(locPhone + strPhone.length, locPhoneExtension - (locPhone + strPhone.length))

strEmail = "Email: "
locEmail = inputStr.indexOf(strEmail)

form.PhoneExtension.value = inputStr.substr(locPhoneExtension + strPhoneExtension.length, locEmail - (locPhoneExtension + strPhoneExtension.length))

strCompanyType = "Company Type: "
locCompanyType = inputStr.indexOf(strCompanyType)

form.EMail.value = inputStr.substr(locEmail + strEmail.length, locCompanyType - (locEmail + strEmail.length))

strVerticalMarket = "Vertical Market: "
locVerticalMarket = inputStr.indexOf(strVerticalMarket)

formTypevalue = inputStr.substr(locCompanyType + strCompanyType.length, locVerticalMarket - (locCompanyType + strCompanyType.length))
	if (formTypevalue.match('Consultant') ) {
	form.Type.options[1].selected = 'Consultant'
	} 
	if (formTypevalue.match('Distributor') ) {
	form.Type.options[2].selected = 'Distributor'
	} 
	if (formTypevalue.match('End User') ) {
	form.Type.options[3].selected = 'End User'
	} 
	if (formTypevalue.match('HomeOwner') ) {
	form.Type.options[4].selected = 'HomeOwner'
	} 
	if (formTypevalue.match('Installer') ) {
	form.Type.options[6].selected = 'Installer'
	} 
	if (formTypevalue.match('OEM') ) {
	form.Type.options[7].selected = 'OEM'
	} 
	if (formTypevalue.match('Reseller') ) {
	form.Type.options[8].selected = 'Reseller'
	} 			

	
	
strProjects = "Projects Yes/No?: "
locProjects = inputStr.indexOf(strProjects)

formVerticalMarket = inputStr.substr(locVerticalMarket + strVerticalMarket.length, locProjects - (locVerticalMarket + strVerticalMarket.length))
	if (formVerticalMarket.match('Commercial') ) {
	form.VerticalMarket.options[0].selected = 'Commercial'
	}
	if (formVerticalMarket.match('Education') ) {
	form.VerticalMarket.options[1].selected = 'Education'
	} 	
	if (formVerticalMarket.match('Finance') ) {
	form.VerticalMarket.options[2].selected = 'Finance'
	} 	
	if (formVerticalMarket.match('Government') ) {
	form.VerticalMarket.options[3].selected = 'Government'
	} 	
	if (formVerticalMarket.match('Manufacturing') ) {
	form.VerticalMarket.options[4].selected = 'Manufacturing'
	} 	
	if (formVerticalMarket.match('Medical') ) {
	form.VerticalMarket.options[5].selected = 'Medical'
	} 	
	if (formVerticalMarket.match('Military') ) {
	form.VerticalMarket.options[6].selected = 'Military'
	} 	
	if (formVerticalMarket.match('Retail') ) {
	form.VerticalMarket.options[7].selected = 'Retail'
	} 	
	if (formVerticalMarket.match('Telecommunications/Computer') ) {
	form.VerticalMarket.options[8].selected = 'Telecommunications/Computer'
	} 	
	if (formVerticalMarket.match('Transportation') ) {
	form.VerticalMarket.options[9].selected = 'Transportation'
	} 	
	if (formVerticalMarket.match('Utilitites') ) {
	form.VerticalMarket.options[10].selected = 'Utilitites'
	} 	
	if (formVerticalMarket.match('Other') ) {
	form.VerticalMarket.options[11].selected = 'Other'
	} 	

strProjectStart = "Project Start: "
locProjectStart = inputStr.indexOf(strProjectStart)

formProjectsvalue = inputStr.substr(locProjects + strProjects.length, locProjectStart - (locProjects + strProjects.length))

	if (formProjectsvalue.match('Yes') ) {
	form.Projects[0].checked = true
	} 
	if (formProjectsvalue.match('No')) {
	form.Projects[1].checked = true 
	}

strNumWorkAreas = "# of Work Areas: "
locNumWorkAreas = inputStr.indexOf(strNumWorkAreas)

formProjectStartvalue = inputStr.substr(locProjectStart + strProjectStart.length, locNumWorkAreas - (locProjectStart + strProjectStart.length))
	if (formProjectStartvalue.match('Already Started') ) {
	form.ProjectStart.options[1].selected = 'Already Started'
	} 
	if (formProjectStartvalue.match('Starts in 0-3 months') ) {
	form.ProjectStart.options[2].selected = 'Starts in 0-3 months'
	} 
	if (formProjectStartvalue.match('Starts in 3-12 months') ) {
	form.ProjectStart.options[3].selected = 'Starts in 3-12 months'
	} 
	if (formProjectStartvalue.match('Starts more than 1 year') ) {
	form.ProjectStart.options[4].selected = 'Starts more than 1 year'
	} 

strSingleMultiple = "Single or Multiple Site: "
locSingleMultiple = inputStr.indexOf(strSingleMultiple)

formWorkAreasvalue = inputStr.substr(locNumWorkAreas + strNumWorkAreas.length, locSingleMultiple - (locNumWorkAreas + strNumWorkAreas.length))
	if (formWorkAreasvalue.match('5') ) {
	form.WorkAreas.options[5].selected = '5'
	} 
	if (formWorkAreasvalue.match('25') ) {
	form.WorkAreas.options[4].selected = '25'
	} 
	if (formWorkAreasvalue.match('75') ) {
	form.WorkAreas.options[3].selected = '75'
	} 
	if (formWorkAreasvalue.match('300') ) {
	form.WorkAreas.options[2].selected = '300'
	} 
	if (formWorkAreasvalue.match('700') ) {
	form.WorkAreas.options[1].selected = '700'
	} 

strResidentialOrCommercial = "Residential or Commercial: "
locResidentialOrCommercial = inputStr.indexOf(strResidentialOrCommercial)

form.SingleMultiple.value = inputStr.substr(locSingleMultiple + strSingleMultiple.length, locResidentialOrCommercial - (locSingleMultiple + strSingleMultiple.length) - 2)
	if (form.SingleMultiple.value == 'Single Site') {
	form.SingleMultiple[0].checked = true
	} 
	if (form.SingleMultiple.value == 'Multiple Site') {
	form.SingleMultiple[1].checked = true 
	}
	
strLeadCode = "Lead Code: "
locLeadCode = inputStr.indexOf(strLeadCode)

form.ResidentialorCommercial.value = inputStr.substr(locResidentialOrCommercial + strResidentialOrCommercial.length, locLeadCode - (locResidentialOrCommercial + strResidentialOrCommercial.length) - 2)


	if (form.ResidentialorCommercial.value == 'Residential') {
	form.ResidentialorCommercial[0].checked = true
	} 
	if (form.ResidentialorCommercial.value == 'Commercial') {
	form.ResidentialorCommercial[1].checked = true
	}

strMailing = "Be on Mailing List: "
locMailing = inputStr.indexOf(strMailing)

formLeadCodevalue = inputStr.substr(locLeadCode + strLeadCode.length, locMailing - (locLeadCode + strLeadCode.length) - 2)

	switch (formLeadCodevalue) {
		case "WSE1":
			form.LeadCode.options[1].selected = true
			break
		case "WBL1":
			form.LeadCode.options[2].selected = true
			break
		case "WCM1":
			form.LeadCode.options[3].selected = true
			break
		case "WCP1":
			form.LeadCode.options[4].selected = true
			break					
		case "WCB1":
			form.LeadCode.options[5].selected = true
			break
		case "WEM1":
			form.LeadCode.options[6].selected = true
			break			
		case "WEC1":
			form.LeadCode.options[7].selected = true
			break
		case "WCN1":
			form.LeadCode.options[8].selected = true
			break
		case "WNGT1":
			form.LeadCode.options[9].selected = true
			break
		case "WEH1":
			form.LeadCode.options[10].selected = true
			break
		case "WHA1":
			form.LeadCode.options[11].selected = true
			break
		case "WLW1":
			form.LeadCode.options[12].selected = true
			break
		case "WNW1":
			form.LeadCode.options[13].selected = true
			break
		case "WMO1":
			form.LeadCode.options[14].selected = true
			break
		case "WSR1":
			form.LeadCode.options[15].selected = true
			break
		case "WTS1":
			form.LeadCode.options[16].selected = true
			break
		case "WDM1":
			form.LeadCode.options[17].selected = true
			break
		case "WFC1":
			form.LeadCode.options[18].selected = true
			break
		case "WBO1":
			form.LeadCode.options[19].selected = true
			break													
	}

strEmailAnnouncements = "Recieve Email Announcements: "
locEmailAnnouncements = inputStr.indexOf(strEmailAnnouncements)

formMailingListvalue = inputStr.substr(locMailing + strMailing.length, locEmailAnnouncements - (locMailing + strMailing.length) - 2)
	if (formMailingListvalue == 'Yes') {
	form.MailingList[0].checked = true
	} else {
	form.MailingList[1].checked = true
	}

formAnnouncevalue = ((inputStr.substr(locEmailAnnouncements + strEmailAnnouncements.length, inputStr.length)))
if (formAnnouncevalue.match('Yes')) {
	form.Announce[0].checked = true
	} else {
	form.Announce[1].checked = true
	}

} 
