<MvCOMMENT>
|
| Miva Merchant v4.x
|
| This file and the source codes contained herein are the property
| of Miva Corporation.  Use of this file is restricted to the specific
| terms and conditions in the License Agreement associated with this
| file.  Distribution of this file or portions of this file for uses
| not covered by the License Agreement is not allowed without a written
| agreement signed by an officer of Miva Corporation.
|
| Copyright 1998-2001 Miva Corporation.  All rights reserved.
| http://www.miva.com/
|
| Miva Merchant Affiliates
| $Source: /home/cvs/merchant/Merchant/features/aff/aff.mv,v $
|
| Prefix         : MER-AFF-
| Next Error Code: 4    
| Next Text ID   : 349  
|
</MvCOMMENT>

<MvFUNCTION NAME = "Affiliate_Navigation" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>	

	<MvCOMMENT> Affiliates </MvCOMMENT>
	<MvLOCALIZED NAME = "l.label" ID = "MER-AFF-00000">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate Configuration</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ LeftNavigation_Level( 2, 'AFLT(' $ Stores.d.id $ ')', 'Screen=AFLT&Store_Code=' $ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" VALUE = "{ CanI( 'AFLT', 0, 1, 0, 0 ) }">
		<MvIF EXPR = "{ l.can_add }">
			<MvLOCALIZED NAME = "l.label" ID = "MER-AFF-00001">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Affiliate</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok2" VALUE = "{ LeftNavigation_Dot( 3, 'Screen=AFIF&Store_Code=' $ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0, 0 ) }">
		<MvIF EXPR = "{ l.can_add_money }">
			<MvLOCALIZED NAME = "l.label" ID = "MER-AFF-00002">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Payout</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok3" VALUE = "{ LeftNavigation_Dot( 3, 'Screen=AFAP&Store_Code=' $ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Display Validate
|
</MvCOMMENT>

<MvFUNCTION NAME = "Affiliate_Display_Validate" STANDARDOUTPUTLEVEL = "">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Show_Code $ g.Affiliate_Show_SiteName $ g.Affiliate_Show_Hits $
					g.Affiliate_Show_Percent $ g.Affiliate_Show_Flat $ g.Affiliate_Show_SiteURL $
					g.Affiliate_Show_ContactName $ g.Affiliate_Show_Email $ g.Affiliate_Show_Phone $
					g.Affiliate_Show_Fax $ g.Affiliate_Show_Company $ g.Affiliate_Show_Address $
					g.Affiliate_Show_City $ g.Affiliate_Show_State $ g.Affiliate_Show_Zip $
					g.Affiliate_Show_Country $ g.Affiliate_Show_Balance $ g.Affiliate_Show_Status $
					g.Affiliate_Show_StatusDate $ g.Affiliate_Show_StatusBy ) }">

		<MvASSIGN NAME = "g.Affiliate_Display_Flag" VALUE = "1">

		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00334">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please select at least one display option</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Show_Code', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "Affiliate_PayoutDisplay_Validate" STANDARDOUTPUTLEVEL = "">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Show_Code $ g.Affiliate_Show_SiteName $ g.Affiliate_Show_Hits $
					g.Affiliate_Show_Percent $ g.Affiliate_Show_Flat $ g.Affiliate_Show_SiteURL $
					g.Affiliate_Show_ContactName $ g.Affiliate_Show_Email $ g.Affiliate_Show_Phone $
					g.Affiliate_Show_Fax $ g.Affiliate_Show_Company $ g.Affiliate_Show_Address $
					g.Affiliate_Show_City $ g.Affiliate_Show_State $ g.Affiliate_Show_Zip $
					g.Affiliate_Show_Country $ g.Affiliate_Show_Balance $ g.Affiliate_Show_Status $
					g.Affiliate_Show_StatusDate $ g.Affiliate_Show_StatusBy ) }">

		<MvASSIGN NAME = "g.Affiliate_Display_Flag" VALUE = "1">

		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00335">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please select at least one display option</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFIL', 'Affiliate_Show_Code', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Options/BatchEdit Validate
|
</MvCOMMENT>

<MvFUNCTION NAME = "AffiliateOptions_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "{ ltrim( rtrim( g.Affiliate_Code ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Hits" VALUE = "{ rtrim( ltrim( g.Affiliate_Hits ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Percent" VALUE = "{ rtrim( ltrim( g.Affiliate_Percent ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Flat" VALUE = "{ rtrim( ltrim( g.Affiliate_Flat ) ) }">
	<MvASSIGN NAME = "g.AffiliateOptions_Hits" VALUE = "{ rtrim( ltrim( g.AffiliateOptions_Hits ) ) }">
	<MvASSIGN NAME = "g.AffiliateOptions_Percent" VALUE = "{ rtrim( ltrim( g.AffiliateOptions_Percent ) ) }">
	<MvASSIGN NAME = "g.AffiliateOptions_Flat" VALUE = "{ rtrim( ltrim( g.AffiliateOptions_Flat ) ) }">

	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.Affiliate_Code ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Code', g.Validation_Message ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		<MvELSE>
			<MvIF EXPR = "{ ( toupper( g.Edit_Affiliate ) NE toupper( g.Affiliate_Code ) ) }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
				<MvIF EXPR = "{ l.found }">
					<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00004">
						<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ g.Affiliate_Code }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">An Affiliate with the login '%code%' already exists</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Code', l.error_message ) }">
					<MvFUNCTIONRETURN VALUE = "{ l.ok }">
				</MvIF>
			</MvIF>
		</MvIF>
	
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_Length_NonNegative_Required( g.Affiliate_Hits, 10, 4 ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Hits', g.Validation_Message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Affiliate_Percent ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Percent', g.Validation_Message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_NonNegative_Required( g.Affiliate_Flat ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Flat', g.Validation_Message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
		<MvWHILE EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
			<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_valid" VALUE = "{ Module_Affiliate_BatchEdit_Validate() }">
				<MvIF EXPR = "{ NOT l.module_valid }">
					<MvFUNCTIONRETURN VALUE = 0>
				</MvIF>
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
		</MvWHILE>
	</MvIF>


	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_Length_NonNegative_Required( g.AffiliateOptions_Hits, 10, 4 ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLT', 'AffiliateOptions_Hits', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.AffiliateOptions_Percent ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00014">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter a number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>					
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLT', 'AffiliateOptions_Percent', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_NonNegative_Required( g.AffiliateOptions_Flat ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00016">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter a number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>					
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLT', 'AffiliateOptions_Flat', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_NonNegative_Required( g.AffiliateOptions_PayoutThreshold ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00018">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter a number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>					
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLT', 'AffiliateOptions_PayoutThreshold', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Email ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.Affiliate_Email ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00019">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Email', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Phone ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Phone( g.Affiliate_Phone, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00020">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's phone number</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Phone', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Fax ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Phone( g.Affiliate_Fax, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00021">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's fax number</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Fax', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Zip ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Zip( g.Affiliate_Zip, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00022">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's Zip/Postal code</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFAF', 'Affiliate_Zip', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Add/Edit Validate
|
</MvCOMMENT>

<MvFUNCTION NAME = "Affiliate_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "{ ltrim( rtrim( g.Affiliate_Code ) ) }">
	<MvASSIGN NAME = "g.Affiliate_LostPass_Email" VALUE = "{ ltrim( rtrim( g.Affiliate_LostPass_Email ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Email" VALUE = "{ ltrim( rtrim( g.Affiliate_Email ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Phone" VALUE = "{ ltrim( rtrim( g.Affiliate_Phone ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Fax" VALUE = "{ ltrim( rtrim( g.Affiliate_Fax ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Zip" VALUE = "{ ltrim( rtrim( g.Affiliate_Zip ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Hits" VALUE = "{ rtrim( ltrim( g.Affiliate_Hits ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Percent" VALUE = "{ rtrim( ltrim( g.Affiliate_Percent ) ) }">
	<MvASSIGN NAME = "g.Affiliate_Flat" VALUE = "{ rtrim( ltrim( g.Affiliate_Flat ) ) }">

	<MvIF EXPR = "{ len( g.Affiliate_State ) EQ 0 }">
		<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ g.Affiliate_StateSelect }">
	</MvIF>


	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.Affiliate_Code ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_Code', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	<MvELSE>
		<MvIF EXPR = "{ ( len( g.Edit_Affiliate ) EQ 0 ) OR ( toupper( g.Edit_Affiliate ) NE toupper( g.Affiliate_Code ) ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00024">
					<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ g.Affiliate_Code }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">An Affiliate with the login '%code%' already exists</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_Code', l.error_message ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_LostPass_Email ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00025">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_LostPass_Email', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.Affiliate_LostPass_Email ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00026">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_LostPass_Email', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Edit_Affiliate ) EQ 0 }">
		<MvIF EXPR = "{ NOT len( g.Affiliate_Password ) }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00027">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a password</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_Password', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		<MvELSE>
			<MvIF EXPR = "{ g.Affiliate_VerifyPassword NE g.Affiliate_Password }">
				<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00028">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Passwords do not match</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_VerifyPassword', l.error_message ) }">
				<MvFUNCTIONRETURN VALUE = "{ l.ok }">
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ g.Affiliate_VerifyPassword NE g.Affiliate_Password }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00029">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Passwords do not match</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'IDEN', 'Affiliate_Password', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Email ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.Affiliate_Email ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00030">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'INFO', 'Affiliate_Email', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Phone ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Phone( g.Affiliate_Phone, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00031">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's phone number</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'INFO', 'Affiliate_Phone', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Zip ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Zip( g.Affiliate_Zip, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00032">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's Zip/Postal code</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'INFO', 'Affiliate_Zip', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Fax ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Phone( g.Affiliate_Fax, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00033">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify the affiliate's fax number</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'INFO', 'Affiliate_Fax', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_Length_NonNegative_Required( g.Affiliate_Hits, 10, 4 ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'COMM', 'Affiliate_Hits', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Affiliate_Percent ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'COMM', 'Affiliate_Percent', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_NonNegative_Required( g.Affiliate_Flat ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'COMM', 'Affiliate_Flat', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_valid" VALUE = "{ Module_Affiliate_Validate() }">
			<MvIF EXPR = "{ NOT l.module_valid }">
				<MvFUNCTIONRETURN VALUE = 0>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
	</MvWHILE>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AffiliateEmail_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AffiliateEmail_Subject" VALUE = "{ ltrim( rtrim( g.AffiliateEmail_Subject ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.AffiliateEmail_From ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00040">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLP', 'AffiliateEmail_From', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.AffiliateEmail_CC ) }">
	<MvIF EXPR = "{ len( g.AffiliateEmail_CC ) AND NOT l.valid }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00041">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLP', 'AffiliateEmail_CC', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ len( g.AffiliateEmail_Subject ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00042">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a subject</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFLP', 'AffiliateEmail_Subject', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AffiliateManage_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.EmailAffiliates_From" VALUE = "{ ltrim( rtrim( g.EmailAffiliates_From ) ) }">
	<MvASSIGN NAME = "g.EmailAffiliates_To" VALUE = "{ ltrim( rtrim( g.EmailAffiliates_To ) ) }">
	<MvASSIGN NAME = "g.EmailAffiliates_CC" VALUE = "{ ltrim( rtrim( g.EmailAffiliates_CC ) ) }">
	<MvASSIGN NAME = "g.EmailAffiliates_Subject" VALUE = "{ ltrim( rtrim( g.EmailAffiliates_Subject ) ) }">

	<MvIF EXPR = "{ g.EmailAffiliates_UseFrom }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.EmailAffiliates_From ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00043">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFME', 'EmailAffiliates_From', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ g.EmailAffiliates_UseTo }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.EmailAffiliates_To ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00044">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFME', 'EmailAffiliates_To', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ g.EmailAffiliates_UseCC }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Email( g.EmailAffiliates_CC ) }">
		<MvIF EXPR = "{ len( g.EmailAffiliates_CC ) AND NOT ( l.valid ) }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00045">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an email address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFME', 'EmailAffiliates_CC', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.EmailAffiliates_Subject ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00046">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a subject</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'AFME', 'EmailAffiliates_Subject', l.error_message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AffiliateEarnings_Void_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AffiliateEarnings_VoidReas" VALUE = "{ ltrim( rtrim( g.AffiliateEarnings_VoidReas ) ) }">
	<MvASSIGN NAME = "g.AffiliateEarnings_Earned" VALUE = "{ ltrim( rtrim( g.AffiliateEarnings_Earned ) ) }">
	<MvASSIGN NAME = "g.AffiliateEarnings_OrderID" VALUE = "{ ltrim( rtrim( g.AffiliateEarnings_OrderID ) ) }">
	<MvASSIGN NAME = "g.AffiliateEarnings_OrderAmt" VALUE = "{ ltrim( rtrim( g.AffiliateEarnings_OrderAmt ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_WholeNumber_Positive_Optional( g.AffiliateEarnings_OrderID ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'VOID', 'AffiliateEarnings_OrderID', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Optional( g.AffiliateEarnings_OrderAmt ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00338">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please enter a number</MvLOCALIZED-TEXT>
		</MvLOCALIZED>					
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'VOID', 'AffiliateEarnings_OrderAmt', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_FloatingPoint_Length_Required( g.AffiliateEarnings_Earned, 10, 4 ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'VOID', 'AffiliateEarnings_Earned', g.Validation_Message ) }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ g.AffiliateEarnings_Void }">
		<MvIF EXPR = "{ len( g.AffiliateEarnings_VoidReas ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00049">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a reason for voiding</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'VOID', 'AffiliateEarnings_VoidReas', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AffiliatePayouts_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AffiliatePayouts_VoidReas" VALUE = "{ ltrim( rtrim( g.AffiliatePayouts_VoidReas ) ) }">

	<MvIF EXPR = "{ g.AffiliatePayouts_Void }">
		<MvIF EXPR = "{ len( g.AffiliatePayouts_VoidReas ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-AFF-00050">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify a reason for voiding</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ FieldError( 'PAYO', 'AffiliatePayouts_VoidReas', l.error_message ) }">
			<MvFUNCTIONRETURN VALUE = "{ l.ok }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Insert
|
</MvCOMMENT>

<MvFUNCTION NAME = "Action_Affiliate_Insert">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" VALUE = "{ CanI( 'AFLT', 0, 1, 0, 0 ) }">

	<MvIF EXPR = "{ l.can_add }">
		<MvIF EXPR = "{ Affiliate_Validate() }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.affil_id" VALUE = "{ Affiliates_Insert( g.Affiliate_Code, g.Affiliate_Password, g.Affiliate_LostPass_Email, g.Affiliate_SiteName, g.Affiliate_SiteURL, g.Affiliate_ContactName, g.Affiliate_Email, g.Affiliate_Company, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_Zip, g.Affiliate_Country, g.Affiliate_Hits, g.Affiliate_Percent, g.Affiliate_Flat,  g.Affiliate_Status, g.Session_ID ) }">

			<MvIF EXPR = "{ NOT l.affil_id }">
				<MvASSIGN NAME = "l.ok" VALUE = 0>
			<MvELSE>
				<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00051">
					<MvLOCALIZED-TOKEN NAME = "message" VALUE = "{ encodeentities( g.Affiliate_Message ) }">
					<MvLOCALIZED-TOKEN NAME = "affiliate" VALUE = "{ encodeentities( g.Affiliate_Code ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">%message%Affiliate '%affiliate%' added</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "">
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
			<MvWHILE EXPR = "{ l.ok AND l.found }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
				<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_Update( l.affil_id ) }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
			</MvWHILE>

			<MvASSIGN NAME = "g.Tab" VALUE = "IDEN">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_AffiliateEarningsVoid_Insert" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">
	<MvIF EXPR = "{ l.ok AND l.can_add_money }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliateEarnings_Void_Validate() }">
		<MvIF EXPR = "{ l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_ID( g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvIF EXPR = "{ NOT len( g.Edit_AffiliateEarnings ) }">
					<MvASSIGN NAME = "l.AffiliateEarnings_AdjustBy1" VALUE = "{ g.Admin_User_ID }">
				<MvELSE>
					<MvASSIGN NAME = "l.AffiliateEarnings_AdjustBy1" VALUE = "">
				</MvIF>

				<MvIF EXPR = "{ g.AffiliateEarnings_Void }">
					<MvASSIGN NAME = "l.AffiliateEarnings_VoidBy1" VALUE = "{ g.Admin_User_ID }">
				<MvELSE>
					<MvASSIGN NAME = "l.AffiliateEarnings_VoidBy1" VALUE = "">
				</MvIF>
				
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ AffiliateEarningsVoid_Insert( g.Edit_Affiliate, g.AffiliateEarnings_Type, g.AffiliateEarnings_Void, g.AffiliateEarnings_VoidReas, g.AffiliateEarnings_OrderID, g.AffiliateEarnings_OrderAmt, g.AffiliateEarnings_Earned, l.AffiliateEarnings_VoidBy1, s.time_t, g.AffiliateEarnings_AdjustReas, l.AffiliateEarnings_AdjustBy1 ) }">

				<MvIF EXPR = "{ l.foo }">
					<MvASSIGN NAME = "Affiliates.d.balance" VALUE = "{ Affiliates.d.balance + g.AffiliateEarnings_Earned }">

					<MvIF EXPR = "{ g.AffiliateEarnings_Void }">
						<MvASSIGN NAME = "Affiliates.d.balance" VALUE = "{ Affiliates.d.balance - g.AffiliateEarnings_Earned }">
					</MvIF>
					
					<MvUPDATE NAME = "Affiliates">
				</MvIF>
			</MvIF>

			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND l.can_add_money AND l.valid }">
		<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00052">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjustment added</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Update
|
</MvCOMMENT>

<MvFUNCTION NAME = "Action_AffiliateBatchEdit_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.module_valid" VALUE = "1">
	<MvASSIGN NAME = "l.invalid_module" VALUE = "0">

	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'AFLT', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'AFLT', 0, 0, 0, 1 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete_money" VALUE = "{ CanI( 'MONY', 0, 0, 0, 1 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify_money" VALUE = "{ CanI( 'MONY', 0, 0, 1, 0 ) }">

	<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliateOptions_Validate() }">

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ l.can_modify AND l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Update( g.AffiliateOptions_Activated, g.AffiliateOptions_Signup, g.AffiliateOptions_Hits, g.AffiliateOptions_Percent, g.AffiliateOptions_PercentSelect, g.AffiliateOptions_Flat, g.AffiliateOptions_PayoutThreshold, g.AffiliateOptions_Terms, g.AffiliateOptions_LinkImage, g.AffiliateOptions_LinkText ) }">
			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.can_modify AND l.valid }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliateEmail_Validate() }">
		<MvIF EXPR = "{ l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEmail_Update( g.AffiliateEmail_From,
  																						    g.AffiliateEmail_CC,
																						    g.AffiliateEmail_Subject,
																						    g.AffiliateEmail_Header ) }">
			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.can_modify AND l.valid }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliateManage_Validate() }">
		<MvIF EXPR = "{ l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateManage_Update( g.EmailAffiliates_Activated,
																							 g.EmailAffiliates_UseFrom,
																							 g.EmailAffiliates_From,
																							 g.EmailAffiliates_UseTo,
  																						     g.EmailAffiliates_To,
  																						     g.EmailAffiliates_UseCC,  																						     
  																						     g.EmailAffiliates_CC,
																						     g.EmailAffiliates_Subject,
																						     g.EmailAffiliates_Header ) }">
			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.valid AND len( g.Edit_Affiliate ) AND l.can_modify }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Edit_Affiliate ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.foo" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">

		<MvIF EXPR = "{ l.foo AND l.ok }">
			<MvASSIGN NAME = "g.Affiliate_StatusBy" VALUE = "{ g.Admin_User_ID }">
		<MvELSE>
			<MvASSIGN NAME = "g.Affiliate_StatusBy" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvIF EXPR = "{ Affiliates.d.code NE g.Affiliate_Code }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.update_session" VALUE = "{ Affiliate_Find_SessionCode( Affiliates.d.code, g.Affiliate_Code ) }">
			</MvIF>
			
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update( Affiliates.d.id, g.Affiliate_Code, g.Affiliate_Password, g.Affiliate_LostPass_Email, g.Affiliate_SiteName, g.Affiliate_SiteURL, g.Affiliate_ContactName, g.Affiliate_Email, g.Affiliate_Company, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_Zip, g.Affiliate_Country, g.Affiliate_Hits, g.Affiliate_Percent, g.Affiliate_Flat, g.Affiliate_Status, g.Affiliate_StatusBy ) }">

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
			<MvWHILE EXPR = "{ l.ok AND l.found }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
				<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_BatchEdit_Update( Affiliates.d.id ) }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
			</MvWHILE>

			<MvASSIGN NAME = "l.modified" VALUE = "1">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.can_delete AND ( NOT len( g.Edit_Affiliate ) ) }">
		<MvASSIGN NAME = "l.affiliate" VALUE = 1>
		<MvWHILE EXPR = "{ l.ok AND ( l.affiliate LE g.Affiliate_Count ) }">
			<MvIF EXPR = "{ g.Affiliate_Remove[ l.affiliate ] }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Affiliate[ l.affiliate ] ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
					<MvWHILE EXPR = "{ l.ok AND l.found }">
						<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
						<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
							<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_Delete( Affiliates.d.id ) }">
						</MvIF>

						<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
					</MvWHILE>

					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_earnings" VALUE = "{ Affiliate_Clean_Earnings( Affiliates.d.id ) }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_sessions" VALUE = "{ Affiliate_Delete_Session( Affiliates.d.code ) }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_affiliate" VALUE = "{ Affiliates_Delete( Affiliates.d.id ) }">

					<MvASSIGN NAME = "l.modified" VALUE = "1">
				</MvIF>
			</MvIF>
			<MvASSIGN NAME = "l.affiliate" VALUE = "{ l.affiliate + 1 }">
		</MvWHILE>
	</MvIF>
	
	<MvIF EXPR = "{ l.ok AND l.can_delete_money }">
		<MvASSIGN NAME = "l.affiliate" VALUE = 1>
		<MvWHILE EXPR = "{ l.ok AND ( l.affiliate LE g.AffiliatePayouts_Count ) }">
			<MvIF EXPR = "{ g.AffiliatePayouts_Remove[ l.affiliate ] }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayout_Delete( g.AffiliatePayouts_ID[ l.affiliate ] ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_Find_PayoutID( AffiliatePayouts.d.id ) }">
					<MvWHILE EXPR = "{ l.found }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete" VALUE = "{ AffiliateEarnings_Delete( AffiliateEarnings.d.id ) }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_FindNext_PayoutID( AffiliatePayouts.d.id ) }">
					</MvWHILE>
				</MvIF>
				<MvASSIGN NAME = "l.modified" VALUE = "1">
			</MvIF>

			<MvASSIGN NAME = "l.affiliate" VALUE = "{ l.affiliate + 1 }">
		</MvWHILE>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND l.valid }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
		<MvWHILE EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
			<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_valid" VALUE = "{ Module_Affiliates_Validate() }">
				<MvIF EXPR = "{ NOT l.module_valid }">
					<MvASSIGN NAME = "l.invalid_module" VALUE = "1">
				</MvIF>
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
		</MvWHILE>

		<MvIF EXPR = "{ NOT l.invalid_module }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
			<MvWHILE EXPR = "{ l.ok AND l.found }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
				<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliates_Update() }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
			</MvWHILE>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ l.ok AND l.valid AND NOT l.invalid_module }">
		<MvIF EXPR = "{ l.modified }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00053">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate Configuration updated</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
		<MvELSE>
			<MvASSIGN NAME = "g.Message" VALUE = "">
		</MvIF>

		<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Update">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'AFLT', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete_money" VALUE = "{ CanI( 'MONY', 0, 0, 0, 1 ) }">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Edit_Affiliate ) }">
	<MvASSIGN NAME = "l.valid" VALUE = "{ Affiliate_Validate() }">

	<MvIF EXPR = "{ l.valid AND l.ok }">
		<MvIF EXPR = "{ l.can_modify }">
			<MvIF EXPR = "{ g.Edit_Affiliate }">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.foo" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">

				<MvIF EXPR = "{ l.foo }">
					<MvASSIGN NAME = "g.Affiliate_StatusBy" VALUE = "{ g.Admin_User_ID }">
				<MvELSE>
					<MvASSIGN NAME = "g.Affiliate_StatusBy" VALUE = "">
				</MvIF>

				<MvIF EXPR = "{ Affiliates.d.code NE g.Affiliate_Code }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.update_session" VALUE = "{ Affiliate_Find_SessionCode( Affiliates.d.code, g.Affiliate_Code ) }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update( Affiliates.d.id, g.Affiliate_Code, g.Affiliate_Password, g.Affiliate_LostPass_Email, g.Affiliate_SiteName, g.Affiliate_SiteURL, g.Affiliate_ContactName, g.Affiliate_Email, g.Affiliate_Company, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_Zip, g.Affiliate_Country, g.Affiliate_Hits, g.Affiliate_Percent, g.Affiliate_Flat, g.Affiliate_Status, g.Affiliate_StatusBy ) }">
				<MvASSIGN NAME = "l.modified" VALUE = "1">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.ok AND l.can_delete_money }">
			<MvASSIGN NAME = "l.affiliate" VALUE = 1>
			<MvWHILE EXPR = "{ l.ok AND ( l.affiliate LE g.AffiliateEarnings_Count ) }">
				<MvIF EXPR = "{ g.AffiliateEarnings_Remove[ l.affiliate ] }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEarnings_Delete( g.AffiliateEarnings_ID[ l.affiliate ] ) }">
					<MvASSIGN NAME = "l.modified" VALUE = "1">
				</MvIF>

				<MvASSIGN NAME = "l.affiliate" VALUE = "{ l.affiliate + 1 }">
			</MvWHILE>
		</MvIF>

		<MvIF EXPR = "{ l.ok AND l.can_modify }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00054">
				<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ encodeentities( g.Edit_Affiliate ) }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate '%code%' updated</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ g.Affiliate_Code }">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
			<MvWHILE EXPR = "{ l.ok AND l.found }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
				<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
					<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_Update( Affiliates.d.id ) }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
			</MvWHILE>
		</MvIF>
	</MvIF>	

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_AffiliateEarningsVoid_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify_money" VALUE = "{ CanI( 'MONY', 0, 0, 1, 0 ) }">

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">

	<MvIF EXPR = "{ l.ok AND l.can_modify_money }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliateEarnings_Void_Validate() }">
		<MvIF EXPR = "{ l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_ID( g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ AffiliateEarningsVoid_Update( g.Edit_AffiliateEarnings, g.AffiliateEarnings_Void, g.AffiliateEarnings_VoidReas, g.Admin_User_ID ) }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.update" VALUE = "{ AffiliateVoid_Balance_Update( AffiliateEarnings.d.aff_id, g.AffiliateEarnings_Void, g.Old_AffiliateEarnings_Void ) }">

				<MvASSIGN NAME = "l.modified" VALUE = "1">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND l.can_modify_money AND l.valid }">
		<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00055">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Transaction updated</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_AffiliatePayouts_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.valid" VALUE = "1">
	<MvASSIGN NAME = "l.modified" VALUE = "0">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify_money" VALUE = "{ CanI( 'MONY', 0, 0, 1, 0 ) }">
	
	<MvIF EXPR = "{ l.ok AND l.can_modify_money }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AffiliatePayouts_Validate() }">
		<MvIF EXPR = "{ l.valid }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Find_ID( g.Edit_AffiliatePayouts ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvIF EXPR = "{ g.AffiliatePayouts_Void AND ( NOT g.Old_AffiliatePayouts_Void ) }">
					<MvASSIGN NAME = "g.AffiliatePayouts_VoidUser" VALUE = "{ g.Admin_User_ID }">
					<MvASSIGN NAME = "g.AffiliatePayouts_VoidTime" VALUE = "{ s.time_t }">
				<MvELSE>
					<MvASSIGN NAME = "g.AffiliatePayouts_VoidUser" VALUE = "{ AffiliatePayouts.d.void_by }">
					<MvASSIGN NAME = "g.AffiliatePayouts_VoidTime" VALUE = "{ AffiliatePayouts.d.void_date }">
				</MvIF>
				
				<MvIF EXPR = "{ g.AffiliatePayouts_Processed AND ( NOT g.Old_AffiliatePayouts_Processed ) }">
					<MvASSIGN NAME = "g.AffiliatePayouts_ProcessedBy" VALUE = "{ g.Admin_User_ID }">
					<MvASSIGN NAME = "g.AffiliatePayouts_ProcessedTime" VALUE = "{ s.time_t }">
				<MvELSE>
					<MvASSIGN NAME = "g.AffiliatePayouts_ProcessedBy" VALUE = "">
					<MvASSIGN NAME = "g.AffiliatePayouts_ProcessedTime" VALUE = "">
				</MvIF>

				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayoutsVoid_Update( g.Edit_AffiliatePayouts, g.AffiliatePayouts_Processed, g.AffiliatePayouts_ProcessedBy, g.AffiliatePayouts_ProcessedTime, g.AffiliatePayouts_Void, g.AffiliatePayouts_VoidReas, g.AffiliatePayouts_VoidTime, g.AffiliatePayouts_VoidUser ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_Find_PayoutID( g.Edit_AffiliatePayouts ) }">
					<MvWHILE EXPR = "{ l.found }">
						<MvASSIGN NAME = "l.void" VALUE = "{ AffiliateEarnings.d.void }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayout_VoidEarnings_Update( g.AffiliatePayouts_Void, g.AffiliatePayouts_VoidReas, g.Admin_User_ID ) }">

						<MvIF EXPR = "{ ( ( g.AffiliatePayouts_Void ) AND ( NOT l.void ) ) OR ( ( NOT g.AffiliatePayouts_Void ) AND ( l.void ) ) }">
							<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.update" VALUE = "{ AffiliateVoid_Balance_Update( AffiliateEarnings.d.aff_id, g.AffiliatePayouts_Void, g.Old_AffiliatePayouts_Void ) }">
						</MvIF>

						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_FindNext_PayoutID( g.Edit_AffiliatePayouts ) }">
					</MvWHILE>
				</MvIF>

				<MvASSIGN NAME = "l.modified" VALUE = "1">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok AND l.can_modify_money AND l.valid }">
		<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00056">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate Payout updated</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Delete
|
</MvCOMMENT>

<MvFUNCTION NAME = "Action_Affiliate_Delete">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'AFLT', 0, 0, 0, 1 ) }">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Edit_Affiliate ) }">
	<MvIF EXPR = "{ l.ok AND l.can_delete }">
		<MvASSIGN NAME = "l.affi_code" VALUE = "{ Affiliates.d.code }">
		<MvASSIGN NAME = "l.affi_id" VALUE = "{ Affiliates.d.id }">

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliate_FindNext_AffiliateOrder( l.affi_code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliate_FindPrev_AffiliateOrder( l.affi_code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
			<MvELSE>
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "">
				<MvASSIGN NAME = "g.Edit_Item" VALUE = "">
				<MvASSIGN NAME = "g.Tab" VALUE = "">
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_earnings" VALUE = "{ Affiliate_Clean_Earnings( l.affi_id ) }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_sessions" VALUE = "{ Affiliate_Delete_Session( l.affi_code ) }">

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.delete_affiliate" VALUE = "{ Affiliates_Delete( l.affi_id ) }">
		<MvIF EXPR = "{ l.delete_affiliate }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00057">
				<MvLOCALIZED-TOKEN NAME = "affiliate" VALUE = "{ encodeentities( l.affi_code ) }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate '%affiliate%' deleted</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
		<MvWHILE EXPR = "{ l.ok AND l.found }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
			<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_Delete( l.affi_id ) }">
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
		</MvWHILE>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_AffiliatePayouts_Delete" STANDARDOUTPUTLEVEL = "">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'MONY', 0, 0, 0, 1 ) }">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Find_ID( g.Edit_AffiliatePayouts ) }">
	<MvIF EXPR = "{ l.ok AND l.can_delete }">
		<MvASSIGN NAME = "l.payo_id" VALUE = "{ AffiliatePayouts.d.id }">
		
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayout_Delete( AffiliatePayouts.d.id ) }">
		<MvIF EXPR = "{ l.ok }">
			<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00058">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate Payout deleted</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvASSIGN NAME = "g.Edit_AffiliatePayouts" VALUE = "">
			<MvASSIGN NAME = "g.Screen" VALUE = "AFAP">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Other Affiliate Actions
|
</MvCOMMENT>

<MvFUNCTION NAME = "AffiliatePayout_Check" PARAMETERS = "payout">
	<MvASSIGN NAME = "l.ok" VALUE = 0>
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.open" VALUE = "{ AffiliateOptions_Find() }">
	
	<MvIF EXPR = "{ ( l.payout GE AffiliateOptions.d.pay_thresh ) AND ( l.payout GT '0.01' ) }">
		<MvASSIGN NAME = "l.ok" VALUE = 1>
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_PayoutNow" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Edit_Affiliates ) }">

	<MvIF EXPR = "{ ( Affiliates.d.status EQ 'Approved' ) AND ( l.ok ) }">
		<MvASSIGN NAME = "l.payout" VALUE = "{ int( Affiliates.d.balance * 100 ) / 100 }">
		<MvIF EXPR = "{ AffiliatePayout_Check( l.payout ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.payout_id" VALUE = "{ AffiliatePayouts_Insert( g.Admin_User_ID ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEarnings_Insert( Affiliates.d.id, 'payout', '', '', '', l.payout * -1, l.payout_id, '' ) }">

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ AffiliateLast_Payout_Update( Affiliates.d.id, l.payout, l.payout_id, s.time_t ) }">
				<MvIF EXPR = "{ l.foo }">
					<MvASSIGN NAME = "g.Edit_AffiliatePayouts" VALUE = "{ l.payout_id }">
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvLOCALIZED NAME = "g.Message" ID = "MER-AFF-00059">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">No Payout Records Currently Exist</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvASSIGN NAME = "g.Screen" VALUE = "BLNK">
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Update( l.payout_id, '1', l.payout ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Payout" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.count" VALUE = "0">
	<MvASSIGN NAME = "l.amount" VALUE = "0">
	<MvASSIGN NAME = "l.payout_id" VALUE = "0">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.affiliate_found" VALUE = "{ Affiliates_FindFirst() }">
		<MvWHILE EXPR = "{ l.affiliate_found }">
			<MvIF EXPR = "{ Affiliates.d.status EQ 'Approved' }">
				<MvASSIGN NAME = "l.payout" VALUE = "{ int( Affiliates.d.balance * 100 ) / 100 }">
				<MvIF EXPR = "{ AffiliatePayout_Check( l.payout ) }">
					<MvIF EXPR = "{ l.payout_id EQ '0' }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.payout_id" VALUE = "{ AffiliatePayouts_Insert( g.Admin_User_ID ) }">
					</MvIF>

					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEarnings_Insert( Affiliates.d.id, 'payout', '', '', '', l.payout * -1, l.payout_id, '' ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ AffiliateLast_Payout_Update( Affiliates.d.id, l.payout, l.payout_id, s.time_t ) }">	
						<MvIF EXPR = "{ l.foo }">
							<MvASSIGN NAME = "l.count" value = "{ l.count + 1 }">
							<MvASSIGN NAME = "l.amount" value = "{ l.amount + l.payout }">
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ l.ok }">
						<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Update( l.payout_id, l.count, l.amount ) }">
						<MvASSIGN NAME = "g.Edit_AffiliatePayouts" VALUE = "{ l.payout_id }">
					</MvIF>
				</MvIF>	
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.affiliate_found" VALUE = "{ Affiliates_FindNext() }">
			</MvIF>
		</MvWHILE>
	</MvIF>

	<MvASSIGN NAME = "g.Screen" VALUE = "AFPO">

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Screens
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_money" 	VALUE = "{ CanI( 'MONY', 1, 0, 0, 0 ) }">
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" 		VALUE = "{ CanI( 'AFLT', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" 	VALUE = "{ CanI( 'AFLT', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" 	VALUE = "{ CanI( 'AFLT', 0, 0, 0, 1 ) }">

	<MvIF EXPR = "{ g.Load_Fields }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "g.AffiliateOptions_Activated" VALUE = "{ AffiliateOptions.d.active }">
			<MvASSIGN NAME = "g.AffiliateOptions_Signup" VALUE = "{ AffiliateOptions.d.signup }">
			<MvASSIGN NAME = "g.AffiliateOptions_Hits" VALUE = "{ AffiliateOptions.d.hits }">
			<MvASSIGN NAME = "g.AffiliateOptions_Percent" VALUE = "{ AffiliateOptions.d.percent }">
			<MvASSIGN NAME = "g.AffiliateOptions_PercentSelect" VALUE = "{ AffiliateOptions.d.pct_slt }">
			<MvASSIGN NAME = "g.AffiliateOptions_Flat" VALUE = "{ AffiliateOptions.d.flat}">
			<MvASSIGN NAME = "g.AffiliateOptions_PayoutThreshold" VALUE = "{ AffiliateOptions.d.pay_thresh }">
			<MvASSIGN NAME = "g.AffiliateOptions_LinkImage" VALUE = "{ AffiliateOptions.d.link_image }">
			<MvASSIGN NAME = "g.AffiliateOptions_LinkText" VALUE = "{ AffiliateOptions.d.link_text }">
			<MvASSIGN NAME = "g.AffiliateOptions_Terms" VALUE = "{ AffiliateOptions.d.terms }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEmail_Load() }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "g.AffiliateEmail_From" VALUE = "{ AffiliateEmail.d.from }">
			<MvASSIGN NAME = "g.AffiliateEmail_CC" VALUE = "{ AffiliateEmail.d.cc }">
			<MvASSIGN NAME = "g.AffiliateEmail_Subject" VALUE = "{ AffiliateEmail.d.subject }">
			<MvASSIGN NAME = "g.AffiliateEmail_Header" VALUE = "{ AffiliateEmail.d.header }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateManage_EmailLoad() }">
		<MvIF EXPR = "{ l.ok }">
			<MvASSIGN NAME = "g.EmailAffiliates_Activated" VALUE = "{ AffiliateManage.d.active }">
			<MvASSIGN NAME = "g.EmailAffiliates_UseTo" VALUE = "{ AffiliateManage.d.useto }">
			<MvASSIGN NAME = "g.EmailAffiliates_To" VALUE = "{ AffiliateManage.d.to }">
			<MvASSIGN NAME = "g.EmailAffiliates_UseFrom" VALUE = "{ AffiliateManage.d.usefrom }">
			<MvASSIGN NAME = "g.EmailAffiliates_From" VALUE = "{ AffiliateManage.d.from }">
			<MvASSIGN NAME = "g.EmailAffiliates_UseCC" VALUE = "{ AffiliateManage.d.usecc }">
			<MvASSIGN NAME = "g.EmailAffiliates_CC" VALUE = "{ AffiliateManage.d.cc }">
			<MvASSIGN NAME = "g.EmailAffiliates_Subject" VALUE = "{ AffiliateManage.d.subject }">
			<MvASSIGN NAME = "g.EmailAffiliates_Header" VALUE = "{ AffiliateManage.d.header }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ NOT g.Have_List_Fields }">
		<MvASSIGN NAME = "g.Affiliate_Stack" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Search" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Offset" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Display" VALUE = "{ g.Admin_User_PageLen }">

		<MvASSIGN NAME = "g.AffiliatePayouts_Stack" VALUE = "">
		<MvASSIGN NAME = "g.AffiliatePayouts_Search" VALUE = "">
		<MvASSIGN NAME = "g.AffiliatePayouts_Show" VALUE = "All">
		<MvASSIGN NAME = "g.AffiliatePayouts_Offset" VALUE = 0>
		<MvASSIGN NAME = "g.AffiliatePayouts_Display" VALUE = "{ g.Admin_User_PageLen }">

		<MvASSIGN NAME = "g.Affiliate_Show_Code" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_SiteName" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_Hits" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_Percent" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_Flat" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_SiteURL" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_ContactName" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Email" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Phone" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Fax" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Company" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Address" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_City" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_State" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Zip" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Country" VALUE = "Yes">
		<MvASSIGN NAME = "g.Affiliate_Show_Balance" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_Status" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_StatusDate" VALUE = "">
		<MvASSIGN NAME = "g.Affiliate_Show_StatusBy" VALUE = "">
	<MvELSE>
		<MvASSIGN NAME = "g.Affiliate_Display" VALUE = "{ int( g.Affiliate_Display ) }">
		<MvIF EXPR = "{ g.Affiliate_Display LT 1 }">
			<MvASSIGN NAME = "g.Affiliate_Display" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "l.valid" VALUE = "{ Affiliate_Display_Validate() }">

	<MvIF EXPR = "{ g.Affiliate_Display_Flag }">
		<MvASSIGN NAME = "g.Affiliate_Show_Code" VALUE = "Yes">
	</MvIF>

	<MvLOCALIZED NAME = "l.screen_label" ID = "MER-AFF-00060">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliate Configuration</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" 	VALUE = "{ BeginScreen( l.screen_label, 'AFLT', 'Help:aflt.html' ) }">	

	<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = "1">

	<MvLOCALIZED NAME = "l.tab_list" ID = "MER-AFF-00061">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">AFLT:Options,AFLP:Lost Password Email,AFAF:Affiliates,AFME:Affiliate Email Notification</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvIF EXPR = "{ l.can_view_money }">
		<MvLOCALIZED NAME = "l.more_tabs" ID = "MER-AFF-00062">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">PAYO:Payouts</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
	
		<MvASSIGN NAME = "l.tab_list" VALUE = "{ l.tab_list $ ',' $ l.more_tabs }">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_tabs" VALUE = "{ Module_Affiliates_Tabs() }">
			<MvIF EXPR = "{ len( l.module_tabs ) }">
				<MvASSIGN NAME = "l.tab_list" VALUE = "{ l.tab_list $ ',' $ l.module_tabs }">
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
	</MvWHILE>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.tabs" VALUE = "{ DrawTabs( 'AFLT', l.tab_list ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin_content" VALUE = "{ BeginContent() }">

	<SCRIPT LANGUAGE = "JavaScript">
<!--
function EditAffiliate( affil_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Edit_Affiliate' ].value = unescape( affil_code );
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

//-->
	</SCRIPT>

	<INPUT TYPE = "hidden" NAME = "Edit_Affiliate" VALUE = "{ encodeentities( g.Edit_Affiliate ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" VALUE = "{ CanI( 'AFLT', 0, 1, 0 ,0 ) }"> 
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'AFLT', 0, 0, 1 ,0 ) }"> 
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'AFLT', 0, 0, 0 ,1 ) }"> 

	<MvEVAL EXPR = "{ Screen_AffiliateOptions_AFLT_Tab( l.can_add, l.can_modify, l.can_delete ) }">
	<MvEVAL EXPR = "{ Screen_AffiliateOptions_AFLP_Tab( l.can_add, l.can_modify, l.can_delete ) }">
	<MvEVAL EXPR = "{ Screen_AffiliateOptions_AFAF_Tab( l.can_add, l.can_modify, l.can_delete ) }">
	<MvEVAL EXPR = "{ Screen_AffiliateOptions_AFME_Tab( l.can_add, l.can_modify, l.can_delete ) }">
	<MvEVAL EXPR = "{ Screen_AffiliateOptions_PAYO_Tab( l.can_add, l.can_modify, l.can_delete ) }">

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliates_Content( g.Tab, g.Load_Fields ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
	</MvWHILE>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end_content" VALUE = "{ EndContent() }">

	<MvIF EXPR = "{ l.can_modify }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( 'AAFU:[UPDATE]' ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( '' ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end_screen" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Options Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions_AFLT_Tab" PARAMETERS = "can_add, can_modify, can_delete">
	<MvIF EXPR = "{ g.Tab EQ 'AFLT' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			&nbsp;
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00063">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Activate Affiliate Program</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.AffiliateOptions_Activated, 'AffiliateOptions_Activated', 'Yes', l.text ) }">

			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00064"><B>
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Default Application Status:</MvLOCALIZED-TEXT>
			</MvLOCALIZED></B>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<SELECT NAME = "AffiliateOptions_Signup">
				<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00065">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pending</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'R', g.AffiliateOptions_Signup, l.option ) }">

				<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00066">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Approved</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'A', g.AffiliateOptions_Signup, l.option ) }">

				<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00067">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Disabled</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'I', g.AffiliateOptions_Signup, l.option ) }">
				</SELECT>
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00068"><B>
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Default Commission Per Referral (hit):</MvLOCALIZED-TEXT>
			</MvLOCALIZED></B>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateOptions_Hits" VALUE = "{ encodeentities( g.AffiliateOptions_Hits ) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00069"><B>
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Default Commission Percent of Order:</MvLOCALIZED-TEXT>
			</MvLOCALIZED></B>
			</FONT>
		</TD><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateOptions_Percent" VALUE = "{ encodeentities( g.AffiliateOptions_Percent ) }">

				<SELECT NAME = "AffiliateOptions_PercentSelect">
				<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00347">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Entire Order</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'O', g.AffiliateOptions_PercentSelect, l.option ) }">

				<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00348">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Subtotal</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'S', g.AffiliateOptions_PercentSelect, l.option ) }">
				</SELECT>
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00070"><B>
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Default Commission Flat Fee Per Order:</MvLOCALIZED-TEXT>
			</MvLOCALIZED></B>
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateOptions_Flat" VALUE = "{ encodeentities( g.AffiliateOptions_Flat ) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00071"><B>
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Threshold:</MvLOCALIZED-TEXT>
			</MvLOCALIZED></B>
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateOptions_PayoutThreshold" VALUE = "{ encodeentities( g.AffiliateOptions_PayoutThreshold ) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00072">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Link Image:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "AffiliateOptions_LinkImage" VALUE = "{ encodeentities( g.AffiliateOptions_LinkImage ) }">
			<A HREF = "JavaScript:PopupFileUpload( 'Image', '', 'AffiliateOptions_LinkImage' );">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Upload(0) }"><MvEVAL EXPR = "{ l.button }"></A>
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00073">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Link Text:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "AffiliateOptions_LinkText" VALUE = "{ encodeentities( g.AffiliateOptions_LinkText ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00074">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Terms:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<TEXTAREA NAME = "AffiliateOptions_Terms" ROWS = 10 COLS = 58 WRAP = "off"><MIVA STANDARDOUTPUTLEVEL = "text, html"><MvEVAL EXPR = "{ encodeentities( g.AffiliateOptions_Terms ) }"><MIVA STANDARDOUTPUTLEVEL = "text, html, compresswhitespace"></TEXTAREA>
			</FONT>
		</TD></TR>

		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.AffiliateOptions_Activated, g.AffiliateOptions_Signup, g.AffiliateOptions_Hits, g.AffiliateOptions_Percent, g.AffiliateOptions_PercentSelect, g.AffiliateOptions_Flat, g.AffiliateOptions_PayoutThreshold, g.AffiliateOptions_Terms, g.AffiliateOptions_LinkImage, g.AffiliateOptions_LinkText, g.AffiliateOptions_ApplicationEmailSend, g.AffiliateOptions_ApplicationEmailSubject, g.AffiliateOptions_ApplicationEmailText, g.AffiliateOptions_AcceptanceEmailSend, g.AffiliateOptions_AcceptanceEmailSubject, g.AffiliateOptions_AcceptanceEmailText, g.AffiliateOptions_RejectionEmailSend, g.AffiliateOptions_RejectionEmailSubject, g.AffiliateOptions_RejectionEmailText">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Lost Passwords Email Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions_AFLP_Tab" PARAMETERS = "can_add, can_modify, can_delete" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'AFLP' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00075">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US"><B>From:</B></MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "AffiliateEmail_From" VALUE = "{ encodeentities( g.AffiliateEmail_From) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00076">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">CC:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "AffiliateEmail_CC" VALUE = "{ encodeentities( g.AffiliateEmail_CC ) }">
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00077">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US"><B>Subject:</B></MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "AffiliateEmail_Subject" VALUE = "{ encodeentities( g.AffiliateEmail_Subject ) }">
			</FONT>
			<BR>
		</TD></TR>

		<TR><TD VALIGN = "top">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00078">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Header Text (Precedes Account Information):</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MIVA STANDARDOUTPUTLEVEL = "text, html"><TEXTAREA NAME = "AffiliateEmail_Header" ROWS = 10 COLS = 58 WRAP = "off"><MvEVAL EXPR = "{ encodeentities( g.AffiliateEmail_Header ) }"></TEXTAREA><MIVA STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<INPUT TYPE = "hidden" NAME = "AffiliateEmail_From" VALUE = "{ encodeentities( g.AffiliateEmail_From ) }">
		<INPUT TYPE = "hidden" NAME = "AffiliateEmail_CC" VALUE = "{ encodeentities( g.AffiliateEmail_CC ) }">
		<INPUT TYPE = "hidden" NAME = "AffiliateEmail_Subject" VALUE = "{ encodeentities( g.AffiliateEmail_Subject ) }">
		<INPUT TYPE = "hidden" NAME = "AffiliateEmail_Header" VALUE = "{ encodeentities( g.AffiliateEmail_Header ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate BatchEdit Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions_AFAF_Tab" PARAMETERS = "can_add, can_modify, can_delete" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'AFAF' }">
		<MvASSIGN NAME = "l.columns" VALUE = 0>

		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR><TD>
				&nbsp;
			</TD><TD ALIGN = "right" VALIGN = "middle">
				&nbsp;
			</TD><TD>
				&nbsp;
			</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00079">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B>
				<MvASSIGN NAME = "g.Affiliate_Search" VALUE = "{ ltrim( rtrim( g.Affiliate_Search ) ) }">
				<INPUT TYPE = "text" NAME = "Affiliate_Search" VALUE = "{ encodeentities( g.Affiliate_Search ) }" SIZE = 20>
				<A HREF = "JavaScript:ListReload( 'Affiliate_Offset', 'Affiliate_Stack' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Search(0) }"><MvEVAL EXPR = "{ l.button }"></A>							
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "top">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00080">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Display:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" COLSPAN = 3>
				<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00081">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Code, 'Affiliate_Show_Code', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00082">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_SiteName, 'Affiliate_Show_SiteName', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00083">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_SiteURL, 'Affiliate_Show_SiteURL', 'Yes', l.text ) }">
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00084">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_ContactName, 'Affiliate_Show_ContactName', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00085">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Company, 'Affiliate_Show_Company', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00086">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Email, 'Affiliate_Show_Email', 'Yes', l.text ) }">
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00087">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Phone, 'Affiliate_Show_Phone', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00088">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Fax, 'Affiliate_Show_Fax', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00089">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Address, 'Affiliate_Show_Address', 'Yes', l.text ) }">
						</FONT>
					</TD></TR>

					<TR>
					<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
						<TD ALIGN = "left">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00090">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Zip, 'Affiliate_Show_Zip', 'Yes', l.text ) }">
							</FONT>
						</TD>
					</MvIF>

					<TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00091">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">City</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_City, 'Affiliate_Show_City', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00092">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">State</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_State, 'Affiliate_Show_State', 'Yes', l.text ) }">
						</FONT>
					</TD>

					<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">
						<TD ALIGN = "left">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00093">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Zip, 'Affiliate_Show_Zip', 'Yes', l.text ) }">
							</FONT>
						</TD>
					</MvIF>			
					</TR>

					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00094">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Country, 'Affiliate_Show_Country', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00095">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Hits</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Hits, 'Affiliate_Show_Hits', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00096">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Percent, 'Affiliate_Show_Percent', 'Yes', l.text ) }">
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00097">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Flat</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Flat, 'Affiliate_Show_Flat', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00098">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Balance</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Balance, 'Affiliate_Show_Balance', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00099">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Status, 'Affiliate_Show_Status', 'Yes', l.text ) }">
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00100">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status Date</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_StatusDate, 'Affiliate_Show_StatusDate', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00101">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status By</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_StatusBy, 'Affiliate_Show_StatusBy', 'Yes', l.text ) }">
						</FONT>
					</TD><TD ALIGN = "left">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						&nbsp;
						</FONT>
					</TD></TR>
				</TABLE>
			</TD></TR>
		</TABLE>

		<MvASSIGN NAME = "l.columns" VALUE = 0>

		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR>
			<MvIF EXPR = "{ len( g.Edit_Affiliate ) EQ 0 AND l.can_delete }">
				<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00102">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
					<BR>
					<MvLOCALIZED NAME = "l.check_all" ID = "MER-AFF-00339">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<MvLOCALIZED NAME = "l.uncheck_all" ID = "MER-AFF-00340">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Uncheck All</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<A HREF = "JavaScript:CheckAll( 'Affiliate_Remove', 1 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'checkall.gif' }" ALT = "{ l.check_all }"></A>
					&nbsp;
					<A HREF = "JavaScript:CheckAll( 'Affiliate_Remove', 0 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'uncheckall.gif' }" ALT = "{ l.uncheck_all }"></A>
				</TD>

				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Code }">
				<TD BGCOLOR = "#000080">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00103">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>

				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_SiteName }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00104">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_SiteURL }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00105">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_ContactName }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00106">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Company }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00107">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Email }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00108">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Phone }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00109">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Fax }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00110">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Address }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00111">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
				<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
					<TD BGCOLOR = "#000080" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
						<MvLOCALIZED ID = "MER-AFF-00112">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</B></FONT>
					</TD>
					<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_City }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00113">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">City</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_State }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00114">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">State</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">
				<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
					<TD BGCOLOR = "#000080" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
						<MvLOCALIZED ID = "MER-AFF-00115">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</B></FONT>
					</TD>
					<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Country }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00116">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Hits }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00117">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Hits</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Percent }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00118">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Percent</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Flat }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00119">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Flat</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Balance }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00120">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Balance</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_Status }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00121">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_StatusDate }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00122">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status Date</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<MvIF EXPR = "{ g.Affiliate_Show_StatusBy }">
				<TD BGCOLOR = "#000080" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00123">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Status By</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>

			<TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
					<MvIF EXPR = "{ l.can_add }">
						<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00124">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Affiliate</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<A HREF = "{ g.sessionurl $ 'Screen=AFIF&Store_Code=' $ encodeattribute( g.Store_Code ) }">
						<IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'new.gif' }"></A>
					<MvELSE>
						&nbsp;
					</MvIF>
				</FONT>
			</TD></TR>

			<MvASSIGN NAME = "l.shown" VALUE = 0>
			<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ Affiliates_FindOffset_All( g.Affiliate_Offset, g.Affiliate_Search ) }">
			<MvWHILE EXPR = "{ ( l.shown LT g.Affiliate_Display ) AND l.nextoffset }">
				<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

				<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
				<MvELSE>
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
				</MvIF>

				<TR>

				<MvIF EXPR = "{ ( len( g.Edit_Affiliate ) NE 0 ) AND
								( g.Edit_Affiliate EQ Affiliates.d.code ) AND l.can_modify }">
					<MvIF EXPR = "{ NOT g.Data_Entry_Error }">

						<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "{ Affiliates.d.code }">
						<MvASSIGN NAME = "g.Affiliate_SiteName" VALUE = "{ Affiliates.d.site_name }">
						<MvASSIGN NAME = "g.Affiliate_ContactName" VALUE = "{ Affiliates.d.con_name }">
						<MvASSIGN NAME = "g.Affiliate_Hits" VALUE = "{ Affiliates.d.hits }">
						<MvASSIGN NAME = "g.Affiliate_Percent" VALUE = "{ Affiliates.d.percent }">
						<MvASSIGN NAME = "g.Affiliate_Flat" VALUE = "{ Affiliates.d.flat }">
						<MvASSIGN NAME = "g.Affiliate_SiteURL" VALUE = "{ Affiliates.d.site_url }">
						<MvASSIGN NAME = "g.Affiliate_Email" VALUE = "{ Affiliates.d.email }">
						<MvASSIGN NAME = "g.Affiliate_Phone" VALUE = "{ Affiliates.d.phone }">
						<MvASSIGN NAME = "g.Affiliate_Fax" VALUE = "{ Affiliates.d.fax }">
						<MvASSIGN NAME = "g.Affiliate_Company" VALUE = "{ Affiliates.d.company }">
						<MvASSIGN NAME = "g.Affiliate_Address" VALUE = "{ Affiliates.d.addr }">
						<MvASSIGN NAME = "g.Affiliate_City" VALUE = "{ Affiliates.d.city }">
						<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ Affiliates.d.state }">
						<MvASSIGN NAME = "g.Affiliate_Zip" VALUE = "{ Affiliates.d.zip }">
						<MvASSIGN NAME = "g.Affiliate_Country" VALUE = "{ Affiliates.d.cntry }">
						<MvASSIGN NAME = "g.Affiliate_Status" VALUE = "{ Affiliates.d.status }">
						<MvASSIGN NAME = "g.Affiliate_LostPass_Email" VALUE = "{ Affiliates.d.lpasseml }">
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Code }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Code" VALUE = "{ encodeentities( g.Affiliate_Code ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_SiteName }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_SiteName" VALUE = "{ encodeentities( g.Affiliate_SiteName ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_SiteURL }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_SiteURL" VALUE = "{ encodeentities( g.Affiliate_SiteURL ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_ContactName }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_ContactName" VALUE = "{ encodeentities( g.Affiliate_ContactName ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Company }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Company" VALUE = "{ encodeentities( g.Affiliate_Company ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Email }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Email" VALUE = "{ encodeentities( g.Affiliate_Email ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Phone }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Phone" VALUE = "{ encodeentities( g.Affiliate_Phone ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Fax }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Fax" VALUE = "{ encodeentities( g.Affiliate_Fax ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Address }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Address" VALUE = "{encodeentities( g.Affiliate_Address ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
						<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
							<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" NAME = "Affiliate_Zip" VALUE = "{ encodeentities( g.Affiliate_Zip ) }" SIZE = 15 ONCHANGE = "SetModified();">
								</FONT>
							</TD>
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_City }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_City" VALUE = "{ encodeentities( g.Affiliate_City ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_State }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_State" VALUE = "{ encodeentities( g.Affiliate_State ) }" SIZE = 15 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">				
						<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
							<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" NAME = "Affiliate_Zip" VALUE = "{ encodeentities( g.Affiliate_Zip ) }" SIZE = 15 ONCHANGE = "SetModified();">
								</FONT>
							</TD>
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Country }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<SELECT NAME = "Affiliate_Country" ONCHANGE = "SetModified();">
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption_SelectOne() }">
							<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Country_FindFirst() }">
							<MvWHILE EXPR = "{ l.found }">
								<MvIF EXPR = "{ Countries.d.alpha EQ g.Affiliate_Country }">
									<OPTION VALUE = "{ encodeentities( Countries.d.alpha ) }" SELECTED><MvEVAL EXPR = "{ encodeentities( Countries.d.name ) }"></OPTION>
								<MvELSE>
									<OPTION VALUE = "{ encodeentities( Countries.d.alpha ) }"><MvEVAL EXPR = "{ encodeentities( Countries.d.name ) }"></OPTION>
								</MvIF>

								<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Country_FindNext() }">
							</MvWHILE>
							</SELECT>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Hits }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Hits" VALUE = "{ encodeentities( g.Affiliate_Hits ) }" SIZE = 5 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Percent }">				
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Percent" VALUE = "{ encodeentities( g.Affiliate_Percent ) }" SIZE = 5 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Flat }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" NAME = "Affiliate_Flat" VALUE = "{ encodeentities( g.Affiliate_Flat ) }" SIZE = 5 ONCHANGE = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Balance }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvEVAL EXPR = "{ encodeentities( Affiliates.d.balance ) }">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Status }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<SELECT NAME = "Affiliate_Status">
							<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00125">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pending</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Pending', g.Affiliate_Status, l.option ) }">

							<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00126">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Approved</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Approved', g.Affiliate_Status, l.option ) }">

							<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00127">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Rejected</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Rejected', g.Affiliate_Status, l.option ) }">
							</SELECT>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_StatusDate }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.status_by ) }">
								<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formatted_date" VALUE = "{ Format_Date( Affiliates.d.status_dt, s.miva_language ) }">
								<MvEVAL EXPR = "{ l.formatted_date }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_StatusBy }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.status_by ) }">
								<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( Affiliates.d.status_by ) }">
								<MvIF EXPR = "{ l.ok }">
									<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
								</MvIF>
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" WIDTH = "100%" NOWRAP>
						<MvIF EXPR = "{ NOT g.Affiliate_Show_Code }">
							<MvHIDE FIELDS = "g.Affiliate_Code">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_SiteName }">
							<MvHIDE FIELDS = "g.Affiliate_SiteName">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_SiteURL }">
							<MvHIDE FIELDS = "g.Affiliate_SiteURL">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_ContactName }">
							<MvHIDE FIELDS = "g.Affiliate_ContactName">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Company }">
							<MvHIDE FIELDS = "g.Affiliate_Company">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Email }">
							<MvHIDE FIELDS = "g.Affiliate_Email">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Phone }">
							<MvHIDE FIELDS = "g.Affiliate_Phone">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Fax }">
							<MvHIDE FIELDS = "g.Affiliate_Fax">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Address }">
							<MvHIDE FIELDS = "g.Affiliate_Address">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_City }">
							<MvHIDE FIELDS = "g.Affiliate_City">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_State }">
							<MvHIDE FIELDS = "g.Affiliate_State">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Zip }">
							<MvHIDE FIELDS = "g.Affiliate_Zip">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Country }">
							<MvHIDE FIELDS = "g.Affiliate_Country">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Hits }">
							<MvHIDE FIELDS = "g.Affiliate_Hits">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Percent }">
							<MvHIDE FIELDS = "g.Affiliate_Percent">
						</MvIF>

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Flat }">
							<MvHIDE FIELDS = "g.Affiliate_Flat">
						</MvIF>

						<MvHIDE FIELDS = "g.Affiliate_Balance">

						<MvIF EXPR = "{ NOT g.Affiliate_Show_Status }">
							<MvHIDE FIELDS = "g.Affiliate_Status">
						</MvIF>

						<MvHIDE FIELDS = "g.Affiliate_StatusDate, g.Affiliate_StatusBy, g.Affiliate_LostPass_Email">

						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<A HREF = "JavaScript:EditAffiliate( '' );">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere(1) }"><MvEVAL EXPR = "{ l.button }"></A>			

						<A HREF = "{ g.sessionurl $ 'Screen=AFIF&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Affiliate=' $ encodeattribute( Affiliates.d.code )  }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Edit(0) }"><MvEVAL EXPR = "{ l.button }"></A>									
						</FONT>
					</TD></TR>
				<MvELSE>
					<MvIF EXPR = "{ len( g.Edit_Affiliate ) EQ 0 AND l.can_delete }">
						<TD VALIGN = "top" ALIGN = "center" BGCOLOR = "{ l.bgcolor }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "hidden" NAME = "{ 'Affiliate[' $ l.shown $ ']' }" VALUE = "{ encodeentities( Affiliates.d.code ) }">
							<INPUT TYPE = "checkbox" NAME = "{ 'Affiliate_Remove[' $ l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Code }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvEVAL EXPR = "{ encodeentities( Affiliates.d.code ) }">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_SiteName }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.site_name ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.site_name ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_SiteURL }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.site_url ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.site_url ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_ContactName }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.con_name ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.con_name ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Company }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.company ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.company ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Email }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.email ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.email ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Phone }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.phone ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.phone ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Fax }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.fax ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.fax ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Address }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.addr ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.addr ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">				
						<MvIF EXPR = "{ g.Affiliate_Show_Zip }">			
							<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.zip ) }">
									<MvEVAL EXPR = "{ encodeentities( Affiliates.d.zip ) }">
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD>
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_City }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.city ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.city ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_State }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.state ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.state ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">				
						<MvIF EXPR = "{ g.Affiliate_Show_Zip }">			
							<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.zip ) }">
									<MvEVAL EXPR = "{ encodeentities( Affiliates.d.zip ) }">
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD>
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Country }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.cntry ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.cntry ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Hits }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.hits ) }">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Percent }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.percent ) ROUND 2 }">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Flat }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.flat ) }">
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Balance }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.balance ) }">
								<MvEVAL EXPR = "{ encodeentities( Affiliates.d.balance ) }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_Status }">			
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.status ) }">
								<MvIF EXPR = "{ Affiliates.d.status EQ 'Pending' }">
									<MvLOCALIZED ID = "MER-AFF-00341">
										<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pending</MvLOCALIZED-TEXT>
									</MvLOCALIZED>					
								<MvELSE>
									<MvIF EXPR = "{ Affiliates.d.status EQ 'Approved' }">			
										<MvLOCALIZED ID = "MER-AFF-00342">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Approved</MvLOCALIZED-TEXT>
										</MvLOCALIZED>					
									<MvELSE>
										<MvLOCALIZED ID = "MER-AFF-00343">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Rejected</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
									</MvIF>			
								</MvIF>
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_StatusDate }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.status_by ) }">
								<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formatted_date" VALUE = "{ Format_Date( Affiliates.d.status_dt, s.miva_language ) }">
								<MvEVAL EXPR = "{ l.formatted_date }">
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<MvIF EXPR = "{ g.Affiliate_Show_StatusBy }">
						<TD BGCOLOR = "{ l.bgcolor }" VALIGN = "top" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.status_by ) }">
								<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( Affiliates.d.status_by ) }">
								<MvIF EXPR = "{ l.ok }">
									<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
								</MvIF>
							<MvELSE>
								&nbsp;
							</MvIF>
							</FONT>
						</TD>
					</MvIF>

					<TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" NOWRAP WIDTH = "100%">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ l.can_modify }">
							<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00128">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Edit Here</MvLOCALIZED-TEXT>
							</MvLOCALIZED>

							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encoded_method" VALUE = "{ JavaScriptEncode( Affiliates.d.code ) }">
							<A HREF = "{ 'JavaScript:EditAffiliate( \'' $ l.encoded_method $ '\' );' }"><IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'edith.gif' }"></A>
						<MvELSE>
							&nbsp;
						</MvIF>
						<A HREF = "{ g.sessionurl $ 'Screen=AFIF&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Affiliate=' $ encodeattribute( Affiliates.d.code ) }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Edit(0) }">
						<MvEVAL EXPR = "{ l.button }"></A>
						</FONT>
					</TD></TR>
				</MvIF>

				<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ Affiliates_FindNext_All( l.nextoffset, g.Affiliate_Search ) }">
			</MvWHILE>

			<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
				<MvHIDE FIELDS = "g.Affiliate_Stack, g.Affiliate_Offset">
				<MvIF EXPR = "{ l.shown }">
					<B><MvEVAL EXPR = "{ g.Affiliate_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
				<MvELSE>
					<B>0-0</B>
				</MvIF>
				</FONT>
			</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "{ l.columns }">
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
				<MvIF EXPR = "{ len( g.Affiliate_Stack ) }">
					<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'Affiliate_Offset\', \'Affiliate_Stack\' );">' }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Previous(0) }"><MvEVAL EXPR = "{ l.button }"></A>								
				</MvIF>

				 <INPUT TYPE = "text" NAME = "Affiliate_Display" VALUE = "{ encodeentities( g.Affiliate_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'Affiliate_Offset', 'Affiliate_Stack' );">
	 			 <MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Refresh(0) }"><MvEVAL EXPR = "{ l.button }"></A>
				 <INPUT TYPE = "hidden" NAME = "Affiliate_Count" VALUE = "{ encodeentities( l.shown ) }">

				 <MvIF EXPR = "{ l.nextoffset }">
					<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'Affiliate_Offset\', \'Affiliate_Stack\', ' $ l.lastoffset $ ' );">' }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Next(0) }"><MvEVAL EXPR = "{ l.button }"></A>
				 </MvIF>
				</FONT>
			</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Affiliate_Stack, g.Affiliate_Search, g.Affiliate_Offset, g.Affiliate_Display, g.Affiliate_Count, g.Affiliate_Show_Code, g.Affiliate_Show_SiteName, g.Affiliate_Show_ContactName, g.Affiliate_Show_Hits, g.Affiliate_Show_Percent, g.Affiliate_Show_Flat, g.Affiliate_Show_SiteURL, g.Affiliate_Show_Email, g.Affiliate_Show_Phone, g.Affiliate_Show_Fax, g.Affiliate_Show_Company, g.Affiliate_Show_Address, g.Affiliate_Show_City, g.Affiliate_Show_State, g.Affiliate_Show_Zip, g.Affiliate_Show_Country, g.Affiliate_Show_Balance, g.Affiliate_Show_Status, g.Affiliate_Show_StatusDate, g.Affiliate_Show_StatusBy">
	</MvIF>
	
	<INPUT TYPE = "hidden" NAME = "Old_Affiliate_Status" VALUE = "{ encodeentities( g.Affiliate_Status ) }">
</MvFUNCTION>

<MvCOMMENT>
|
| Manage Affiliate Email Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions_AFME_Tab" PARAMETERS = "can_add, can_modify, can_delete" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'AFME' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			&nbsp;
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00129">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Activate New Affiliates Email</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.EmailAffiliates_Activated, 'EmailAffiliates_Activated', 'Yes', l.text ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvLOCALIZED ID = "MER-AFF-00130">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US"><B>From:</B></MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvIF EXPR = "{ g.EmailAffiliates_UseFrom }">
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseFrom" VALUE = "">
				<MvLOCALIZED ID = "MER-AFF-00131">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseFrom" VALUE = "Yes" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00132">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_From" VALUE = "{ encodeentities( g.EmailAffiliates_From ) }">
			<MvELSE>
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseFrom" VALUE = "" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00133">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseFrom" VALUE = "Yes">
				<MvLOCALIZED ID = "MER-AFF-00134">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_From" VALUE = "">
			</MvIF>
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvLOCALIZED ID = "MER-AFF-00135">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US"><B>To:</B></MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvIF EXPR = "{ g.EmailAffiliates_UseTo }">
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseTo" VALUE = "">
				<MvLOCALIZED ID = "MER-AFF-00136">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseTo" VALUE = "Yes" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00137">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_To" VALUE = "{ encodeentities( g.EmailAffiliates_To ) }">
			<MvELSE>
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseTo" VALUE = "" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00138">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseTo" VALUE = "Yes">
				<MvLOCALIZED ID = "MER-AFF-00139">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_To" VALUE = "">
			</MvIF>
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvLOCALIZED ID = "MER-AFF-00140">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">CC:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvIF EXPR = "{ g.EmailAffiliates_UseCC }">
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseCC" VALUE = "">
				<MvLOCALIZED ID = "MER-AFF-00141">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseCC" VALUE = "Yes" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00142">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_CC" VALUE = "{ encodeentities( g.EmailAffiliates_CC ) }">
			<MvELSE>
				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseCC" VALUE = "" CHECKED>
				<MvLOCALIZED ID = "MER-AFF-00143">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Affiliate's Email Address<BR></MvLOCALIZED-TEXT>
				</MvLOCALIZED>					

				<INPUT TYPE = "radio" NAME = "EmailAffiliates_UseCC" VALUE = "Yes">
				<MvLOCALIZED ID = "MER-AFF-00144">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US"> Other:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<INPUT TYPE = "text" SIZE = 30 NAME = "EmailAffiliates_CC" VALUE = "">
			</MvIF>
			</FONT>
		</TD></TR>

		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00145">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US"><B>Subject:</B></MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = "40" NAME = "EmailAffiliates_Subject" VALUE = "{ encodeentities( g.EmailAffiliates_Subject ) }">
			</FONT>
			<BR>
		</TD></TR>

		<TR><TD VALIGN = "top">
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<MvLOCALIZED ID = "MER-AFF-00146">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Header:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>					
			</FONT>
		</TD><TD WIDTH = "100%">
			<FONT SIZE = "-1" FACE = "Arial, Helvetica">
			<TEXTAREA NAME = "EmailAffiliates_Header" ROWS = 10 COLS = 58 WRAP = "off"><MIVA STANDARDOUTPUTLEVEL = "text, html"><MvEVAL EXPR = "{ encodeentities( g.EmailAffiliates_Header ) }"><MIVA STANDARDOUTPUTLEVEL = "text, html, compresswhitespace"></TEXTAREA>
			</FONT>
		</TD></TR>

		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.EmailAffiliates_Activated, g.EmailAffiliates_UseFrom, g.EmailAffiliates_From, g.EmailAffiliates_UseTo, g.EmailAffiliates_To, g.EmailAffiliates_UseCC, g.EmailAffiliates_CC, g.EmailAffiliates_Subject, g.EmailAffiliates_Header">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Payout Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateOptions_PAYO_Tab" PARAMETERS = "can_add, can_modify, can_delete" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_money" VALUE = "{ CanI( 'MONY', 1, 0, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete_money" VALUE = "{ CanI( 'MONY', 0, 0, 0, 1 ) }">
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'AFLT', 0, 0, 1, 0 ) }">

	<MvIF EXPR = "{ g.Tab EQ 'PAYO' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD ALIGN = "left" VALIGN = "middle" WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvHIDE FIELDS = "g.AffiliatePayouts_Show">

		<A HREF = "JavaScript:ListReloadField( 'AffiliatePayouts_Offset', 'AffiliatePayouts_Stack', 'AffiliatePayouts_Show', 'All' );">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_All( g.AffiliatePayouts_Show EQ 'All' ) }"><MvEVAL EXPR = "{ l.button }"></A>

		<A HREF = "JavaScript:ListReloadField( 'AffiliatePayouts_Offset', 'AffiliatePayouts_Stack', 'AffiliatePayouts_Show', 'Processed' );">
		<MvEVAL EXPR = "{ DrawImgButton_Processed( g.AffiliatePayouts_Show EQ 'Processed' ) }"></A>

		<A HREF = "JavaScript:ListReloadField( 'AffiliatePayouts_Offset', 'AffiliatePayouts_Stack', 'AffiliatePayouts_Show', 'Unprocessed' );">
		<MvEVAL EXPR = "{ DrawImgButton_Unprocessed( g.AffiliatePayouts_Show EQ 'Unprocessed' ) }"></A>
		</FONT>
		</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00147">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B>
			<MvASSIGN NAME = "g.AffiliatePayouts_Search" VALUE = "{ ltrim( rtrim( g.AffiliatePayouts_Search ) ) }">
			<INPUT TYPE = "text" NAME = "AffiliatePayouts_Search" VALUE = "{ encodeentities( g.AffiliatePayouts_Search) }" SIZE = 20>
			<A HREF = "JavaScript:ListReload( 'AffiliatePayouts_Offset', 'AffiliatePayouts_Stack' );">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Search(0) }"><MvEVAL EXPR = "{ l.button }"></A>			
			</FONT>
		</TD></TR>
		</TABLE>

		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR>
		<MvIF EXPR = "{ l.can_delete_money }">
			<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00148">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
				<BR>
				<MvLOCALIZED NAME = "l.check_all" ID = "MER-AFF-00344">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.uncheck_all" ID = "MER-AFF-00345">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Uncheck All</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<A HREF = "JavaScript:CheckAll( 'AffiliatePayouts_Remove', 1 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'checkall.gif' }" ALT = "{ l.check_all }"></A>
				&nbsp;
				<A HREF = "JavaScript:CheckAll( 'AffiliatePayouts_Remove', 0 );"><IMG BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'uncheckall.gif' }" ALT = "{ l.uncheck_all }"></A>
			</TD>
		</MvIF>

		<TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00149">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Date&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00150">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Time&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00151">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Count&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00152">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Amount&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00153">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Created By&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP ALIGN = "right" WIDTH = "100%">
			&nbsp;
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00154">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Voided?&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00155">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed?&nbsp;&nbsp;</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
				<MvIF EXPR = "{ l.can_add_money }">
					<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00156">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Payout</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<A HREF = "{ g.sessionurl $ 'Screen=AFAP&Store_Code=' $ encodeattribute( g.Store_Code ) }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_NewX(0, l.alt) }"><MvEVAL EXPR = "{ l.button }"></A>
				<MvELSE>
					&nbsp;
				</MvIF>
			</FONT>
		</TD></TR>

		<MvASSIGN NAME = "l.shown" VALUE = 0>
		<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

		<MvIF EXPR = "{ ( g.AffiliatePayouts_Show EQ 'All' ) OR ( g.AffiliatePayouts_Show EQ 'Unprocessed' ) }">
			<MvASSIGN NAME = "l.assigned" VALUE = 0>
		</MvIF>

		<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'Processed' }">
			<MvASSIGN NAME = "l.assigned" VALUE = 1>
		</MvIF>

		<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'All' }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindOffset_All( g.AffiliatePayouts_Offset, g.AffiliatePayouts_Search ) }">
		</MvIF>

		<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'Unprocessed' }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindOffset_Unprocessed( g.AffiliatePayouts_Offset, g.AffiliatePayouts_Search ) }">
		</MvIF>

		<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'Processed' }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindOffset_Processed( g.AffiliatePayouts_Offset, g.AffiliatePayouts_Search ) }">
		</MvIF>

		<MvWHILE EXPR = "{ ( l.shown LT g.AffiliatePayouts_Display ) AND l.nextoffset }">
			<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">
			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.foo" VALUE = "{ User_Find_ID( AffiliatePayouts.d.user_id ) }">

			<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
			<MvELSE>
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
			</MvIF>

			<TR>
			
			<MvIF EXPR = "{ l.can_delete }">
				<TD ALIGN = "center" VALIGN = "middle" NOWRAP BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "hidden" NAME = "{ 'AffiliatePayouts_ID[' $ l.shown $ ']' }" VALUE = "{ encodeentities( AffiliatePayouts.d.id ) }">
					<INPUT TYPE = "checkbox" NAME = "{ 'AffiliatePayouts_Remove[' $ l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
					</FONT>
				</TD>
			</MvIF>

			<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( AffiliatePayouts.d.date, s.miva_language ) }">
				<MvEVAL EXPR = "{ l.formated_date }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( AffiliatePayouts.d.date, s.miva_language ) }">
				<MvEVAL EXPR = "{ l.formated_time }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvEVAL EXPR = "{ AffiliatePayouts.d.count }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvEVAL EXPR = "{ AffiliatePayouts.d.amount }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( AffiliatePayouts.d.pay_by ) }">
				<MvIF EXPR = "{ l.ok }">
					<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
				</MvIF>
				</FONT>
			</TD><TD BGCOLOR = "{ l.bgcolor }" NOWRAP ALIGN = "right" WIDTH = "100%">
				&nbsp;
			</TD><TD BGCOLOR = "{ l.bgcolor }" NOWRAP ALIGN = "center">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliatePayouts.d.void }">
					<MvEVAL EXPR = "{ DrawCheck_Void( AffiliatePayouts.d.void ) }">
				<MvELSE>
					&nbsp;
				</MvIF>				
				</FONT>
			</TD><TD BGCOLOR = "{ l.bgcolor }" NOWRAP ALIGN = "center">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliatePayouts.d.processed }">
					<MvEVAL EXPR = "{ DrawCheck_Processed( AffiliatePayouts.d.processed ) }">
				<MvELSE>
					&nbsp;
				</MvIF>				
				</FONT>
			</TD><TD VALIGN = "top" BGCOLOR = "{ l.bgcolor }" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ l.can_view_money }">
					<A HREF = "{ g.sessionurl $ 'Screen=AFPO&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_AffiliatePayouts=' $ encodeattribute( AffiliatePayouts.d.id ) }">
					<MvEVAL EXPR = "{ DrawImgButton_Details(0) }"></A>					
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD></TR>

			<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">

			<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'All' }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindNext_All( l.nextoffset, g.AffiliatePayouts_Search ) }">
			</MvIF>

			<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'Unprocessed' }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindNext_Unprocessed( l.nextoffset, g.AffiliatePayouts_Search ) }">
			</MvIF>

			<MvIF EXPR = "{ g.AffiliatePayouts_Show EQ 'Processed' }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliatePayouts_FindNext_Processed( l.nextoffset, g.AffiliatePayouts_Search ) }">
			</MvIF>
		</MvWHILE>

		<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvHIDE FIELDS = "g.AffiliatePayouts_Stack, g.AffiliatePayouts_Offset">
			<MvIF EXPR = "{ l.shown }">
				<B><MvEVAL EXPR = "{ g.AffiliatePayouts_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
			<MvELSE>
				<B>0-0</B>
			</MvIF>
			</FONT>
		</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "9">
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvIF EXPR = "{ len( g.AffiliatePayouts_Stack ) }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'AffiliatePayouts_Offset\', \'AffiliatePayouts_Stack\' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Previous(0) }"><MvEVAL EXPR = "{ l.button }"></A>				
			</MvIF>

			 <INPUT TYPE = "text" NAME = "AffiliatePayouts_Display" VALUE = "{ encodeentities( g.AffiliatePayouts_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'AffiliatePayouts_Offset', 'AffiliatePayouts_Stack' );">
     		 <MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Refresh(0) }"><MvEVAL EXPR = "{ l.button }"></A>			 
			 <INPUT TYPE = "hidden" NAME = "AffiliatePayouts_Count" VALUE = "{ encodeentities( l.shown ) }">

			 <MvIF EXPR = "{ l.nextoffset }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'AffiliatePayouts_Offset\', \'AffiliatePayouts_Stack\', ' $ l.lastoffset $ ' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Next(0) }"><MvEVAL EXPR = "{ l.button }"></A>				
			 </MvIF>
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.AffiliatePayouts_Stack, g.AffiliatePayouts_Search, g.AffiliatePayouts_Offset, g.AffiliatePayouts_Display, g.AffiliatePayouts_Count, g.AffiliatePayouts_Show">
	</MvIF>		
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Add Payout Screen
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateAddPayout" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvLOCALIZED NAME = "l.screen_label" ID = "MER-AFF-00157">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Payout</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.count" VALUE = "0">
	<MvASSIGN NAME = "l.amount" VALUE = "0">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.affiliate_found" VALUE = "{ Affiliates_FindFirst() }">
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.open" VALUE = "{ AffiliateOptions_Find() }">

	<MvWHILE EXPR = "{ l.affiliate_found AND l.ok }">
		<MvASSIGN NAME = "l.pay_affiliate" VALUE = "1">
		
		<MvIF EXPR = "{ Affiliates.d.status NE 'Approved' }">
			<MvASSIGN NAME = "l.pay_affiliate" VALUE = "0">
		</MvIF>

		<MvIF EXPR = "{ l.pay_affiliate }">
			<MvASSIGN NAME = "l.payout" VALUE = "{ int( Affiliates.d.balance * 100 ) / 100 }">
			<MvIF EXPR = "{ ( l.payout GT '0.1' ) AND ( l.payout GE AffiliateOptions.d.pay_thresh ) }">

				<MvIF EXPR = "{ l.ok }">
					<MvASSIGN NAME = "l.count" value = "{ l.count + 1 }">
					<MvASSIGN NAME = "l.amount" value = "{ l.amount + l.payout }">
				</MvIF>
			</MvIF>	
		</MvIF>
		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.affiliate_found" VALUE = "{ Affiliates_FindNext() }">
		</MvIF>
	</MvWHILE>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.screen" VALUE = "{ BeginScreen( l.screen_label, 'AFLT', 'Help:aflt.html' ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginContent() }">

	<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
	<TR><TD NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
		<MvLOCALIZED ID = "MER-AFF-00158">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Threshold:</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvEVAL EXPR = "{ AffiliateOptions.d.pay_thresh }">
		</FONT>
	</TD></TR>
	<TR><TD NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
		<MvLOCALIZED ID = "MER-AFF-00159">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payee Count:</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvEVAL EXPR = "{ l.count }">
		</FONT>
	</TD></TR>
	<TR><TD NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
		<MvLOCALIZED ID = "MER-AFF-00160">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Amount:</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvEVAL EXPR = "{ l.amount ROUND 2 }">
		</FONT>
	</TD></TR>
	<MvIF EXPR = "{ l.count LE 0 }">
		<TR><TD NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			&nbsp;
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<I>
			<MvLOCALIZED ID = "MER-AFF-00161">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">There are no affiliates to be paid.</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</I>
			</FONT>
		</TD></TR>
	</MvIF>
	</TABLE>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndContent() }">

	<MvIF EXPR = "{ l.count GT 0 }">
		<MvLOCALIZED NAME = "l.cont" ID = "MER-AFF-00162">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Continue</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( 'AAPO:' $ l.cont ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( '' ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = 1> 
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Add/Edit Screen
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateInfo" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00163">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Affiliate</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvASSIGN NAME = "l.action" 		VALUE = "">
	<MvASSIGN NAME = "l.affiliate_id" 	VALUE = 0>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.state_empty" VALUE = "{ State_Empty() }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_money" 	VALUE = "{ CanI( 'MONY', 1, 0, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" 		VALUE = "{ CanI( 'AFLT', 0, 1, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" 	VALUE = "{ CanI( 'AFLT', 0, 0, 1 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" 	VALUE = "{ CanI( 'AFLT', 0, 0, 0 ,1 ) }">

	<MvIF EXPR = "{ len( g.Edit_Affiliate ) EQ 0 AND l.can_add EQ 0 }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ len( g.Edit_Item ) }">
		<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ g.Edit_Item }">
	</MvIF>

	<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
		<MvIF EXPR = "{ g.Prev_Item }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliate_FindPrev_AffiliateOrder( g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
			<MvELSE>
				<MvLOCALIZED NAME = "l.message" ID = "MER-AFF-00164">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">There is no previous Affiliate</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvASSIGN NAME = "g.Message" VALUE = "{ l.message }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ g.Next_Item }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliate_FindNext_AffiliateOrder( g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
			<MvELSE>
				<MvLOCALIZED NAME = "l.message" ID = "MER-AFF-00165">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">There is no next Affiliate</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvASSIGN NAME = "g.Message" VALUE = "{ l.message }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ g.First_Item }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_FindFirst() }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ g.Last_Item }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_FindLast() }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "g.Edit_Affiliate" VALUE = "{ Affiliates.d.code }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Code( g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.affiliate_id" 	VALUE = "{ Affiliates.d.id }">

				<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00166">
					<MvLOCALIZED-TOKEN NAME = "affiliate" VALUE = "{ encodeentities( Affiliates.d.code ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Edit Affiliate: %affiliate%</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvIF EXPR = "{ g.Load_Fields }">
					<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "{ Affiliates.d.code }">
					<MvASSIGN NAME = "g.Affiliate_SiteName" VALUE = "{ Affiliates.d.site_name }">
					<MvASSIGN NAME = "g.Affiliate_ContactName" VALUE = "{ Affiliates.d.con_name }">
					<MvASSIGN NAME = "g.Affiliate_SiteURL" VALUE = "{ Affiliates.d.site_url }">
					<MvASSIGN NAME = "g.Affiliate_Hits" VALUE = "{ Affiliates.d.hits }">
					<MvASSIGN NAME = "g.Affiliate_Percent" VALUE = "{ Affiliates.d.percent }">
					<MvASSIGN NAME = "g.Affiliate_Flat" VALUE = "{ Affiliates.d.flat }">
					<MvASSIGN NAME = "g.Affiliate_Email" VALUE = "{ Affiliates.d.email }">
					<MvASSIGN NAME = "g.Affiliate_Company" VALUE = "{ Affiliates.d.company }">
					<MvASSIGN NAME = "g.Affiliate_Phone" VALUE = "{ Affiliates.d.phone }">
					<MvASSIGN NAME = "g.Affiliate_Fax" VALUE = "{ Affiliates.d.fax }">
					<MvASSIGN NAME = "g.Affiliate_Address" VALUE = "{ Affiliates.d.addr }">
					<MvASSIGN NAME = "g.Affiliate_City" VALUE = "{ Affiliates.d.city }">

					<MvIF EXPR = "{ l.state_empty }">
						<MvASSIGN NAME = "g.Affiliate_StateSelect" VALUE = "">
						<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ Affiliates.d.state }">
					<MvELSE>
						<MvASSIGN NAME = "g.Affiliate_StateSelect" VALUE = "{ Affiliates.d.state }">
						<MvASSIGN NAME = "g.Affiliate_State" VALUE = "">
					</MvIF>

					<MvASSIGN NAME = "g.Affiliate_Country" VALUE = "{ Affiliates.d.cntry }">
					<MvASSIGN NAME = "g.Affiliate_Zip" VALUE = "{ Affiliates.d.zip }">
					<MvASSIGN NAME = "g.Affiliate_Status" VALUE = "{ Affiliates.d.status }">
					<MvASSIGN NAME = "g.Old_Affiliate_Status" VALUE = "{ Affiliates.d.status }">
					<MvASSIGN NAME = "g.Affiliate_StatusBy" VALUE = "{ Affiliates.d.status_by }">
					<MvASSIGN NAME = "g.Affiliate_StatusDate" VALUE = "{ Affiliates.d.status_dt }">
					<MvASSIGN NAME = "g.Affiliate_LastPayDate" VALUE = "{ Affiliates.d.lstpay_tm }">
					<MvASSIGN NAME = "g.Affiliate_LastPayAmt" VALUE = "{ Affiliates.d.lstpay_amt }">
					<MvASSIGN NAME = "g.Affiliate_LastPayUser" VALUE = "{ Affiliates.d.lstpay_by }">
					<MvASSIGN NAME = "g.Affiliate_Balance" VALUE = "{ Affiliates.d.balance }">
					
					<MvASSIGN NAME = "g.Affiliate_Password" VALUE = "">
					<MvASSIGN NAME = "g.Affiliate_VerifyPassword" VALUE = "">
					<MvASSIGN NAME = "g.Affiliate_LostPass_Email" VALUE = "{ Affiliates.d.lpasseml }">
					
					<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ _DB_Store_Open_AffiliateEarnings() }">
					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "g.AffiliateEarnings_Order" VALUE = "{ AffiliateEarnings.d.order_id }">
						<MvASSIGN NAME = "g.AffiliateEarnings_Amount" VALUE = "{ AffiliateEarnings.d.order_amt }">
						<MvASSIGN NAME = "g.AffiliateEarnings_Percent" VALUE = "{ AffiliateEarnings.d.percent }">
						<MvASSIGN NAME = "g.AffiliateEarnings_Flat" VALUE = "{ AffiliateEarnings.d.flat }">
						<MvASSIGN NAME = "g.AffiliateEarnings_Void" VALUE = "{ AffiliateEarnings.d.void }">
						<MvASSIGN NAME = "g.AffiliateEarnings_VoidReas" VALUE = "{ AffiliateEarnings.d.void_reasn }">
						<MvASSIGN NAME = "g.AffiliateEarnings_By" VALUE = "{ AffiliateEarnings.d.void_by }">
					</MvIF>
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvIF EXPR = "{ g.Load_Fields }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
				<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_SiteName" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_ContactName" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_SiteURL" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Email" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Company" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Phone" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Fax" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Address" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_City" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_StateSelect" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_State" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Country" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Zip" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_Hits" VALUE = "{ AffiliateOptions.d.hits }">
				<MvASSIGN NAME = "g.Affiliate_Percent" VALUE = "{ AffiliateOptions.d.percent }">
				<MvASSIGN NAME = "g.Affiliate_Flat" VALUE = "{ AffiliateOptions.d.flat }">
				<MvASSIGN NAME = "g.Affiliate_Balance" VALUE = "0.0000">

				<MvIF EXPR = "{ AffiliateOptions.d.signup EQ 'A' }">
					<MvASSIGN NAME = "g.Affiliate_Status" VALUE = "Approved">
				<MvELSE>
					<MvASSIGN NAME = "g.Affiliate_Status" VALUE = "Pending">
				</MvIF>
				
				<MvASSIGN NAME = "g.Affiliate_Password" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_VerifyPassword" VALUE = "">
				<MvASSIGN NAME = "g.Affiliate_LostPass_Email" VALUE = "">

				<MvASSIGN NAME = "g.AffiliateEarnings_By" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Order" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Amount" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Percent" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Flat" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Void" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Void" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_VoidReas" VALUE = "">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ NOT g.Have_List_Fields }">
			<MvASSIGN NAME = "g.AffiliateEarnings_Stack" VALUE = "">
			<MvASSIGN NAME = "g.AffiliateEarnings_Search" VALUE = "">
			<MvASSIGN NAME = "g.AffiliateEarnings_Offset" VALUE = 0>
			<MvASSIGN NAME = "g.AffiliateEarnings_Display" VALUE = "{ g.Admin_User_PageLen }">
		<MvELSE>
			<MvASSIGN NAME = "g.AffiliateEarnings_Display" VALUE = "{ int( g.AffiliateEarnings_Display ) }">
			<MvIF EXPR = "{ g.AffiliateEarnings_Display LT 1 }">
				<MvASSIGN NAME = "g.AffiliateEarnings_Display" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.Affiliate_Country ) EQ 0 }">
		<MvASSIGN NAME = "g.Affiliate_Country" VALUE = "{ Stores.d.country }">
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginScreen( l.title, l.action, 'Help:afif.html' ) }">

		<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
			<MvHIDE FIELDS = "g.Edit_Affiliate">
		</MvIF>
		
		<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = "1">
		
		<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
			<MvLOCALIZED NAME = "l.tab_list" ID = "MER-AFF-00167">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">IDEN:Identification,INFO:Info,COMM:Commission,EARN:Earnings,</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
		<MvELSE>
			<MvLOCALIZED NAME = "l.tab_list" ID = "MER-AFF-00168">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">IDEN:Identification,INFO:Info,COMM:Commission</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
		</MvIF>		
		
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
		<MvWHILE EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
			<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_tabs" VALUE = "{ Module_Affiliate_Tabs( l.affiliate_id ) }">
				<MvIF EXPR = "{ len( l.module_tabs ) }">
					<MvASSIGN NAME = "l.tab_list" VALUE = "{ l.tab_list $ ',' $ l.module_tabs }">
				</MvIF>
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
		</MvWHILE>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.tabs" VALUE = "{ DrawTabs( 'IDEN', l.tab_list ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginContent() }">

		<MvEVAL EXPR = "{ Screen_AffiliateInfo_IDEN_tab() }">
		<MvEVAL EXPR = "{ Screen_AffiliateInfo_INFO_tab() }">
		<MvEVAL EXPR = "{ Screen_AffiliateInfo_COMM_tab() }">

		<MvIF EXPR = "{ l.can_view_money }">
			<MvEVAL EXPR = "{ Screen_AffiliateInfo_EARN_tab() }">
		</MvIF>
	
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst() }">
		<MvWHILE EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
			<MvIF EXPR = "{ l.module_api_version GE 4.10 }">
				<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.ok" VALUE = "{ Module_Affiliate_Content( g.Tab, g.Load_Fields, l.affiliate_id ) }">
			</MvIF>

			<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext() }">
		</MvWHILE>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndContent() }">

		<MvIF EXPR = "{ len( g.Edit_Affiliate ) }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.buttons" VALUE = "{ DrawButtons_NextPrevious( 'AAIU:[UPDATE]:AFLT:0:1:0,AADL:[DELETE]:AFLT:0:0:1', g.Edit_Affiliate ) }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.buttons" VALUE = "{ DrawButtons( 'AAIS:[ADD]:AFLT:1:0:0' ) }">
		</MvIF>
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Edit Identification Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateInfo_IDEN_tab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'IDEN' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD VALIGN = "top" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00169">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = 15 NAME = "Affiliate_Code" VALUE = "{ encodeentities( g.Affiliate_Code ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00170">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Lost Password Email:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "text" SIZE = 25 NAME = "Affiliate_LostPass_Email" VALUE = "{ encodeentities( g.Affiliate_LostPass_Email ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00171">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Password:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "password" SIZE = 25 NAME = "Affiliate_Password" VALUE = "{ encodeentities( g.Affiliate_Password ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00172">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Confirm Password:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<INPUT TYPE = "password" SIZE = 25 NAME = "Affiliate_VerifyPassword" VALUE = "{ encodeentities( g.Affiliate_VerifyPassword ) }">
			</FONT>
		</TD></TR>

		<TR><TD VALIGN = "top" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
			<MvLOCALIZED ID = "MER-AFF-00173">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Application Status:</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<SELECT NAME = "Affiliate_Status">
			<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00174">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Pending</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Pending', g.Affiliate_Status, l.option ) }">

			<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00175">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Approved</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Approved', g.Affiliate_Status, l.option ) }">

			<MvLOCALIZED NAME = "l.option" ID = "MER-AFF-00176">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Rejected</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'Rejected', g.Affiliate_Status, l.option ) }">
			</SELECT>
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Affiliate_Code, g.Affiliate_Password, g.Affiliate_VerifyPassword, g.Affiliate_LostPass_Email, g.Affiliate_Status">
	</MvIF>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Info Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateInfo_INFO_tab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'INFO' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR><TD ALIGN = "left" VALIGN = "top">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00177">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_SiteName" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_SiteName ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00178">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_SiteURL" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_SiteURL ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00179">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_ContactName" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_ContactName ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00180">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Company" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Company ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00181">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email Address:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Email" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Email ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00182">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone Number:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Phone" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Phone ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00183">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax Number:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Fax" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Fax ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00184">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Address" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Address ) }">
				</FONT>
			</TD></TR>

			<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
				<TR><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00185">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip/Postal Code:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Affiliate_Zip" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Zip ) }">
					</FONT>
				</TD></TR>

				<TR><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00186">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">City:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Affiliate_City" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_City ) }">
					</FONT>
				</TD></TR>

				<MvIF EXPR = "{ l.state_empty }">
					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00187">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Affiliate_State" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_State ) }">
						</FONT>
					</TD></TR>
				<MvELSE>
					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00188">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.selected" VALUE = "{ State_Select( 'Affiliate_StateSelect', g.Affiliate_StateSelect ) }">
						<MvIF EXPR = "{ NOT l.selected }">
							<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ g.Affiliate_StateSelect }">
						</MvIF>
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00189">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Other State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Affiliate_State" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_State ) }">
						</FONT>
					</TD></TR>
				</MvIF>
			<MvELSE>
				<TR><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00190">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">City:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Affiliate_City" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_City ) }">
					</FONT>
				</TD></TR>

				<MvIF EXPR = "{ l.state_empty }">
					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00191">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Affiliate_State" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_State ) }">
						</FONT>
					</TD></TR>
				<MvELSE>
					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00192">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.selected" VALUE = "{ State_Select( 'Affiliate_StateSelect', g.Affiliate_StateSelect ) }">
						<MvIF EXPR = "{ NOT l.selected }">
							<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ g.Affiliate_StateSelect }">
						</MvIF>
						</FONT>
					</TD></TR>

					<TR><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvLOCALIZED ID = "MER-AFF-00193">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Other State/Province:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" NAME = "Affiliate_State" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_State ) }">
						</FONT>
					</TD></TR>
				</MvIF>

				<TR><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00194">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip/Postal Code:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" NAME = "Affiliate_Zip" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Zip ) }">
					</FONT>
				</TD></TR>
			</MvIF>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00195">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Country_Select( 'Affiliate_Country', g.Affiliate_Country ) }">
				</FONT>
			</TD></TR>
			</TABLE>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Affiliate_SiteName, g.Affiliate_ContactName, g.Affiliate_SiteURL, g.Affiliate_Email, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Company, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_StateSelect, g.Affiliate_Zip, g.Affiliate_Country">
	</MvIF>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Commissions Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateInfo_COMM_tab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'COMM' }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0 ,0 ) }">

		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">

		<TR><TD ALIGN = "left" VALIGN = "top">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00196"><B>
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Commission Per Referral:</MvLOCALIZED-TEXT>
				</MvLOCALIZED></B>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Hits" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Hits ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00197"><B>
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Commission Percent of Order:</MvLOCALIZED-TEXT>
				</MvLOCALIZED></B>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Percent" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Percent ) }">
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00198"><B>
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Commission Flat Fee per Order:</MvLOCALIZED-TEXT>
				</MvLOCALIZED></B>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" NAME = "Affiliate_Flat" SIZE = 25 VALUE = "{ encodeentities( g.Affiliate_Flat ) }">
				</FONT>
			</TD></TR>
			<TR><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00199">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Balance:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ len( g.Affiliate_Balance ) }">
					<MvEVAL EXPR = "{ encodeentities( g.Affiliate_Balance ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD></TR>
			<MvIF EXPR = "{ AffiliatePayout_Check( g.Affiliate_Balance ) AND ( l.can_add_money ) AND ( Affiliates.d.status EQ 'Approved' ) }">
				<TR><TD ALIGN = "left" VALIGN = "middle">
					&nbsp;
				</TD><TD ALIGN = "left" VALIGN = "middle">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<A HREF = "{ g.sessionurl $ 'Screen=AFPO&Action=AAPN&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Affiliates=' $ encodeattribute( Affiliates.d.code ) }">Payout (This Affiliate Only)<MvEVAL EXPR = "</A>">
					</FONT>
				</TD></TR>
			</MvIF>
			</TABLE>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Affiliate_Hits, g.Affiliate_Percent, g.Affiliate_Flat">
	</MvIF>

	<MvHIDE FIELDS = "g.Affiliate_Balance">

</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Earnings Tab
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateInfo_EARN_tab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_money" VALUE = "{ CanI( 'MONY', 1, 0, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0 ,0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'AFLT', 0, 0, 0 ,1 ) }">
		
	<MvIF EXPR = "{ g.Tab EQ 'EARN' }">
		<TABLE BORDER = 0 CELLPADDING = 5 CELLSPACING = 0 WIDTH = "100%">
		<TR>
		<MvIF EXPR = "{ l.can_delete }">
			<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00200">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.checkall" VALUE = "{ Screen_CheckAll( 'AffiliateEarnings_Remove' ) }">
			</TD>
		</MvIF>
		
		<TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00201">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Date</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00202">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Time</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00203">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">IP Address</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00204">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Type</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00205">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order ID</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00206">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order Amt</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00207">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Earned</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00208">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00209">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void Reason</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
			<MvLOCALIZED ID = "MER-AFF-00210">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Voided By</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
		</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
				<MvIF EXPR = "{ l.can_add_money }">
					<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00211">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Adjustment</MvLOCALIZED-TEXT>
					</MvLOCALIZED>

					<A HREF = "{ g.sessionurl $ 'Screen=AFVD&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_Affiliate=' $ encodeattribute( Affiliates.d.id ) }">
					<IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'new.gif' }"></A>
				<MvELSE>
					&nbsp;
				</MvIF>
			</FONT>
		</TD></TR>

		<MvASSIGN NAME = "l.shown" VALUE = 0>
		<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliateEarnings_FindOffset_Affiliate( g.AffiliateEarnings_Offset, Affiliates.d.id ) }">
		<MvWHILE EXPR = "{ ( l.nextoffset ) AND ( l.shown LT g.AffiliateEarnings_Display ) }">
			<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

			<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
			<MvELSE>
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
			</MvIF>

			<TR>
			<MvIF EXPR = "{ l.can_delete }">
				<TD ALIGN = "center" VALIGN = "middle" NOWRAP BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "hidden" NAME = "{ 'AffiliateEarnings_ID[' $ l.shown $ ']' }" VALUE = "{ encodeentities( AffiliateEarnings.d.id ) }">
					<INPUT TYPE = "checkbox" NAME = "{ 'AffiliateEarnings_Remove[' $  l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
					</FONT>
				</TD>
			</MvIF>

			<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( AffiliateEarnings.d.date, s.miva_language ) }">
				<MvEVAL EXPR = "{ l.formated_date }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time_Short( AffiliateEarnings.d.date, s.miva_language ) }">
				<MvEVAL EXPR = "{ l.formated_time }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliateEarnings.d.ip_address NE 0 }">
					<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.ip_address ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvEVAL EXPR = "{ XlateEarnings( AffiliateEarnings.d.type ) }">
				</FONT>
			</TD><TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliateEarnings.d.order_id NE 0 }">
					<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.order_id ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliateEarnings.d.order_amt NE 0 }">
					<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.order_amt ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliateEarnings.d.amount GE 0 }">
					<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.amount ) ROUND 4 }">
				<MvELSE>
					<MvIF EXPR = "{ AffiliateEarnings.d.amount LT 0 }">
						<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.amount ROUND 4 ) }">
					<MvELSE>
						&nbsp;
					</MvIF>
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ AffiliateEarnings.d.void }">
					<MvEVAL EXPR = "{ DrawCheck_Void( AffiliateEarnings.d.void ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "center" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ len( AffiliateEarnings.d.void_reasn ) }">
					<MvEVAL EXPR = "{ AffiliateEarnings.d.void_reasn }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ len( AffiliateEarnings.d.void_by ) AND ( AffiliateEarnings.d.void ) }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( AffiliateEarnings.d.void_by ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
					</MvIF>
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "right" VALIGN = "top" BGCOLOR = "{ l.bgcolor }" NOWRAP WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ l.can_view_money }">
					<A HREF = "{ g.sessionurl $ 'Screen=AFVD&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_AffiliateEarnings=' $ encodeattribute( AffiliateEarnings.d.id ) $ '&Edit_Affiliate=' $ encodeattribute( Affiliates.d.id ) }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Edit(0) }"><MvEVAL EXPR = "{ l.button }"></A>
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD></TR>

			<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliateEarnings_FindNextOffset_Affiliate( l.nextoffset, Affiliates.d.id ) }">
		</MvWHILE>

		<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvHIDE FIELDS = "g.AffiliateEarnings_Stack, g.AffiliateEarnings_Offset">
			<MvIF EXPR = "{ l.shown }">
				<B><MvEVAL EXPR = "{ g.AffiliateEarnings_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
			<MvELSE>
				<B>0-0</B>
			</MvIF>
			</FONT>
		</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "11">
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvIF EXPR = "{ len( g.AffiliateEarnings_Stack ) }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListPrevious( \'AffiliateEarnings_Offset\', \'AffiliateEarnings_Stack\' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Previous(0) }"><MvEVAL EXPR = "{ l.button }"></A>				
			</MvIF>

			<INPUT TYPE = "text" NAME = "AffiliateEarnings_Display" VALUE = "{ encodeentities( g.AffiliateEarnings_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'AffiliateEarnings_Offset', 'AffiliateEarnings_Stack' );">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Refresh(0) }"><MvEVAL EXPR = "{ l.button }"></A>			

			<INPUT TYPE = "hidden" NAME = "AffiliateEarnings_Count" VALUE = "{ encodeentities( l.shown ) }">

			<MvIF EXPR = "{ l.nextoffset }">
				<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'AffiliateEarnings_Offset\', \'AffiliateEarnings_Stack\', ' $ l.lastoffset $ ' );">' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Next(0) }"><MvEVAL EXPR = "{ l.button }"></A>				
			</MvIF>
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.AffiliateEarnings_Stack, g.AffiliateEarnings_Search, g.AffiliateEarnings_Offset, g.AffiliateEarnings_Display, g.AffiliateEarnings_Count">
	</MvIF>		
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Earnings Void/Adjust Screen
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliateVoid" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvASSIGN NAME = "l.action" VALUE = "">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_view_money" VALUE = "{ CanI( 'MONY', 1, 0, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add_money" VALUE = "{ CanI( 'MONY', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify_money" VALUE = "{ CanI( 'MONY', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete_money" VALUE = "{ CanI( 'MONY', 0, 0, 0, 1 ) }">

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ Affiliates_Find_ID( g.Edit_Affiliate ) }">		
		<MvIF EXPR = "{ len( g.Edit_AffiliateEarnings ) AND ( l.foo ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEarnings_Find_ID( g.Edit_AffiliateEarnings ) }">			
			<MvIF EXPR = "{ l.ok }">
				<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00212">
					<MvLOCALIZED-TOKEN NAME = "Affiliate" VALUE = "{ Affiliates.d.code }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Edit Transaction For Affiliate: %Affiliate%</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				
				<MvIF EXPR = "{ g.Load_Fields }">
					<MvASSIGN NAME = "g.Old_AffiliateEarnings_Void" VALUE = "{ AffiliateEarnings.d.void }">
					<MvASSIGN NAME = "g.AffiliateEarnings_Void" VALUE = "{ AffiliateEarnings.d.void }">
					<MvASSIGN NAME = "g.AffiliateEarnings_VoidReas" VALUE = "{ AffiliateEarnings.d.void_reasn }">
					<MvASSIGN NAME = "g.AffiliateEarnings_Date" VALUE = "{ AffiliateEarnings.d.date }">
					<MvASSIGN NAME = "g.AffiliateEarnings_OrderID" VALUE = "{ AffiliateEarnings.d.order_id }">
					<MvASSIGN NAME = "g.AffiliateEarnings_OrderAmt"	VALUE = "{ AffiliateEarnings.d.order_amt }">
					<MvASSIGN NAME = "g.AffiliateEarnings_Earned"	VALUE = "{ AffiliateEarnings.d.amount }">					
					<MvASSIGN NAME = "g.AffiliateEarnings_By" VALUE = "{ AffiliateEarnings.d.void_by }">
					<MvASSIGN NAME = "g.AffiliateEarnings_AdjustReas" VALUE = "{ AffiliateEarnings.d.adjst_reas }">
					<MvASSIGN NAME = "g.AffiliateEarnings_AdjustBy" VALUE = "{ AffiliateEarnings.d.adjst_by }">					
					<MvASSIGN NAME = "g.AffiliateEarnings_Type" VALUE = "{ XlateEarnings( AffiliateEarnings.d.type ) }">
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00213">
				<MvLOCALIZED-TOKEN NAME = "Affiliate" VALUE = "{ Affiliates.d.code }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Adjustment For Affiliate: %Affiliate%</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvIF EXPR = "{ g.Load_Fields }">
				<MvASSIGN NAME = "g.AffiliateEarnings_Date" VALUE = "{ s.time_t }">
				<MvASSIGN NAME = "g.AffiliateEarnings_Void" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_VoidReas" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_OrderID" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_OrderAmt"	VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_Earned"	VALUE = "0.0000">					
				<MvASSIGN NAME = "g.AffiliateEarnings_By" VALUE = "">
				<MvASSIGN NAME = "g.AffiliateEarnings_AdjustReas" VALUE = "">

				<MvLOCALIZED NAME = "g.AffiliateEarnings_Type" ID = "MER-AFF-00214">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjustment</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginScreen( l.title, l.action, 'Help:afvd.html' ) }">

		<MvIF EXPR = "{ len( g.Edit_AffiliateEarnings ) }">
			<MvHIDE FIELDS = "g.Edit_AffiliateEarnings, g.AffiliateEarnings_OrderID, g.AffiliateEarnings_OrderAmt, g.AffiliateEarnings_Earned, g.AffiliateEarnings_By,">
		</MvIF>

		<MvHIDE FIELDS = "g.AffiliateEarnings_Date, g.AffiliateEarnings_AdjustBy, g.AffiliateEarnings_Type, g.Old_AffiliateEarnings_Void, g.Edit_Affiliate">
		
		<MvLOCALIZED NAME = "l.tab_list" ID = "MER-AFF-00215">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">VOID:Transaction</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ DrawTabs( 'VOID', l.tab_list ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginContent() }">

		<MvIF EXPR = "{ g.Tab EQ 'VOID' }">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">		
			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00216">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Date:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				</FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( g.AffiliateEarnings_Date, s.miva_language ) }">
					<MvEVAL EXPR = "{ l.formated_date }">
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00217">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Time:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				</FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( g.AffiliateEarnings_Date, s.miva_language ) }">
					<MvEVAL EXPR = "{ l.formated_time }">
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00218">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Type:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				</FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvEVAL EXPR = "{ g.AffiliateEarnings_Type }">
				</FONT>
			</TD></TR>

			<MvIF EXPR = "{ NOT g.Edit_AffiliateEarnings }">
				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00219">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order ID:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateEarnings_OrderID" VALUE = "{ encodeentities( g.AffiliateEarnings_OrderID ) }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00220">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order Amt:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateEarnings_OrderAmt" VALUE = "{ encodeentities( g.AffiliateEarnings_OrderAmt ) }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00221"><B>
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Earned:</MvLOCALIZED-TEXT>
					</MvLOCALIZED></B>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = "10" NAME = "AffiliateEarnings_Earned" VALUE = "{ encodeentities( g.AffiliateEarnings_Earned ) }">
					</FONT>
				</TD></TR>
			<MvELSE>
				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00222">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order ID:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ g.AffiliateEarnings_OrderID }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00223">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Order Amt:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ g.AffiliateEarnings_OrderAmt }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00224"><B>
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Earned:</MvLOCALIZED-TEXT>
					</MvLOCALIZED></B>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ g.AffiliateEarnings_Earned }">
					</FONT>
				</TD></TR>
			</MvIF>

			<TR><TD NOWRAP>
				&nbsp;
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ g.AffiliateEarnings_Void }">
					<INPUT TYPE = "checkbox" NAME = "AffiliateEarnings_Void" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
				<MvELSE>
					<INPUT TYPE = "checkbox" NAME = "AffiliateEarnings_Void" VALUE = "Yes" ONCLICK = "SetModified();">
				</MvIF>
				<MvLOCALIZED ID = "MER-AFF-00225">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00226"><I>
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void Reason:</MvLOCALIZED-TEXT>
				</MvLOCALIZED></I>
				</FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = "30" NAME = "AffiliateEarnings_VoidReas" VALUE = "{ encodeentities( g.AffiliateEarnings_VoidReas ) }">
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvLOCALIZED ID = "MER-AFF-00227">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Voided By:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				</FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ ( g.AffiliateEarnings_Void ) AND len( g.AffiliateEarnings_VoidReas ) }">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.AffiliateEarnings_By ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
					</MvIF>
				</MvIF>
				</FONT>
			</TD></TR>

			<MvIF EXPR = "{ NOT len( g.Edit_AffiliateEarnings ) }">
				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00228"><I>
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjusted Reason:</MvLOCALIZED-TEXT>
					</MvLOCALIZED></I>
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = "30" NAME = "AffiliateEarnings_AdjustReas" VALUE = "{ encodeentities( g.AffiliateEarnings_AdjustReas ) }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00229">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjusted By:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.Admin_User_ID ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
					</MvIF>
					</FONT>
				</TD></TR>
			</MvIF>

			<MvIF EXPR = "{ ( g.AffiliateEarnings_Type EQ 'Adjustment' ) AND len( g.Edit_AffiliateEarnings ) }">
				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00230"><I>
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjusted Reason:</MvLOCALIZED-TEXT>
					</MvLOCALIZED></I>
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ g.AffiliateEarnings_AdjustReas }">
					</FONT>
				</TD></TR>

				<TR><TD NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED ID = "MER-AFF-00231">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjusted By:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					</FONT>
				</TD><TD WIDTH = "100%">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.AffiliateEarnings_AdjustBy ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvEVAL EXPR = "{ encodeentities( Users.d.name ) }">
					</MvIF>
					</FONT>
				</TD></TR>
			</MvIF>
			</TABLE>
		<MvELSE>
			<MvHIDE FIELDS = "g.AffiliateEarnings_Void, g.AffiliateEarnings_VoidReas, g.AffiliateEarnings_AdjustReas">
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndContent() }">

	<MvIF EXPR = "{ len( g.Edit_AffiliateEarnings ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.buttons" VALUE = "{ DrawButtons( 'AAVU:[UPDATE]:MONY:0:1:0' ) }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.buttons" VALUE = "{ DrawButtons( 'AAVA:[ADD]:MONY:1:0:0' ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Payout Screen
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliatePayout" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvASSIGN NAME = "l.action" VALUE = "">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_add" VALUE = "{ CanI( 'AFLT', 0, 1, 0, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_modify" VALUE = "{ CanI( 'AFLT', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'AFLT', 0, 0, 0, 1 ) }">
			
	<MvIF EXPR = "{ len( g.Edit_AffiliatePayouts ) EQ 0 AND l.can_add EQ 0 }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ len( g.Edit_AffiliatePayouts ) }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Find_ID( g.Edit_AffiliatePayouts ) }">

			<MvIF EXPR = "{ g.Load_Fields }">
				<MvASSIGN NAME = "g.Old_AffiliatePayouts_Void" VALUE = "{ AffiliatePayouts.d.void }">
				<MvASSIGN NAME = "g.Old_AffiliatePayouts_Processed" VALUE = "{ AffiliatePayouts.d.processed }">
				<MvASSIGN NAME = "g.AffiliatePayouts_Processed" VALUE = "{ AffiliatePayouts.d.processed }">
				<MvASSIGN NAME = "g.AffiliatePayouts_Void" VALUE = "{ AffiliatePayouts.d.void }">
				<MvASSIGN NAME = "g.AffiliatePayouts_VoidReas" VALUE = "{ AffiliatePayouts.d.void_reasn }">
				<MvASSIGN NAME = "g.AffiliatePayouts_VoidDate" VALUE = "{ AffiliatePayouts.d.void_date }">
				<MvASSIGN NAME = "g.AffiliatePayouts_By" VALUE = "{ AffiliatePayouts.d.void_by }">
			</MvIF>
		<MvELSE>
			<MvIF EXPR = "{ g.Load_Fields }">
				<MvASSIGN NAME = "g.AffiliatePayouts_Processed" VALUE = "">
				<MvASSIGN NAME = "g.AffiliatePayouts_Void" VALUE = "">
				<MvASSIGN NAME = "g.AffiliatePayouts_VoidReas" VALUE = "">
				<MvASSIGN NAME = "g.AffiliatePayouts_VoidDate" VALUE = "">
				<MvASSIGN NAME = "g.AffiliatePayouts_By" VALUE = "{ Users.d.name }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ NOT g.Have_List_Fields }">
			<MvASSIGN NAME = "g.Affiliate_Stack" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Search" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Offset" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Display" VALUE = "{ g.Admin_User_PageLen }">

			<MvASSIGN NAME = "g.Affiliate_Show_Code" VALUE = "Yes">
			<MvASSIGN NAME = "g.Affiliate_Show_SiteName" VALUE = "Yes">
			<MvASSIGN NAME = "g.Affiliate_Show_SiteURL" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_ContactName" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Email" VALUE = "Yes">
			<MvASSIGN NAME = "g.Affiliate_Show_Phone" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Fax" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Company" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Address" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_City" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_State" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Zip" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Country" VALUE = "">
			<MvASSIGN NAME = "g.Affiliate_Show_Amount" VALUE = "Yes">
		<MvELSE>
			<MvASSIGN NAME = "g.Affiliate_Display" VALUE = "{ int( g.Affiliate_Display ) }">
			<MvIF EXPR = "{ g.Affiliate_Display LT 1 }">
				<MvASSIGN NAME = "g.Affiliate_Display" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "l.valid" VALUE = "{ Affiliate_PayoutDisplay_Validate() }">

	<MvIF EXPR = "{ g.Affiliate_Display_Flag }">
		<MvASSIGN NAME = "g.Affiliate_Show_Code" VALUE = "Yes">
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliatePayouts_Find_ID( g.Edit_AffiliatePayouts ) }">
		<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00232">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Details</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginScreen( l.title, l.action, 'Help:afpo.html' ) }">

		<MvIF EXPR = "{ len( g.Edit_AffiliatePayouts ) }">
			<MvHIDE FIELDS = "g.Edit_AffiliatePayouts, g.AffiliatePayouts_By">
		</MvIF>

		<MvHIDE FIELDS = "g.Old_AffiliatePayouts_Void, g.AffiliatePayouts_VoidDate">

		<MvLOCALIZED NAME = "l.tab_list" ID = "MER-AFF-00233">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">AFIL:Affiliate,PAYO:Payout</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ DrawTabs( 'AFIL', l.tab_list ) }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.begin" VALUE = "{ BeginContent() }">
				
		<MvEVAL EXPR = "{ Screen_AffiliatePayout_AFIL_tab() }">
		<MvEVAL EXPR = "{ Screen_AffiliatePayout_PAYO_tab() }">

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndContent() }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.buttons" VALUE = "{ DrawButtons( 'AAPU:[UPDATE]:MONY:0:1:0,AAPD:[DELETE]:MONY:0:0:1' ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.end" VALUE = "{ EndScreen() }">

	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Payout Details
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliatePayout_PAYO_tab" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
		<MvIF EXPR = "{ g.Tab EQ 'PAYO' }">
				<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
				<TR><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<B>
					<MvLOCALIZED ID = "MER-AFF-00234">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Information:</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B>
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<B>
						<MvLOCALIZED ID = "MER-AFF-00235">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void Information:</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						</B>
					</FONT>
				</TD></TR>

				<TR><TD ALIGN = "left">
					<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00236">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Date:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( AffiliatePayouts.d.date, s.miva_language ) }">
								<MvEVAL EXPR = "{ l.formated_date }">
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00237">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Time:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( AffiliatePayouts.d.date, s.miva_language ) }">
								<MvEVAL EXPR = "{ l.formated_time }">
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00238">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payee Count:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ AffiliatePayouts.d.count }">
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00239">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Total Payout: </MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ AffiliatePayouts.d.amount }">
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00240">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Created By:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( AffiliatePayouts.d.pay_by ) }">
							<MvIF EXPR = "{ l.ok }">
								<MvEVAL EXPR = "{ Users.d.name }">
							</MvIF>
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00241">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD WIDTH = "100%">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ AffiliatePayouts.d.processed }">
								<MvLOCALIZED ID = "MER-AFF-00242">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Yes</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
							<MvELSE>
								<INPUT TYPE = "checkbox" NAME = "AffiliatePayouts_Processed" VALUE = "Yes" ONCLICK = "SetModified();">
							</MvIF>				
							</FONT>
						</TD></TR>

						<MvIF EXPR = "{ AffiliatePayouts.d.processed }">
							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00243">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed Date:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
								</FONT>
							</TD><TD WIDTH = "100%">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( AffiliatePayouts.d.proc_date, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_date }">
								</FONT>
							</TD></TR>

							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00244">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed Time:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
								</FONT>
							</TD><TD WIDTH = "100%">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( AffiliatePayouts.d.proc_date, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_time }">
								</FONT>
							</TD></TR>

							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00245">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed By:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
								</FONT>
							</TD><TD WIDTH = "100%">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( AffiliatePayouts.d.proc_by ) }">
								<MvIF EXPR = "{ l.ok }">
									<MvEVAL EXPR = "{ Users.d.name }">
								</MvIF>
								</FONT>
							</TD></TR>
						</MvIF>
					</TABLE>
					</TD><TD ALIGN = "left">

					<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
						<MvIF EXPR = "{ ( g.AffiliatePayouts_Void ) AND ( len( g.AffiliatePayouts_VoidReas ) ) }">
							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00246">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void Date:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
								</FONT>
							</TD><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( g.AffiliatePayouts_VoidDate, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_date }">
								</FONT>
							</TD></TR>

							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00247">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void Time:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								</FONT>
							</TD><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( g.AffiliatePayouts_VoidDate, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_time }">
								</FONT>
							</TD></TR>
						<MvELSE>
							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00248">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Current Date:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>					
								</FONT>
							</TD><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( s.time_t, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_date }">
								</FONT>
							</TD></TR>

							<TR><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00249">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Current Time:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								</FONT>
							</TD><TD NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( s.time_t, s.miva_language ) }">
									<MvEVAL EXPR = "{ l.formated_time }">
								</FONT>
							</TD></TR>
						</MvIF>
						<TR><TD NOWRAP>
							&nbsp;
						</TD><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ g.AffiliatePayouts_Void }">
								<INPUT TYPE = "checkbox" NAME = "AffiliatePayouts_Void" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
							<MvELSE>
								<INPUT TYPE = "checkbox" NAME = "AffiliatePayouts_Void" VALUE = "Yes" ONCLICK = "SetModified();">
							</MvIF>
							<MvLOCALIZED ID = "MER-AFF-00250">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00251"><I>
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Reason:</MvLOCALIZED-TEXT>
							</MvLOCALIZED></I>
							</FONT>
						</TD><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" SIZE = "30" NAME = "AffiliatePayouts_VoidReas" VALUE = "{ encodeentities( g.AffiliatePayouts_VoidReas ) }">
							</FONT>
						</TD></TR>

						<TR><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00252">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Voided By:</MvLOCALIZED-TEXT>
							</MvLOCALIZED>					
							</FONT>
						</TD><TD NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ ( g.AffiliatePayouts_Void ) AND len( g.AffiliatePayouts_VoidReas ) }">
								<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.ok" VALUE = "{ User_Find_ID( g.AffiliatePayouts_By ) }">
								<MvIF EXPR = "{ l.ok }">
									<MvEVAL EXPR = "{ Users.d.name }">
								</MvIF>
							</MvIF>
							</FONT>
						</TD></TR>
					</TABLE>
			</TD></TR>
			</TABLE>
		<MvELSE>
			<MvHIDE FIELDS = "g.AffiliatePayouts_Void, g.AffiliatePayouts_VoidReas">
		</MvIF>
</MvFUNCTION>

<MvFUNCTION NAME = "Screen_AffiliatePayout_AFIL_tab" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ g.Tab EQ 'AFIL' }">
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = "1">

			<TR><TD>
				&nbsp;
			</TD><TD ALIGN = "right" VALIGN = "middle">
				&nbsp;
			</TD><TD>
				&nbsp;
			</TD><TD ALIGN = "right" VALIGN = "middle" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00253">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Search:&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B>
				<MvASSIGN NAME = "g.Affiliate_Search" VALUE = "{ ltrim( rtrim( g.Affiliate_Search ) ) }">
				<INPUT TYPE = "text" NAME = "Affiliate_Search" VALUE = "{ encodeentities( g.Affiliate_Search ) }" SIZE = 20>
				<A HREF = "JavaScript:ListReload( 'Affiliate_Offset', 'Affiliate_Stack' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Search(0) }"><MvEVAL EXPR = "{ l.button }"></A>				
				</FONT>
			</TD></TR>

			<TR><TD ALIGN = "left" VALIGN = "top">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED ID = "MER-AFF-00254">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Display:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" COLSPAN = 3>
				<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>

				<TR><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00255">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Code, 'Affiliate_Show_Code', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00256">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_SiteName, 'Affiliate_Show_SiteName', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00257">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_SiteURL, 'Affiliate_Show_SiteURL', 'Yes', l.text ) }">
					</FONT>
				</TD></TR>

				<TR><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00258">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_ContactName, 'Affiliate_Show_ContactName', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00259">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Company, 'Affiliate_Show_Company', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00260">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Email, 'Affiliate_Show_Email', 'Yes', l.text ) }">
					</FONT>
				</TD></TR>

				<TR><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00261">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Phone, 'Affiliate_Show_Phone', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00262">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Fax, 'Affiliate_Show_Fax', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00263">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Address, 'Affiliate_Show_Address', 'Yes', l.text ) }">
					</FONT>
				</TD></TR>
				<TR>
				<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
					<TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00264">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Zip, 'Affiliate_Show_Zip', 'Yes', l.text ) }">
					</FONT>
					</TD>
				</MvIF>	

				<TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00265">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">City</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_City, 'Affiliate_Show_City', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00266">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">State</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_State, 'Affiliate_Show_State', 'Yes', l.text ) }">
					</FONT>
				<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">
					</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00267">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Zip, 'Affiliate_Show_Zip', 'Yes', l.text ) }">
					</FONT>
				</MvIF>
				</TD></TR>
				
				</TR><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00268">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Country, 'Affiliate_Show_Country', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvLOCALIZED NAME = "l.text" ID = "MER-AFF-00269">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawCheckbox( g.Affiliate_Show_Amount, 'Affiliate_Show_Amount', 'Yes', l.text ) }">
					</FONT>
				</TD><TD ALIGN = "left">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					&nbsp;
					</FONT>
				</TD></TR>
							
				</TABLE>
			</TD></TR>
		</TABLE>
	
		<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
		<TR>
		<MvIF EXPR = "{ g.Affiliate_Show_Code }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00270">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_SiteName }">
			<TD BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00271">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_SiteURL }">
			<TD BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00272">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Company }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00273">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_ContactName }">
			<TD BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00274">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Address }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00275">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
			<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
				<TD BGCOLOR = "#000080">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00276">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip&nbsp;&nbsp;</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_City }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00277">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">City&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_State }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00278">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">State&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">
			<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
				<TD BGCOLOR = "#000080">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED ID = "MER-AFF-00279">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip&nbsp;&nbsp;</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
				<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Country }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00280">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Email }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00281">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Phone }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00282">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Fax }">
			<TD BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00283">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		<MvIF EXPR = "{ g.Affiliate_Show_Amount }">
			<TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-AFF-00284">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout&nbsp;&nbsp;</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
		</MvIF>

		</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP>
			&nbsp;
		</TD><TD ALIGN = "right" BGCOLOR = "#000080" NOWRAP WIDTH = "100%">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff">
			<MvLOCALIZED NAME = "l.alt_text" ID = "MER-AFF-00285">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Printable</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<A HREF = "{ g.sessionurl $ 'Screen=AFPR&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&EditPayout_ID=' $ encodeattribute( AffiliatePayouts.d.id ) }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'order_edit.gif' }"></A>
			<MvASSIGN NAME = "l.columns" VALUE = "{ l.columns + 1 }">
			</FONT>
		</TD></TR>

		<MvASSIGN NAME = "l.shown" VALUE = 0>
		<MvASSIGN NAME = "l.lastoffset" VALUE = 0>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliateEarnings_FindOffset_Payout( g.Affiliate_Offset, g.Edit_AffiliatePayouts, g.Affiliate_Search ) }">

		<MvWHILE EXPR = "{ ( l.shown LT g.Affiliate_Display ) AND l.nextoffset }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.aff_found" VALUE = "{ Affiliates_Find_ID( AffiliateEarnings.d.aff_id ) }">
			<MvASSIGN NAME = "l.shown" VALUE = "{ l.shown + 1 }">

			<MvIF EXPR = "{ ( l.shown MOD 2 ) EQ 0 }">
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
			<MvELSE>
				<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
			</MvIF>

			<TR>
				<MvIF EXPR = "{ g.Affiliate_Show_Code }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvEVAL EXPR = "{ Affiliates.d.code }">
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_SiteName }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.site_name ) }">
							<MvEVAL EXPR = "{ Affiliates.d.site_name }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_SiteURL }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.site_url ) }">
							<MvEVAL EXPR = "{ Affiliates.d.site_url }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Company }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.company ) }">
							<MvEVAL EXPR = "{ Affiliates.d.company }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_ContactName }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.con_name ) }">
							<MvEVAL EXPR = "{ Affiliates.d.con_name }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Address }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.addr ) }">
							<MvEVAL EXPR = "{ Affiliates.d.addr }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ s.miva_language EQ 'de-DE' }">
					<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
						<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.zip ) }">
								<MvEVAL EXPR = "{ Affiliates.d.zip }">
							<MvELSE>
								&nbsp;						
							</MvIF>
							</FONT>
						</TD>
					</MvIF>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_City }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.city ) }">
							<MvEVAL EXPR = "{ Affiliates.d.city }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_State }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.state ) }">
							<MvEVAL EXPR = "{ Affiliates.d.state }">
						<MvELSE>
							&nbsp;
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ s.miva_language EQ 'en-US' }">
					<MvIF EXPR = "{ g.Affiliate_Show_Zip }">
						<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.zip ) }">
								<MvEVAL EXPR = "{ Affiliates.d.zip }">
							<MvELSE>
								&nbsp;						
							</MvIF>
							</FONT>
						</TD>
					</MvIF>
				</MvIF>
				
				<MvIF EXPR = "{ g.Affiliate_Show_Country }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.cntry ) }">
							<MvEVAL EXPR = "{ Affiliates.d.cntry }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Email }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.email ) }">
							<MvEVAL EXPR = "{ Affiliates.d.email }">						
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Phone }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.phone ) }">
							<MvEVAL EXPR = "{ Affiliates.d.phone }">						
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Fax }">
					<TD ALIGN = "left" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( Affiliates.d.fax ) }">
							<MvEVAL EXPR = "{ Affiliates.d.fax }">
						<MvELSE>
							&nbsp;						
						</MvIF>
						</FONT>
					</TD>
				</MvIF>

				<MvIF EXPR = "{ g.Affiliate_Show_Amount }">
					<TD ALIGN = "right" BGCOLOR = "{ l.bgcolor }" VALIGN = "middle" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvEVAL EXPR = "{ encodeentities( AffiliateEarnings.d.amount * -1 ) ROUND 2 }">&nbsp;&nbsp;
						</FONT>
					</TD>
				</MvIF>

				<TD ALIGN = "right" COLSPAN = 2 BGCOLOR = "{ l.bgcolor }" NOWRAP WIDTH = "100%">
					&nbsp;
				</TD></TR>

			<MvASSIGN NAME = "l.lastoffset" VALUE = "{ l.nextoffset }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.nextoffset" VALUE = "{ AffiliateEarnings_FindNextOffset_Payout( l.nextoffset, AffiliatePayouts.d.id, g.Affiliate_Search ) }">
		</MvWHILE>

		<TR><TD BGCOLOR = "#000080" ALIGN = "left" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvHIDE FIELDS = "g.Affiliate_Stack, g.Affiliate_Offset">
			<MvIF EXPR = "{ l.shown }">
				<B><MvEVAL EXPR = "{ g.Affiliate_Offset + 1 }">-<MvEVAL EXPR = "{ l.lastoffset }"></B>
			<MvELSE>
				<B>0-0</B>
			</MvIF>
			</FONT>
		</TD><TD BGCOLOR = "#000080" ALIGN = "right" VALIGN = "middle" COLSPAN = "{ l.columns }">
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1">
			<MvIF EXPR = "{ len( g.Affiliate_Stack ) }">
				<A HREF = "JavaScript:ListPrevious( 'Affiliate_Offset', 'Affiliate_Stack' );">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Previous(0) }"><MvEVAL EXPR = "{ l.button }"></A>
			</MvIF>

			<INPUT TYPE = "text" NAME = "Affiliate_Display" VALUE = "{ encodeentities( g.Affiliate_Display ) }" SIZE = 5> <A HREF = "JavaScript:ListReload( 'Affiliate_Offset', 'Affiliate_Stack' );">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Refresh(0) }"><MvEVAL EXPR = "{ l.button }"></A>
			<INPUT TYPE = "hidden" NAME = "Affiliate_Count" VALUE = "{ encodeentities( l.shown ) }">

			<MvIF EXPR = "{ l.nextoffset }">
				<A HREF = "{ 'JavaScript:ListNext( \'Affiliate_Offset\', \'Affiliate_Stack\', ' $ l.lastoffset $ ' );' }">
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Next(0) }"><MvEVAL EXPR = "{ l.button }"></A>
			</MvIF>
			</FONT>
		</TD></TR>
		</TABLE>
	<MvELSE>
		<MvHIDE FIELDS = "g.Affiliate_Stack, g.Affiliate_Search, g.Affiliate_Offset, g.Affiliate_Display, g.Affiliate_Count">
	</MvIF>		
</MvFUNCTION>

<MvCOMMENT>
|
| Affiliate Printer Friendly Screen
|
</MvCOMMENT>

<MvFUNCTION NAME = "Screen_AffiliatePayout_Print" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliatePayouts_Find_ID( g.EditPayout_ID ) }">

	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_date" VALUE = "{ Format_Date( s.time_t, s.miva_language ) }">
	<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.formated_time" VALUE = "{ Format_Time( s.time_t, s.miva_language ) }">
	
	<MvLOCALIZED NAME = "l.title" ID = "MER-AFF-00286">
		<MvLOCALIZED-TOKEN NAME = "date" VALUE = "{ encodeentities( l.formated_date ) }">
		<MvLOCALIZED-TOKEN NAME = "time" VALUE = "{ encodeentities( l.formated_time ) }">
		<MvLOCALIZED-TOKEN NAME = "user" VALUE = "{ encodeentities( Users.d.name ) }">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout Details for %date% at %time% by %user%</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<HEAD>
		<TITLE><MvEVAL EXPR = "{ l.title }"></TITLE>
	</HEAD>
	
	<BODY>
	
	<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">	
		<TR><TD ALIGN = "left" VALIGN = "middle">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<B>
				<MvEVAL EXPR = "{ l.title }">
			</B>
			</FONT>
		</TD></TR>

		<TR><TD ALIGN = "left" VALIGN = "middle" NOWRAP>
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">&nbsp;</FONT>
		</TD></TR>

		<TR><TD ALIGN = "left" VALIGN = "middle">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00287">
				<MvLOCALIZED-TOKEN NAME = "affiliates" VALUE = "{ AffiliatePayouts.d.count }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Affiliates Paid: %affiliates%</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</FONT>
		</TD></TR>

		<TR><TD ALIGN = "left" VALIGN = "middle">
			<FONT FACE = "Arial, Helvetica" SIZE = "-1">
			<MvLOCALIZED ID = "MER-AFF-00288">
				<MvLOCALIZED-TOKEN NAME = "payout" VALUE = "{ AffiliatePayouts.d.amount }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Total Payout: %payout%</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</FONT>
		</TD></TR>

	</TABLE>
	<HR>

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_Find_PayoutID( g.EditPayout_ID ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.aff_found" VALUE = "{ Affiliates_Find_ID( AffiliateEarnings.d.aff_id ) }">
		<MvIF EXPR = "{ l.aff_found  }">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
				<TR><TD ALIGN = "left" VALIGN = "top">
					<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
								<MvLOCALIZED ID = "MER-AFF-00289">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
							</B></FONT>
						</TD><TD>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.site_name ) }">
									<MvEVAL EXPR = "{ Affiliates.d.site_name }">
								<MvELSE>
									<I>
									<MvLOCALIZED ID = "MER-AFF-00290">
										<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
									</MvLOCALIZED>
									</I>
								</MvIF>
							</FONT>
						</TD></TR>


						<TR><TD ALIGN = "left" COLSPAN = "2">
							&nbsp;
						</TD></TR>

						<TR><TD ALIGN = "left" VALIGN = "top">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">																
								<MvLOCALIZED ID = "MER-AFF-00291">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>	
							</FONT>
						</TD><TD ALIGN = "left" VALIGN = "top">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.address" VALUE = "{ Format_Address( Affiliates.d.company, Affiliates.d.con_name, Affiliates.d.addr, Affiliates.d.city, Affiliates.d.state, Affiliates.d.zip, Affiliates.d.cntry, '<BR>') }">
							<MvIF EXPR = "{ len( l.address ) }">
								<MvEVAL EXPR = "{ l.address }">
							<MvELSE>
								<I>
								<MvLOCALIZED ID = "MER-AFF-00292">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								</I>
							</MvIF>						
							</FONT>
						</TD></TR>
					</TABLE>

					
				</TD><TD ALIGN = "left" VALIGN = "top">
					<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0>
						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvLOCALIZED ID = "MER-AFF-00293"><B>
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout:</MvLOCALIZED-TEXT>
							</MvLOCALIZED></B>
							</FONT>
						</TD><TD>
							<B>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ ( AffiliateEarnings.d.amount * -1 ) ROUND 2 }">
							</FONT>
							</B>
						</TD></TR>
						<TR><TD ALIGN = "left" COLSPAN = "2">
							&nbsp;
						</TD></TR>

						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvLOCALIZED ID = "MER-AFF-00294">
										<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL:</MvLOCALIZED-TEXT>
									</MvLOCALIZED>
							</FONT>
						</TD><TD>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ len( Affiliates.d.site_url ) }">
								<MvEVAL EXPR = "{ Affiliates.d.site_url }">
							<MvELSE>
								<I>
								<MvLOCALIZED ID = "MER-AFF-00295">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								</I>
							</MvIF>
							</FONT>
						</TD></TR>

						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00296">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">E-mail:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
							</FONT>
						</TD><TD>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.email ) }">
									<MvEVAL EXPR = "{ Affiliates.d.email }">
								<MvELSE>
									<I>
										<MvLOCALIZED ID = "MER-AFF-00297">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
									</I>
								</MvIF>
							</FONT>
						</TD></TR>

						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00298">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
							</FONT>
						</TD><TD>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.phone ) }">
									<MvEVAl EXPR = "{ Affiliates.d.phone }">
								<MvELSE>
									<I>
									<MvLOCALIZED ID = "MER-AFF-00299">
										<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
									</MvLOCALIZED>
									</I>
								</MvIF>
							</FONT>
						</TD></TR>

						<TR><TD ALIGN = "left" VALIGN = "middle">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvLOCALIZED ID = "MER-AFF-00300">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax:</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
							</FONT>
						</TD><TD>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( Affiliates.d.fax ) }">
									<MvEVAL EXPR = "{ Affiliates.d.fax }">
								<MvELSE>
									<I>
									<MvLOCALIZED ID = "MER-AFF-00301">
										<MvLOCALIZED-TEXT LANGUAGE = "en-US">None</MvLOCALIZED-TEXT>
									</MvLOCALIZED>
									</I>
								</MvIF>
							</FONT>
						</TD></TR>

					</TABLE>
				</TD></TR>
			</TABLE>
			<HR>		
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEarnings_FindNext_PayoutID( g.EditPayout_ID ) }">
	</MvWHILE>
	</BODY>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "XlateEarnings" PARAMETERS = "type" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ l.type EQ 'hit' }">
		<MvLOCALIZED NAME = "l.xtype" ID = "MER-AFF-00302">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Referral</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ l.xtype }">
	</MvIF>
	
	<MvIF EXPR = "{ l.type EQ 'percent' }">
		<MvLOCALIZED NAME = "l.xtype" ID = "MER-AFF-00303">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Commission - pct</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ l.xtype }">
	</MvIF>
	
	<MvIF EXPR = "{ l.type EQ 'flat' }">
		<MvLOCALIZED NAME = "l.xtype" ID = "MER-AFF-00304">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Commission - flat</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ l.xtype }">
	</MvIF>
	
	<MvIF EXPR = "{ l.type EQ 'payout' }">
		<MvLOCALIZED NAME = "l.xtype" ID = "MER-AFF-00305">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Payout</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ l.xtype }">
	</MvIF>
	
	<MvIF EXPR = "{ l.type EQ 'adjust' }">
		<MvLOCALIZED NAME = "l.xtype" ID = "MER-AFF-00306">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Adjustment</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ l.xtype }">
	</MvIF>
	
	<MvIF EXPR = "{ l.type EQ '' }">
		<MvFUNCTIONRETURN VALUE = "&nbsp;">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.type }">
</MvFUNCTION>

<MvFUNCTION NAME = "DrawImgButton_Unprocessed" PARAMETERS = "pressed" STANDARDOUTPUTLEVEL = "">
	<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00307">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Unprocessed</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvIF EXPR = "{ l.pressed }">
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'unprocessed_down.gif' }">
	<MvELSE>
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'unprocessed_up.gif' }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ '<IMG ALT = "' $ l.alt $ '" BORDER = 0 SRC = "' $ l.image $ '">' }">
</MvFUNCTION>

<MvFUNCTION NAME = "DrawImgButton_Processed" PARAMETERS = "pressed" STANDARDOUTPUTLEVEL = "">
	<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00308">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvIF EXPR = "{ l.pressed }">
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'processed_down.gif' }">
	<MvELSE>
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'processed_up.gif' }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ '<IMG ALT = "' $ l.alt $ '" BORDER = 0 SRC = "' $ l.image $ '">' }">
</MvFUNCTION>

<MvFUNCTION NAME = "DrawCheck_Processed" PARAMETERS = "checked" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ checked }">
		<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00309">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Processed</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		
		<IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'check.gif' }">
	<MvELSE>
		&nbsp;
	</MvIF>
</MvFUNCTION>

<MvFUNCTION NAME = "DrawCheck_Approved" PARAMETERS = "checked" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ checked }">
		<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00310">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Approved</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		
		<IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'check.gif' }">
	<MvELSE>
		&nbsp;
	</MvIF>
</MvFUNCTION>

<MvFUNCTION NAME = "DrawCheck_Void" PARAMETERS = "checked" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvIF EXPR = "{ checked }">
		<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00311">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Void</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<IMG ALT = "{ l.alt }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'check.gif' }">
	<MvELSE>
		&nbsp;
	</MvIF>
</MvFUNCTION>

<MvFUNCTION NAME = "DrawImgButton_Details" PARAMETERS = "pressed" STANDARDOUTPUTLEVEL = "">
	<MvLOCALIZED NAME = "l.alt" ID = "MER-AFF-00312">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Details</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvIF EXPR = "{ l.pressed }">
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'edit.gif' }">
	<MvELSE>
		<MvASSIGN NAME = "l.image" VALUE = "{ g.AdminGraphics_Path $ 'edit.gif' }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ '<IMG ALT = "' $ l.alt $ '" BORDER = 0 SRC = "' $ l.image $ '">' }">
</MvFUNCTION>

<MvCOMMENT>
|
|
|
|Runtime - merchant.mv
|
|
|
</MvCOMMENT>

<MvFUNCTION NAME = "Affiliate_Validate_Run" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	<MvASSIGN NAME = "l.valid" VALUE = 1>

	<MvASSIGN NAME = "g.Affiliate_Code" VALUE = "{ ltrim( rtrim( g.Affiliate_Code ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.Affiliate_Code ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 1>
	<MvELSE>
		<MvASSIGN NAME = "l.check" VALUE = 1>

		<MvIF EXPR = "{ BasketList.d.session_id }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Session( BasketList.d.session_id ) }">
			<MvIF EXPR = "{ l.found }">
				<MvIF EXPR = "{ toupper( AffiliateSession.d.affil_code ) EQ toupper( g.Affiliate_Code ) }">
					<MvASSIGN NAME = "l.check" VALUE = 0>
				</MvIF>
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ NOT g.Edit_Affiliate OR ( g.Affiliate_Code NE g.Edit_Affiliate ) }">
			<MvIF EXPR = "{ l.check }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
				<MvIF EXPR = "{ l.found }">
					<MvASSIGN NAME = "l.valid" VALUE = 0>
					<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 1>
					<MvASSIGN NAME = "g.Affiliate_Code_InUse" VALUE = 1>
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvASSIGN NAME = "l.valid" VALUE = 1>
			<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Code_InUse" VALUE = 0>
	    </MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Password" VALUE = "{ ltrim( rtrim( g.Affiliate_Password ) ) }">
	<MvASSIGN NAME = "g.Affiliate_VerifyPassword" VALUE = "{ ltrim( rtrim( g.Affiliate_VerifyPassword ) ) }">

	<MvIF EXPR = "{ NOT BasketList.d.session_id }">
		<MvIF EXPR = "{ ( NOT len( g.Affiliate_Password ) ) OR ( NOT len( g.Affiliate_VerifyPassword ) ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Password_Invalid" VALUE = 1>
			<MvASSIGN NAME = "g.Affiliate_VerifyPassword_Invalid" VALUE = 1>
		<MvELSE>
			<MvIF EXPR = "{ ( g.Affiliate_VerifyPassword NE g.Affiliate_Password ) }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Affiliate_VerifyPassword_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvIF EXPR = "{ ( g.Affiliate_VerifyPassword NE g.Affiliate_Password ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_VerifyPassword_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_LostPass_Email" VALUE = "{ ltrim( rtrim( g.Affiliate_LostPass_Email ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_LostPass_Email ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_LostPass_Invalid" VALUE = 1>
	<MvELSE>
		<MvIF EXPR = "{ len( g.Affiliate_LostPass_Email ) }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.email_valid" VALUE = "{ Email_Validate( g.Affiliate_LostPass_Email ) }">
			<MvIF EXPR = "{ NOT l.email_valid }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Affiliate_LostPass_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_SiteName" VALUE = "{ ltrim( rtrim( g.Affiliate_SiteName ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_SiteName ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_SiteName_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_SiteURL" VALUE = "{ ltrim( rtrim( g.Affiliate_SiteURL ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_SiteURL ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_SiteURL_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_ContactName" VALUE = "{ ltrim( rtrim( g.Affiliate_ContactName ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_ContactName ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_ContactName_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Company" VALUE = "{ ltrim( rtrim( g.Affiliate_Company ) ) }">

	<MvASSIGN NAME = "g.Affiliate_Email" VALUE = "{ ltrim( rtrim( g.Affiliate_Email ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Email ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Email_Invalid" VALUE = 1>
	<MvELSE>
		<MvIF EXPR = "{ len( g.Affiliate_Email ) }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.email_valid" VALUE = "{ Email_Validate( g.Affiliate_Email ) }">
			<MvIF EXPR = "{ NOT l.email_valid }">
				<MvASSIGN NAME = "l.valid" VALUE = 0>
				<MvASSIGN NAME = "g.Affiliate_Email_Invalid" VALUE = 1>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Phone" VALUE = "{ ltrim( rtrim( g.Affiliate_Phone ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Phone ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Phone_Invalid" VALUE = 1>
	<MvELSE>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Affiliate_Phone, g.Affiliate_Country ) }">	
		<MvIF EXPR = "{ NOT l.phone_valid }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Phone_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Fax" VALUE = "{ ltrim( rtrim( g.Affiliate_Fax ) ) }">
	<MvIF EXPR = "{ len( g.Affiliate_Fax ) }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.phone_valid" VALUE = "{ Phone_Validate( g.Affiliate_Fax, g.Affiliate_Country ) }">	
		<MvIF EXPR = "{ NOT l.phone_valid }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Fax_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Address" VALUE = "{ ltrim( rtrim( g.Affiliate_Address ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Address ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Address_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_City" VALUE = "{ ltrim( rtrim( g.Affiliate_City ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_City ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_City_Invalid" VALUE = 1>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ ltrim( rtrim( g.Affiliate_State ) ) }">
	<MvIF EXPR = "{ len( g.Affiliate_StateSelect ) }">
		<MvASSIGN NAME = "g.Affiliate_State" VALUE = "{ g.Affiliate_StateSelect }">
	<MvELSE>
		<MvIF EXPR = "{ NOT len( g.Affiliate_State ) }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_State_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Zip" VALUE = "{ ltrim( rtrim( g.Affiliate_Zip ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Zip ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Zip_Invalid" VALUE = 1>
	<MvELSE>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Zip_Validate( g.Affiliate_Zip, g.Affiliate_Country ) }">
		<MvIF EXPR = "{ NOT l.ok }">
			<MvASSIGN NAME = "l.valid" VALUE = 0>
			<MvASSIGN NAME = "g.Affiliate_Zip_Invalid" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Affiliate_Country" VALUE = "{ ltrim( rtrim( g.Affiliate_Country ) ) }">
	<MvIF EXPR = "{ NOT len( g.Affiliate_Country ) }">
		<MvASSIGN NAME = "l.valid" VALUE = 0>
		<MvASSIGN NAME = "g.Affiliate_Country_Invalid" VALUE = 1>
	</MvIF>

	<MvIF EXPR = "{ NOT l.valid }">
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.valid }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Login_Run" STANDARDOUTPUTLEVEL = "">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Affiliate_Login() }">

			<MvIF EXPR = "{ l.result LE 0 }">
				<MvASSIGN NAME = "l.continue" VALUE = 0>

				<MvIF EXPR = "{ l.result EQ 0 }">
					<MvASSIGN NAME = "l.ok" VALUE = 0>
				</MvIF>

				<MvWHILESTOP>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>
	
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
	<MvIF EXPR = "{ AffiliateOptions.d.active }">
		<MvASSIGN NAME = "l.ok" VALUE = 1>
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 1>

			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateLogin() }">
		<MvELSE>
			<MvIF EXPR = "{ g.Affiliate_Password NE Affiliates.d.password }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
				<MvASSIGN NAME = "g.Affiliate_Password_Invalid" VALUE = 1>

				<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateLogin() }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update_Session( Affiliates.d.code, BasketList.d.session_id ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_Login( g.Affiliate_Code ) }">
			</MvIF>
		</MvIF>
	</MvIF>	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Update_Run" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Affiliate_Update() }">

			<MvIF EXPR = "{ l.result LE 0 }">
				<MvASSIGN NAME = "l.continue" VALUE = 0>

				<MvIF EXPR = "{ l.result EQ 0 }">
					<MvASSIGN NAME = "l.ok" VALUE = 0>
				</MvIF>

				<MvWHILESTOP>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>
	
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
	<MvIF EXPR = "{ AffiliateOptions.d.active }">
		<MvIF EXPR = "{ NOT Affiliate_Validate_Run() }">
			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_UpdateAffiliateInformation() }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Find_Session( BasketList.d.session_id ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update_ContactInfo( Affiliates.d.id, g.Affiliate_Code, g.Affiliate_LostPass_Email, g.Affiliate_Password, g.Affiliate_SiteName, g.Affiliate_SiteURL, g.Affiliate_ContactName, g.Affiliate_Email, g.Affiliate_Company, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_Zip, g.Affiliate_Country ) }" >
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.ok }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_Update( g.Affiliate_Code ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_ManageEmail_Run" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax, expression">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
<MvIF EXPR = "{ AffiliateOptions.d.active }">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Affiliate_EmailPassword() }">	

			<MvIF EXPR = "{ l.result LE 0 }">
				<MvASSIGN NAME = "l.continue" VALUE = 0>

				<MvIF EXPR = "{ l.result EQ 0 }">
					<MvASSIGN NAME = "l.ok" VALUE = 0>
				</MvIF>

				<MvWHILESTOP>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 1>

			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateEmail() }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateManage_EmailLoad() }">
			<MvIF EXPR = "{ l.found }">
				<MvIF EXPR = "{ AffiliateManage.d.useto }">
					<MvASSIGN NAME = "l.to" VALUE = "{ AffiliateManage.d.to }">
				<MvELSE>
					<MvASSIGN NAME = "l.to" VALUE = "{ g.Affiliate_Email }">
				</MvIF>

				<MvIF EXPR = "{ AffiliateManage.d.usefrom }">
					<MvASSIGN NAME = "l.from" VALUE = "{ AffiliateManage.d.from }">
				<MvELSE>
					<MvASSIGN NAME = "l.from" VALUE = "{ g.Affiliate_Email }">
				</MvIF>

				<MvIF EXPR = "{ AffiliateManage.d.usecc }">
					<MvASSIGN NAME = "l.cc" VALUE = "{ AffiliateManage.d.cc }">
				<MvELSE>
					<MvASSIGN NAME = "l.cc" VALUE = "{ g.Affiliate_Email }">
				</MvIF>

				<MvASSIGN NAME = "l.subject" VALUE = "{ AffiliateManage.d.subject }">

				<MvASSIGN NAME = "l.lf" VALUE = "{ asciichar( 10 ) }">

				<MvASSIGN NAME = "l.message" VALUE = "{ AffiliateManage.d.header }">

				<MvLOCALIZED NAME = "l.login" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00313">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Login: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.lostpass" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00314">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Lost Password Email: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.sitename" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00315">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site Name: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.siteurl" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00316">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Site URL: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.contact" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00317">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Contact Name: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.email" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00318">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Email: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.company" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00319">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Company: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.phone" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00320">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Phone:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.fax" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00321">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Fax:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.addr" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00322">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Address: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.city" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00323">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">City: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.state" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00324">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">State: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.zip" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00325">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Zip: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.cntry" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace" ID = "MER-AFF-00326">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Country: </MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvLOCALIZED NAME = "l.assign" ID = "MER-AFF-00327">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Affiliate's Information</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ l.lf $ padl( '', 55 - len( l.assign ), ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ '-------------------------------------------------------------------------------------------' }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.login, 21, ' ' ) $ padr( g.Affiliate_Code, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.phone, 21, ' ' ) $ g.Affiliate_Phone }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.lostpass, 21, ' ' ) $ padr( g.Affiliate_LostPass_Email, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.fax, 21, ' ' ) $ g.Affiliate_Fax }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.sitename, 21, ' ' ) $ padr( g.Affiliate_SiteName, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.addr, 21, ' ' ) $ g.Affiliate_Address }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.siteurl, 21, ' ' ) $ padr( g.Affiliate_SiteURL, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.city, 21, ' ' ) $ g.Affiliate_City }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.contact, 21, ' ' ) $ padr( g.Affiliate_ContactName, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.state, 21, ' ' ) $ g.Affiliate_State }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.email, 21, ' ' ) $ padr( g.Affiliate_Email, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.zip, 21, ' ' ) $ g.Affiliate_Zip }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ padr( l.company, 21, ' ' ) $ padr( g.Affiliate_Company, 25, ' ' ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ ' ' $ padr( l.cntry, 21, ' ' ) $ g.Affiliate_Country }">

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ SendEmail( l.to,l.from,l.cc,l.subject,l.headers,l.message ) }">

				<MvIF EXPR = "{ NOT l.ok }">
					<MvLOCALIZED NAME = "g.Error_Send_Email" ID = "MER-AFF-00328">
						<MvLOCALIZED-TOKEN NAME = "error" VALUE = "{ g.Error_Message }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Your email could not be sent at this time. The following error was encountered: %error%</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					

					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_ManageEmail( g.Affiliate_Code ) }">

					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateEmail() }">
				<MvELSE>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_ManageEmail( g.Affiliate_Code ) }">
					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_AffiliateManage() }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			</MvIF>
		</MvIF>
	</MvIF>
</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_EmailPassword_Run" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax, expression">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
<MvIF EXPR = "{ AffiliateOptions.d.active }">
	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Affiliate_EmailPassword() }">	

			<MvIF EXPR = "{ l.result LE 0 }">
				<MvASSIGN NAME = "l.continue" VALUE = 0>

				<MvIF EXPR = "{ l.result EQ 0 }">
					<MvASSIGN NAME = "l.ok" VALUE = 0>
				</MvIF>

				<MvWHILESTOP>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvIF EXPR = "{ l.continue }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( g.Affiliate_Code ) }">
		<MvIF EXPR = "{ NOT l.found }">
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			<MvASSIGN NAME = "g.Affiliate_Code_Invalid" VALUE = 1>

			<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateEmail() }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ AffiliateEmail_Load() }">
			<MvIF EXPR = "{ l.found }">
				<MvASSIGN NAME = "l.from" VALUE = "{ AffiliateEmail.d.from }">
				<MvASSIGN NAME = "l.to" VALUE = "{ Affiliates.d.lpasseml }">
				<MvASSIGN NAME = "l.cc" VALUE = "{ AffiliateEmail.d.cc }">
				<MvASSIGN NAME = "l.subject" VALUE = "{ AffiliateEmail.d.subject }">
				<MvASSIGN NAME = "l.lf" VALUE = "{ asciichar( 10 ) }">
				<MvASSIGN NAME = "l.message" VALUE = "{ AffiliateEmail.d.header $ l.lf }">

				<MvLOCALIZED NAME = "l.pass" ID = "MER-AFF-00329">
					<MvLOCALIZED-TOKEN NAME = "password" VALUE = "{ encodeentities( Affiliates.d.password ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Password: %password%</MvLOCALIZED-TEXT>
				</MvLOCALIZED>					
				<MvASSIGN NAME = "l.message" VALUE = "{ l.message $ l.lf $ l.pass $l.lf }">

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ SendEmail( l.to,l.from,l.cc,l.subject,l.headers,l.message ) }">

				<MvIF EXPR = "{ NOT l.ok }">
					<MvLOCALIZED NAME = "g.Error_Send_Email" ID = "MER-AFF-00330">
						<MvLOCALIZED-TOKEN NAME = "error" VALUE = "{ g.Error_Message }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Your email could not be sent at this time. The following error was encountered: %error%</MvLOCALIZED-TEXT>
					</MvLOCALIZED>					
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_EmailPassword( g.Affiliate_Code ) }">
					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_AffiliateEmail() }">
				<MvELSE>
					<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_EmailPassword( g.Affiliate_Code ) }">
					<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_AffiliateEmail_Sent() }">
				</MvIF>

				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.null" VALUE = "{ Data_Entry_Error( '' ) }">
			</MvIF>
		</MvIF>
	</MvIF>
</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Insert_Run" STANDARDOUTPUTLEVEL = ""> 
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.continue" VALUE = 1>

	<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindFirst_Type( 'SYSTEM' ) }">
	<MvWHILE EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.module_api_version" VALUE = "{ Module_API_Version() }">
		<MvIF EXPR = "{ l.module_api_version GE 4.00 }">
			<MvDO FILE = "{ g.Module_Root $ Modules.d.module }" NAME = "l.result" VALUE = "{ SystemModule_Action_Affiliate_Insert() }">

			<MvIF EXPR = "{ l.result LE 0 }">
				<MvASSIGN NAME = "l.continue" VALUE = 0>

				<MvIF EXPR = "{ l.result EQ 0 }">
					<MvASSIGN NAME = "l.ok" VALUE = 0>
				</MvIF>

				<MvWHILESTOP>
			</MvIF>
		</MvIF>

		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ StoreModule_FindNext_Type( 'SYSTEM' ) }">
	</MvWHILE>

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">
	<MvIF EXPR = "{ AffiliateOptions.d.active }">
		<MvIF EXPR = "{ l.continue }">
			<MvIF EXPR = "{ NOT Affiliate_Validate_Run() }">
				<MvDO FILE = "{ g.Module_Store_Module_UI }" NAME = "l.ok" VALUE = "{ UIModule_Invalid_InsertAffiliateInformation() }">
			<MvELSE>
				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Insert( g.Affiliate_Code, g.Affiliate_Password, g.Affiliate_LostPass_Email, g.Affiliate_SiteName, g.Affiliate_SiteURL, g.Affiliate_ContactName, g.Affiliate_Email, g.Affiliate_Company, g.Affiliate_Phone, g.Affiliate_Fax, g.Affiliate_Address, g.Affiliate_City, g.Affiliate_State, g.Affiliate_Zip, g.Affiliate_Country, AffiliateOptions.d.hits, AffiliateOptions.d.percent, AffiliateOptions.d.flat, g.Affiliate_Status, g.Session_ID ) }">

				<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.foo" VALUE = "{ AffiliateManage_EmailLoad() }">
				<MvIF EXPR = "{ AffiliateManage.d.active }">
					<MvASSIGN NAME = "l.ok" VALUE = "{ Action_Affiliate_ManageEmail_Run() }">
				</MvIF>
			</MvIF>
			<MvIF EXPR = "{ l.ok }">
				<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Log_Action_Affiliate_Insert( g.Affiliate_Code ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Action_Affiliate_Logout_Run" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "0">

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Session( BasketList.d.session_id ) }">
	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update_Session( Affiliates.d.code, '' ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Provision_Update_AffiliateManage" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateManage_EmailLoad() }">

	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">

	<MvASSIGN NAME = "l.active" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.from" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.to" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cc" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.subject" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.header" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
			
	<MvIF EXPR = "{ len( l.active ) }">
		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "AffiliateManage.d.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
	</MvIF>
	
	
	
	<MvIF EXPR = "{ len( l.from ) }">
		<MvIF EXPR = "{ toupper( l.from ) EQ '#AFFILIATE#' }">
			<MvASSIGN NAME = "AffiliateManage.d.usefrom" VALUE = "0">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateManage.d.usefrom" VALUE = "1">
			<MvASSIGN NAME = "AffiliateManage.d.from" VALUE = "{ l.from }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.to ) }">
		<MvIF EXPR = "{ toupper( l.to ) EQ '#AFFILIATE#' }">
			<MvASSIGN NAME = "AffiliateManage.d.useto" VALUE = "0">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateManage.d.useto" VALUE = "1">
			<MvASSIGN NAME = "AffiliateManage.d.to" VALUE = "{ l.to }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.cc ) }">
		<MvIF EXPR = "{ toupper( l.cc ) EQ '#AFFILIATE#' }">
			<MvASSIGN NAME = "AffiliateManage.d.usecc" VALUE = "0">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateManage.d.usecc" VALUE = "1">
			<MvIF EXPR = "{ toupper( l.cc ) EQ '#NONE#' }">
				<MvASSIGN NAME = "AffiliateManage.d.cc" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "AffiliateManage.d.cc" VALUE = "{ l.cc }">
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ len( l.subject ) }">
		<MvASSIGN NAME = "AffiliateManage.d.subject" VALUE = "{ l.subject }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.header ) }">
		<MvIF EXPR = "{ toupper( l.header ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateManage.d.header" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateManage.d.header" VALUE = "{ l.header }">
		</MvIF>
	</MvIF>
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateManage_Update( AffiliateManage.d.active, AffiliateManage.d.usefrom, AffiliateManage.d.from, AffiliateManage.d.useto, AffiliateManage.d.to, AffiliateManage.d.usecc,  AffiliateManage.d.cc, AffiliateManage.d.subject, AffiliateManage.d.header ) }">

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Provision_Update_AffiliateEmail" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEmail_Load() }">

	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">

	<MvASSIGN NAME = "l.from" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cc" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.subject" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.header" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
			
	<MvIF EXPR = "{ len( l.active ) }">
		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "AffiliateEmail.d.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
	</MvIF>
	
	
	
	<MvIF EXPR = "{ len( l.from ) }">
		<MvASSIGN NAME = "AffiliateEmail.d.from" VALUE = "{ l.from }">
	</MvIF>

	<MvIF EXPR = "{ len( l.cc ) }">
		<MvIF EXPR = "{ toupper( l.cc ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateEmail.d.cc" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateEmail.d.cc" VALUE = "{ l.cc }">
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ len( l.subject ) }">
		<MvASSIGN NAME = "AffiliateEmail.d.subject" VALUE = "{ l.subject }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.header ) }">
		<MvIF EXPR = "{ toupper( l.header ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateEmail.d.header" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateEmail.d.header" VALUE = "{ l.header }">
		</MvIF>
	</MvIF>
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateEmail_Update( AffiliateEmail.d.from, AffiliateEmail.d.cc, AffiliateEmail.d.subject, AffiliateEmail.d.header ) }">

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Provision_Update_AffiliateOptions" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Find() }">

	<MvASSIGN NAME = "l.ok" VALUE = "1">
			
	<MvASSIGN NAME = "l.pos" VALUE = "1">

	<MvASSIGN NAME = "l.active" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.signup" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.hits" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.percent" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.flat" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.terms" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.payout_threshold" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.link_image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.link_text" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.pselect" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
			
	<MvIF EXPR = "{ len( l.active ) }">
		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "AffiliateOptions.d.active" VALUE = "{ PRV_Parse_Boolean( l.active ) }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.signup ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.signup" VALUE = "{ toupper( substring( l.signup, 1, 1 ) ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.hits ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.hits" VALUE = "{ l.hits }">
	</MvIF>

	<MvIF EXPR = "{ len( l.percent ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.percent" VALUE = "{ l.percent }">
	</MvIF>

	<MvIF EXPR = "{ len( l.pselect ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.pct_slt" VALUE = "{ toupper( substring( l.pselect, 1, 1 ) ) }">
	</MvIF>

	<MvIF EXPR = "{ len( l.flat ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.flat" VALUE = "{ l.flat }">
	</MvIF>

	<MvIF EXPR = "{ len( l.payout_threshold ) }">
		<MvASSIGN NAME = "AffiliateOptions.d.pay_thresh" VALUE = "{ l.payout_threshold }">
	</MvIF>

	<MvIF EXPR = "{ len( l.terms ) }">
		<MvIF EXPR = "{ toupper( l.terms ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateOptions.d.terms" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateOptions.d.terms" VALUE = "{ l.terms }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.link_image ) }">
		<MvIF EXPR = "{ toupper( l.link_image ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateOptions.d.link_image" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateOptions.d.link_image" VALUE = "{ l.link_image }">
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.link_text ) }">
		<MvIF EXPR = "{ toupper( l.link_text ) EQ '#NONE#' }">
			<MvASSIGN NAME = "AffiliateOptions.d.link_text" VALUE = "">
		<MvELSE>
			<MvASSIGN NAME = "AffiliateOptions.d.link_text" VALUE = "{ l.link_text }">
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ AffiliateOptions_Update( AffiliateOptions.d.active, AffiliateOptions.d.signup, AffiliateOptions.d.hits, AffiliateOptions.d.percent, AffiliateOptions.d.pct_slt, AffiliateOptions.d.flat, AffiliateOptions.d.pay_thresh, AffiliateOptions.d.terms, AffiliateOptions.d.link_image, AffiliateOptions.d.link_text ) }">

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Provision_Add_Update_Affiliate" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvASSIGN NAME = "l.pos" VALUE = "1">

	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.password" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.lostpass_email" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.site_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.site_url" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.contact_name" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.email" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.company" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.phone" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.fax" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.address" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.city" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.state" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.zip" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.country" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.hits" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.percent" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.flat" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.status" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ l.status EQ 'A' }">
		<MvASSIGN NAME = "l.status" VALUE = "Approved">
	<MvELSE>
		<MvIF EXPR = "{ l.status EQ 'P' }">
			<MvASSIGN NAME = "l.status" VALUE = "Pending">
		<MvELSE>
			<MvIF EXPR = "{ l.status EQ 'R' }">
				<MvASSIGN NAME = "l.status" VALUE = "Rejected">
			<MvELSE>
				<MvASSIGN NAME = "l.status" VALUE = "Pending">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00331">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Affiliate code required
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-AFF-00000', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.password ) }">
			<MvASSIGN NAME = "Affiliates.d.password" VALUE = "{ l.password }">
		</MvIF>

		<MvIF EXPR = "{ len( l.lostpass_email ) }">
			<MvASSIGN NAME = "Affiliates.d.lpasseml" VALUE = "{ l.lostpass_email }">
		</MvIF>
		
		<MvIF EXPR = "{ len( l.site_name ) }">
			<MvIF EXPR = "{ toupper( l.site_name ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.site_name" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.site_name" VALUE = "{ l.site_name }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.site_url ) }">
			<MvIF EXPR = "{ toupper( l.site_url ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.site_url" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.site_url" VALUE = "{ l.site_url }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.contact_name ) }">
			<MvIF EXPR = "{ toupper( l.contact_name ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.con_name" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.con_name" VALUE = "{ l.contact_name }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.email ) }">
			<MvIF EXPR = "{ toupper( l.email ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.email" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.email" VALUE = "{ l.email }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.company ) }">
			<MvIF EXPR = "{ toupper( l.company ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.company" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.company" VALUE = "{ l.company }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.phone ) }">
			<MvIF EXPR = "{ toupper( l.phone ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.phone" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.phone" VALUE = "{ l.phone }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.fax ) }">
			<MvIF EXPR = "{ toupper( l.fax ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.fax" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.fax" VALUE = "{ l.fax }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.address ) }">
			<MvIF EXPR = "{ toupper( l.address ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.addr" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.addr" VALUE = "{ l.address }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.city ) }">
			<MvIF EXPR = "{ toupper( l.city ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.city" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.city" VALUE = "{ l.city }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.state ) }">
			<MvIF EXPR = "{ toupper( l.state ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.state" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.state" VALUE = "{ l.state }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.zip ) }">
			<MvIF EXPR = "{ toupper( l.zip ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.zip" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.zip" VALUE = "{ l.zip }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.country ) }">
			<MvIF EXPR = "{ toupper( l.country ) EQ '#NONE#' }">
				<MvASSIGN NAME = "Affiliates.d.cntry" VALUE = "">
			<MvELSE>
				<MvASSIGN NAME = "Affiliates.d.cntry" VALUE = "{ l.country }">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ len( l.hits ) }">
			<MvASSIGN NAME = "Affiliates.d.hits" VALUE = "{ l.hits }">
		</MvIF>

		<MvIF EXPR = "{ len( l.percent ) }">
			<MvASSIGN NAME = "Affiliates.d.percent" VALUE = "{ l.percent }">
		</MvIF>

		<MvIF EXPR = "{ len( l.flat ) }">
			<MvASSIGN NAME = "Affiliates.d.flat" VALUE = "{ l.flat }">
		</MvIF>

		<MvIF EXPR = "{ len( l.status ) }">
			<MvASSIGN NAME = "Affiliates.d.status" VALUE = "{ l.status }">
		</MvIF>
	
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Update( Affiliates.d.id, Affiliates.d.code, Affiliates.d.password, Affiliates.d.lpasseml, Affiliates.d.site_name, Affiliates.d.site_url, Affiliates.d.con_name, Affiliates.d.email, Affiliates.d.company, Affiliates.d.phone, Affiliates.d.fax, Affiliates.d.addr, Affiliates.d.city, Affiliates.d.state, Affiliates.d.zip, Affiliates.d.cntry, Affiliates.d.hits, Affiliates.d.percent, Affiliates.d.flat, Affiliates.d.status, '' ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.password ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00332">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					password required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-AFF-00001', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		
		<MvIF EXPR = "{ len( l.status ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00346">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					status required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-AFF-00003', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvIF EXPR = "{ len( l.hits ) EQ 0}">
			<MvASSIGN NAME = "l.hits" VALUE = "{ AffiliateOptions.d.hits }">
		</MvIF>

		<MvIF EXPR = "{ len( l.percent ) EQ 0}">
			<MvASSIGN NAME = "l.percent" VALUE = "{ AffiliateOptions.d.percent }">
		</MvIF>

		<MvIF EXPR = "{ len( l.flat ) EQ 0}">
			<MvASSIGN NAME = "l.flat" VALUE = "{ AffiliateOptions.d.flat }">
		</MvIF>
		
		<MvIF EXPR = "{ toupper( l.site_name ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.site_name" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.site_url ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.site_url" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.contact_name ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.contact_name" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.email ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.email" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.company ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.company" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.phone ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.phone" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.fax ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.fax" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.address ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.address" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.city ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.city" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.state ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.state" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.zip ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.zip" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ toupper( l.country ) EQ '#NONE#' }">
			<MvASSIGN NAME = "l.country" VALUE = "">
		</MvIF>

		<MvIF EXPR = "{ NOT len( l.status ) EQ 0 }">
			<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Insert( l.code, l.password, l.lostpass_email, l.site_name, l.site_url, l.contact_name, l.email, l.company, l.phone, l.fax, l.address, l.city, l.state, l.zip, l.country, l.hits, l.percent, l.flat, l.status, '' ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Provision_Delete_Affiliate" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">

	<MvASSIGN NAME = "l.pos" VALUE = "1">

	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-AFF-00333">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				Affiliate code required
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-AFF-00002', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.found" VALUE = "{ Affiliates_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
	
		<MvDO FILE = "{ g.Module_Feature_AFF_DB }" NAME = "l.ok" VALUE = "{ Affiliates_Delete( Affiliates.d.id ) }">
	</MvIF>


	<MvFUNCTIONRETURN VALUE = "l.ok">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Upgrade_Setup_State" STANDARDOUTPUTLEVEL = "">
	<MvCOMMENT>
	|
	| affil.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'affil.dbf',
																	   'id 			NUMBER,
																		code		CHAR( 50 ),
																		password	CHAR( 40 ),
																		lpasseml	CHAR( 254 ),
																		site_name	CHAR( 254 ),
																		site_url	CHAR( 254 ),
																		con_name	CHAR( 254 ),
																		email		CHAR( 254 ),
																		company		CHAR( 50 ),
																		phone		CHAR( 50 ),
																		fax			CHAR( 50 ),
																		addr		CHAR( 100 ),
																		city		CHAR( 50 ),
																		state		CHAR( 50 ),
																		zip			CHAR( 50 ),
																		cntry		CHAR( 50 ),
																		hits		NUMBER( 10.4 ),
																		percent		NUMBER( 10.2 ),
																		flat		NUMBER( 10.2 ),
																		lstpay_id	NUMBER,
																		lstpay_amt	NUMBER( 10.2 ),
																		lstpay_dt	NUMBER,
																		lstpay_by	NUMBER,
																		balance		NUMBER( 10.4 ),
																		status		CHAR( 10 ),
																		status_dt	NUMBER,
																		status_by	NUMBER,
																		session_id  CHAR( 40 )' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'Affiliates', 'affil.dbf', 'affil_i.mvx', 'Affiliates.d.id', 'unique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'Affiliates', 'affil.dbf', 'affil_c.mvx', 'toupper( Affiliates.d.code )', 'nounique, ascending, string' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'Affiliates', 'affil.dbf', 'affil_s.mvx', 'toupper( Affiliates.d.session_id )', 'nounique, ascending, string' ) }">

	<MvCOMMENT>
	|
	| affern.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'affern.dbf',
																	   'id			NUMBER,
																		aff_id 		NUMBER,
																		date		NUMBER,
																		type		CHAR( 10 ),
																		order_id	NUMBER,
																		order_amt	NUMBER( 10.2 ),
																		percent		NUMBER( 10.2 ),
																		amount		NUMBER( 10.4 ),
																		void		BOOL,
																		void_reasn	CHAR( 250 ),
																		void_by		NUMBER,
																		adjst_reas	CHAR( 250 ),
																		adjst_by	NUMBER,
																		payout_id	NUMBER,
																		ip_address	CHAR( 50 )' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliateEarnings', 'affern.dbf', 'affern_i.mvx', 'AffiliateEarnings.d.id', 'unique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliateEarnings', 'affern.dbf', 'affern_a.mvx', 'toupper( AffiliateEarnings.d.aff_id $ \':\' $ padl( AffiliateEarnings.d.date, 10, 0 ) )', 'nounique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliateEarnings', 'affern.dbf', 'affern_p.mvx', 'toupper( AffiliateEarnings.d.payout_id $ \':\' $ padl( AffiliateEarnings.d.aff_id, 10, 0 ) )', 'nounique, ascending' ) }">

	<MvCOMMENT>
	|
	| affpay.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'affpay.dbf',
							   'id			NUMBER,
								date		NUMBER,
								amount		NUMBER( 10.2 ),
								count		NUMBER,
								user_id		NUMBER,
								pay_by		NUMBER,
								processed	BOOL,
								proc_by		NUMBER,
								proc_date	NUMBER,
								void		BOOL,
								void_reasn	CHAR( 250 ),
								void_date	NUMBER,
								void_by		NUMBER' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliatePayouts', 'affpay.dbf', 'affpay_i.mvx', 'AffiliatePayouts.d.id', 'unique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliatePayouts', 'affpay.dbf', 'affpay_d.mvx', 'AffiliatePayouts.d.date', 'nounique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliatePayouts', 'affpay.dbf', 'affpay_u.mvx', 'AffiliatePayouts.d.user_id $ \':\' $ padl( AffiliatePayouts.d.date, 10, 0 )', 'nounique, ascending' ) }">

	<MvCOMMENT>
	|
	| afileml.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'afileml.dbf',
							   'from		CHAR( 254 ),
								cc			CHAR( 254 ),
								subject		CHAR( 254 ),
								header   	MEMO' ) }">

	<MvCOMMENT>
	|
	| afilmng.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'afilmng.dbf',
							   'active 		BOOL,
								useto		BOOL,
								usefrom		BOOL,
								usecc		BOOL,
								from		CHAR( 254 ),
								to		   	CHAR( 254 ),
								cc			CHAR( 254 ),
								subject		CHAR( 254 ),
								header		MEMO' ) }">

	<MvCOMMENT>
	|
	| afilopt.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'afilopt.dbf',
							   'active 		BOOL,
								signup 		CHAR( 10 ),
								hits		NUMBER( 10.4 ),
								percent		NUMBER( 10.2 ),
								flat		NUMBER( 10.2 ),
								terms		MEMO,
								pay_thresh	NUMBER( 10.2 ),
								link_image	CHAR( 254 ),
								link_text	CHAR( 254 )' ) }">


	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Change_Insert( 4.10, 'afilopt.dbf',
							   'active 		BOOL,
								signup 		CHAR( 10 ),
								hits		NUMBER( 10.4 ),
								percent		NUMBER( 10.2 ),
								pct_slt		CHAR( 10 ),
								flat		NUMBER( 10.2 ),
								terms		MEMO,
								pay_thresh	NUMBER( 10.2 ),
								link_image	CHAR( 254 ),
								link_text	CHAR( 254 )' ) }">

	<MvCOMMENT>
	|
	| affsess.dbf
	| *********************************************************************************************
	|
	| 4.00: Created
	|
	</MvCOMMENT>

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'affsess.dbf',
							   'session_id	CHAR( 40 ),
								affil_code	CHAR( 50 )' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliateSession', 'affsess.dbf', 'aff_sid.mvx', 'AffiliateSession.d.session_id', 'nounique, ascending, string' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AffiliateSession', 'affsess.dbf', 'aff_cod.mvx', 'AffiliateSession.d.affil_code', 'nounique, ascending, string' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.ok" VALUE = "{ Store_Key_New_Insert( 4.00, 'Affiliates', 1 ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.ok" VALUE = "{ Store_Key_New_Insert( 4.00, 'AffiliateEarnings', 1 ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.ok" VALUE = "{ Store_Key_New_Insert( 4.00, 'AffiliatePayouts', 1 ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.ok" VALUE = "{ Store_Key_New_Insert( 4.00, 'AffiliateEarningsVoid', 1 ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Domain_Privilege_New_Insert( 4.00, 'MONY' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Domain_Privilege_New_Insert( 4.00, 'AFLT' ) }">

</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Upgrade_Store_DB_New_AffiliateEmail" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "Temporary.d.from" VALUE = "{ Upgrade_Domain.d.email }">
	<MvASSIGN NAME = "Temporary.d.cc" VALUE = "">

	<MvLOCALIZED NAME = "Temporary.d.subject" ID = "MER-ADB-00002">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Your affiliate password</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvLOCALIZED NAME = "Temporary.d.header" ID = "MER-ADB-00003">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Here is the Affiliate Account information you requested.</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvADD NAME = "Temporary">
	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Upgrade_Store_DB_New_AffiliateManage">
	<MvASSIGN NAME = "Temporary.d.usefrom" VALUE = "0">
	<MvASSIGN NAME = "Temporary.d.useto" VALUE = "0">
	<MvASSIGN NAME = "Temporary.d.usecc" VALUE = "1">						
	<MvASSIGN NAME = "Temporary.d.from" VALUE = "">
	<MvASSIGN NAME = "Temporary.d.to" VALUE = "">
	<MvASSIGN NAME = "Temporary.d.cc" VALUE = "">

	<MvLOCALIZED NAME = "Temporary.d.subject" ID = "MER-ADB-00004">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Affiliate Created</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvLOCALIZED NAME = "Temporary.d.header" ID = "MER-ADB-00005">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">The following affiliate has been created:</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvADD NAME = "Temporary">

	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Upgrade_Store_DB_New_AffiliateOptions">
	<MvASSIGN NAME = "Temporary.d.active" VALUE = "">
	<MvASSIGN NAME = "Temporary.d.signup" VALUE = "A">
	<MvASSIGN NAME = "Temporary.d.hits" VALUE = "0.00">
	<MvASSIGN NAME = "Temporary.d.percent" VALUE = "0.00">
	<MvASSIGN NAME = "Temporary.d.flat" VALUE = "0.00">
	<MvASSIGN NAME = "Temporary.d.terms" VALUE = "">
	<MvASSIGN NAME = "Temporary.d.pay_thresh" VALUE = "0.00">
	<MvASSIGN NAME = "Temporary.d.link_image" VALUE = "">
	<MvASSIGN NAME = "Temporary.d.link_text" VALUE = "">

	<MvADD NAME = "Temporary">
	
	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>

<MvFUNCTION NAME = "AFF_Upgrade_Store_DB_Change_AffiliateOptions">
	<MvASSIGN NAME = "Temporary.d.active" VALUE = "{ Original.d.active }">
	<MvASSIGN NAME = "Temporary.d.signup" VALUE = "{ Original.d.signup }">
	<MvASSIGN NAME = "Temporary.d.hits" VALUE = "{ Original.d.hits }">
	<MvASSIGN NAME = "Temporary.d.percent" VALUE = "{ Original.d.percent }">
	<MvASSIGN NAME = "Temporary.d.flat" VALUE = "{ Original.d.flat }">
	<MvASSIGN NAME = "Temporary.d.terms" VALUE = "{ Original.d.terms }">
	<MvASSIGN NAME = "Temporary.d.pay_thresh" VALUE = "{ Original.d.pay_thresh }">
	<MvASSIGN NAME = "Temporary.d.link_image" VALUE = "{ Original.d.link_image }">
	<MvASSIGN NAME = "Temporary.d.link_text" VALUE = "{ Original.d.link_text }">

	<MvIF EXPR = "{ g.Upgrade_Version_From LT 4.10 }">
		<MvASSIGN NAME = "Temporary.d.pct_slt" VALUE = "O">
	<MvELSE>
		<MvASSIGN NAME = "Temporary.d.pct_slt" VALUE = "{ Original.d.pct_slt }">
	</MvIF>

	<MvADD NAME = "Temporary">
	
	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>
