<style type="text/css">
	#kpfg_header{ width:800px; height:180px; background:url(http://doclibrary.com/MFR457/IMG/bif_bg.jpg) no-repeat; }
		#kpfg_header h1 { color:#ffffff; font-size:22px; margin-bottom:3px;}
		#kpfg_header p { color:#ffffff; font-size:12px; margin-bottom:10px; }
	.kpfg { width:800px; }

	.kpfg h1 { margin-top:2.5em; margin-bottom:.5em; text-align:center; color: #ED1C24;}
	.kpfg h2 { font-size:0.875em; margin-top:1em; margin-bottom:1em; text-align:left;  color: #000000;}
		.kpfg h2 span { color:#d23239; }

	.kpfg table.requestorblock { width:800px; font-size:0.875em; }
	.kpfg table.requestorblock span { color:#d23239; }
	.kpfg table.requestorblock td { padding: 3px; } 
	.kpfg table.requestorblock td.l { width:140px; text-align:left;}
	.kpfg table.requestorblock td.l input { width:55px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.lx { width:780px; text-align:left;}
	.kpfg table.requestorblock td.rf { width:270px; }
	.kpfg table.requestorblock td.rf input { width:270px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rffname { width:135px; }
	.kpfg table.requestorblock td.rffname input { width:49px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rflname { width:135px; }
	.kpfg table.requestorblock td.rflname input { width:54px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rfzip { width:270px; }
	.kpfg table.requestorblock td.rfzip input { width:203px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rfx { width:670px; }
	.kpfg table.requestorblock td.rfx2 { width:800px; }
	.kpfg table.requestorblock td.rfx input { width:693px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rfx3 { width:670px; }
	.kpfg table.requestorblock td.rfx3 input { width:693px; background:#e6e7e8; border:0; }
	.kpfg table.requestorblock td.rfx2 textarea { width:795px;height:60px; border:1px solid #000000; } 
	
	.pfi-form { margin-top:25px; margin-bottom:25px; border:1px solid #a93439; }
	.pfi-form td { padding:5px; border:1px solid #a93439; text-align:center; }
		.pfi-form td:first-child{ text-align:left; }
	.pfi-form th { padding:5px; background:#a93439; color:#ffffff; }
		.pfi-form th:first-child { text-align:left; }
	
	/*ie10 */	
	@media screen and (min-width:0\0) { 
    	.kpfg table.requestorblock td.rfzip input { width:209px; background:#e6e7e8; border:0; }
	}
</style>

<cfscript>
	variables._FORM_CAT = "ME";
	variables._FIRST_NAME = "";
	variables._LAST_NAME = "";
	variables._COMPANY = "";
	variables._ADDRESS = "";
	variables._CITY = "";
	variables._STATE = "";
	variables._ZIP_CODE = "";
	variables._PHONE = "";
	variables._EMAIL = "";
</cfscript>

<cfmodule template="queries/qmd_getUserInfo.cfm"
			dsn="#client.datasource#"
			OwnerID="#client.user_ownerId#"
			OwnerType="#client.user_ownerType#"
			FSPro_UserID="#client.ID#">
				<cfscript>
					variables._FIRST_NAME = variables.usrFirstName;
					variables._LAST_NAME = variables.usrLastName;
					variables._COMPANY = variables.usrCompany;
					variables._ADDRESS = variables.usrStreetAddress;
					variables._CITY = variables.usrCity;
					variables._STATE = variables.usrState;
					variables._ZIP_CODE = variables.usrZip;
					variables._PHONE = variables.usrPhone;
					variables._EMAIL = variables.usrEmail;
				</cfscript>
				
<cfswitch expression="#url.set#">
	<!--- OLD SET --->
	<cfcase value="SampleFormMWEC">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "34">
		<cfset variables.ccCatId = "4685">
		<cfset variables.orderNumPrefix = "ME">
	</cfcase>
	<cfcase value="SampleFormWEST">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "32">
		<cfset variables.ccCatId = "4677">
		<cfset variables.orderNumPrefix = "WC">
	</cfcase>
	<cfcase value="SampleFormSchKits">
		<cfset variables.prdLoop = "no">
		<cfset variables.ccFltrId = "0">
		<cfset variables.ccCatId = "10863">
		<cfset variables.orderNumPrefix = "SK">
	</cfcase>
	<cfcase value="SampleFormStfrs">
		<cfset variables.prdLoop = "no">
		<cfset variables.ccFltrId = "0">
		<cfset variables.ccCatId = "4683">
		<cfset variables.orderNumPrefix = "ST">
	</cfcase>
	<cfcase value="SampleFormUltras">
		<cfset variables.prdLoop = "no">
		<cfset variables.ccFltrId = "0">
		<cfset variables.ccCatId = "15363">
		<cfset variables.orderNumPrefix = "US">
	</cfcase>
	<!--- end: OLD SET --->
	<!--- the following five are tied to SCRUM #11738 --->
	<cfcase value="SampleFormMWECON">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "1354">
		<cfset variables.ccCatId = "20696">
		<cfset variables.orderNumPrefix = "MWECON">
	</cfcase>
	<cfcase value="SampleFormWCON">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "1355">
		<cfset variables.ccCatId = "20697">
		<cfset variables.orderNumPrefix = "WCON">
	</cfcase>
	<cfcase value="SampleFormMEATON">
		<cfset variables.prdLoop = "no">
		<cfset variables.ccFltrId = "0">
		<cfset variables.ccCatId = "20698">
		<cfset variables.orderNumPrefix = "MEATON">
	</cfcase>
	<cfcase value="SampleFormMWECTRUCK">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "1356">
		<cfset variables.ccCatId = "20699">
		<cfset variables.orderNumPrefix = "MWECTRUCK">
	</cfcase>
	<cfcase value="SampleFormWCTRUCK">
		<cfset variables.prdLoop = "yes">
		<cfset variables.ccFltrId = "1357">
		<cfset variables.ccCatId = "20700">
		<cfset variables.orderNumPrefix = "WCTRUCK">
	</cfcase>
	<!--- end: SCRUM #11738 --->
	<!--- SCRUM #13073  --->
	<cfcase value="SampleFormWWHEAT">
		<cfset variables.prdLoop = "no">
		<cfset variables.ccFltrId = "0">
		<cfset variables.ccCatId = "21227">
		<cfset variables.orderNumPrefix = "WWHEAT">
	</cfcase>
	<!--- end: SCRUM #13073 --->
	
	<cfdefaultcase> <cfabort> </cfdefaultcase>
</cfswitch>					
				
<div class="kpfg">
	<div>
		<h2><span>Step 1:</span> Please select the appropriate order type.</h2>
		<table class="requestorblock">
			<tr>
				<td class="l">Sample Request Type<span>*</span></td>
				<td class="rf">
					<select onchange="updSampReqNumFld();" fse:message="Please select Request Type" fse:required="true" id="SAMPLEFORM_ORDER_TYPE" name="SAMPLEFORM_ORDER_TYPE">
						<option value="">-- Select One --</option> 
						<option data="" value="NEW">NEW</option>
						<option data="" value="REVISED">REVISED</option> 
					</select>
				</td>
				<td class="l">Sample Request #<span>*</span></td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_SAMPLE_REQUEST_NUM" /></td> 
			</tr>
		</table>
	</div>
	<div>
		<h2><span>Step 2:</span> Please complete the following entirely.</h2>
		<table class="requestorblock">
			<tr>
				<td class="l">First Name<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_FIRST_NAME" /></td>
				<td class="l">Request By</td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_REQUEST_BY" /></td> 
			</tr>
			<tr>
				<td class="l">Last Name<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_LAST_NAME" /></td>
				<td class="l">SBI Regional Rep</td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_SBI_REGIONAL_REP" /></td> 
			</tr>
			<tr>
				<td class="l">Company<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_COMPANY" /></td>
				<td class="l">Arrival Date</td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_ARRIVAL_DATE" /></td> 
			</tr>
			<tr>
				<td class="l">Address<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_ADDRESS" /></td>
				<td class="l">Please Ride With Customer/Order #</td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_ORDER_NUM" /></td> 
			</tr>
			<tr>
				<td class="l">City<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_CITY" /></td>
				<td class="l">Phone No.<span>*</span></td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_PHONE" /></td> 
			</tr>
			<tr>
				<td class="l">State<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_STATE" /></td>
				<td class="l">Email Address<span>*</span></td>
	 			<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_EMAIL" /></td> 
			</tr>
			<tr>
				<td class="l">Zip Code<span>*</span></td>
				<td class="rf"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_ZIP_CODE" /></td>
				<td class="l"></td>
	 			<td class="rf"></td> 
			</tr>
		</table>
	</div>
	<cfif variables.prdLoop eq "yes">
		<cfmodule template="/mstrCFmod/cfmod_listCMMFilterValues.cfm" 
					datasource="#client.datasource#"
					ownrid="#client.ownerId#"
					ownrtyp="#client.ownerType#"
					filterid="#variables.ccFltrId#"
					OrderBY="orga.sortRank, orga.attrDescription">	
	<div>
		<h2><span>Step 3:</span> Please select the appropriate items.</h2>
		<table class="requestorblock">
			<cfset variables.filterSet = 1>
			<cfloop query="qmd_listCMMFilterValues">
				<cfmodule template="/mstrCFmod/cfmod_dispContentList.cfm" 
							dsn="#client.datasource#"
							clientid="#client.ownerId#"
							clienttype="#client.ownerType#"
							sectionid=1386
							categories="yes"
							categoryid="#variables.ccCatId#"
							useFilters="yes"
							filterids=#qmd_listCMMFilterValues.attrID#
							slctflds="itm.itemid, itm.title, itm.subtitle"
							queryname="qmd_dispContentList"
							isprivate=1
							groupids="#client.listGroups#"
							FSPro_UserID=#client.id#
							BrokerID=#client.BrokerID#
							sortby="itm.sortrank, itm.title">
			<!--- if category has zero products, suppress --->			
			<cfif qmd_dispContentList.recordcount gt 0>
			<tr>
				<td colspan="4"><cfoutput>#replace(qmd_listCMMFilterValues.attrDescription,'&','&amp;')#</cfoutput></td>
			</tr>
			<tr>
				<td>QTY</td>
				<td></td>
				<td>CODE</td>
				<td>DESCRIPTION</td>
			</tr>
			<cfoutput query="qmd_dispContentList">
			<tr>
				<td>
					<input fse:format="integer" id="SAMPLEFORM_PRDQTY#variables.filterSet#_#qmd_dispContentList.currentrow#" maxlength="3" name="SAMPLEFORM_PRDQTY#variables.filterSet#_#qmd_dispContentList.currentrow#" type="text" value=""/>
				</td>
				<td>
					<cfif listfind("SampleFormMWECON,SampleFormWCON",url.set)>
						<!--- Scrum 22880 --->
						<!---<input type="Hidden" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" value="Pack(s)" />Pack(s)--->
						<select id="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#">
							<option value="">-- Select One --</option>
							<option value="Case(s)">Case(s)</option>
							<option value="Packs(s)">Pack(s)</option>
						</select>
						<!--- End 22880 --->
					<cfelseif listfind("SampleFormMWECTRUCK,SampleFormWCTRUCK",url.set)>
						<input type="Hidden" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" value="Case(s)" />
						Case(s)
					<cfelse>
						<select id="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#">
							<option value="">-- Select One --</option>
							<option value="Case(s)">Case(s)</option>
							<option value="Pieces(s)">Pieces(s)</option>
						</select>
					</cfif>
					
				</td>
				<td>#htmleditformat(qmd_dispContentList.subtitle)#</td>
				<td>#htmleditformat(qmd_dispContentList.title)#</td>
			</tr>
			</cfoutput>
				<cfset variables.filterSet = variables.filterSet+1>
			</cfif>
			<tr>
				<td colspan="4"></td>
			</tr>
			</cfloop>
		</table>
	</div>
	<cfelse>
		<div>
		<h2><span>Step 3:</span> Please select the appropriate items.</h2>
		<table class="requestorblock">
			<cfset variables.filterSet = 1>
				<cfmodule template="/mstrCFmod/cfmod_dispContentList.cfm" 
							dsn="#client.datasource#"
							clientid="#client.ownerId#"
							clienttype="#client.ownerType#"
							sectionid=1386
							categories="yes"
							categoryid="#variables.ccCatId#"
							useFilters="no"
							filterids=""
							slctflds="itm.itemid, itm.title, itm.subtitle"
							queryname="qmd_dispContentList"
							isprivate=1
							groupids="#client.listGroups#"
							FSPro_UserID=#client.id#
							BrokerID=#client.BrokerID#
							sortby="itm.sortrank, itm.title">
			<!--- if category has zero products, suppress --->			
			<cfif qmd_dispContentList.recordcount gt 0>
			<tr>
				<td>QTY</td>
				<td></td>
				<td>CODE</td>
				<td>DESCRIPTION</td>
			</tr>
			<cfoutput query="qmd_dispContentList">
			<tr>
				<td>
					<input fse:format="integer" id="SAMPLEFORM_PRDQTY#variables.filterSet#_#qmd_dispContentList.currentrow#" maxlength="3" name="SAMPLEFORM_PRDQTY#variables.filterSet#_#qmd_dispContentList.currentrow#" type="text" value=""/>
				</td>
				<td>
					<cfif listfind("SampleFormFRIES,SampleFormMEATON",url.set)>
						<input type="Hidden" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" value="Pack(s)" />
						Pack(s)
					<cfelse>
						<select id="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#" name="SAMPLEFORM_PRDPCK#variables.filterSet#_#qmd_dispContentList.currentrow#">
							<option value="">-- Select One --</option>
							<option value="Case(s)">Case(s)</option>
							<option value="Pieces(s)">Pieces(s)</option>
						</select>
					</cfif>
				</td>
				<td>#htmleditformat(qmd_dispContentList.subtitle)#</td>
				<td>#htmleditformat(qmd_dispContentList.title)#</td>
			</tr>
			</cfoutput>
			</cfif>
		</table>
	</div>
	</cfif>
	<div style="margin:25px 75px 25px 75px;text-align:center;">
		<strong style="color:#000000;font-size:0.875em;">Please order for delivery at least 10 working days prior to the date needed. For example, if you need the sample on the 20th, your sample order should be placed by the 6th.</strong>
	</div>
	<div>
		<h2><span>Optional:</span> Special Instructions.</h2>
		<table class="requestorblock">
			<tr>
				<td colspan="4" class="rfx2"><cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_SPECIAL_INSTRCTS"/></td>
			</tr>
			<tr>
				<td>Check any that apply:</td>
				<td colspan="3">Dry Ice: <cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_DRY_ICE"/>   Military: <cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_MILITARY"/>   Retail: <cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_RETAIL"/>   School: <cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="field" fieldName="SAMPLEFORM_SCHOOL"/></td>
			</tr>
		</table>
	</div>
	<div class="buttons" style="text-align:center;margin-top:20px;">
		<cfmodule template="/mstrcfmod/CDA/cfmod_formXSLHelper.cfm" helper="button" class="submit"/>
		<!--- <cfmodule template="/mstrcfmod/WRK/bindings/helpers/button.cfm" class="reset"/> --->
	</div>
</div>

<cfset variables.ordernum = "#variables.orderNumPrefix##timeformat(now(),'HHmmss')##randrange(100,999)#">

<cfoutput>
<script type="text/javascript"><![CDATA[

	document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.value = '#JSStringFormat(variables.ordernum)#';
	document.cdaForm.SAMPLEFORM_FIRST_NAME.value = '#JSStringFormat(variables._FIRST_NAME)#';
	document.cdaForm.SAMPLEFORM_LAST_NAME.value = '#JSStringFormat(variables._LAST_NAME)#';
	document.cdaForm.SAMPLEFORM_COMPANY.value = '#JSStringFormat(variables._COMPANY)#';
	document.cdaForm.SAMPLEFORM_ADDRESS.value = '#JSStringFormat(variables._ADDRESS)#';
	document.cdaForm.SAMPLEFORM_CITY.value = '#JSStringFormat(variables._CITY)#';
	document.cdaForm.SAMPLEFORM_STATE.value = '#JSStringFormat(variables._STATE)#';
	document.cdaForm.SAMPLEFORM_ZIP_CODE.value = '#JSStringFormat(variables._ZIP_CODE)#';
	document.cdaForm.SAMPLEFORM_PHONE.value = '#JSStringFormat(variables._PHONE)#';
	document.cdaForm.SAMPLEFORM_EMAIL.value = '#JSStringFormat(variables._EMAIL)#';

	function updSampReqNumFld(){
		var e = document.getElementById("SAMPLEFORM_ORDER_TYPE");
		var ordTyp = e.options[e.selectedIndex].value;
		if(ordTyp=='NEW'){
			//document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.disabled=true;
			document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.value = '#JSStringFormat(variables.ordernum)#';
		}
		else if (ordTyp=='REVISED') {
			//document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.disabled=false;
			document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.value = '';
		} else {
			document.cdaForm.SAMPLEFORM_SAMPLE_REQUEST_NUM.value = '#JSStringFormat(variables.ordernum)#';
		}
	}
]]></script>
</cfoutput>
