<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/
|
| dBase III Database Layer
| $Source: /home/cvs/merchant/Merchant/features/att/att.mv,v $
|
| Prefix         : MER-ATT-
| Next Error Code: 16   
| Next Text ID   : 91   
|
</MvCOMMENT>

<MvFUNCTION NAME = "ATT_Navigation" STANDARDOUTPUTLEVEL = "text,html,compresswhitespace">
	<MvLOCALIZED NAME = "l.label"  ID = "MER-ADM-00856">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Templates</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.leftnav" VALUE = "{ LeftNavigation_Level( 2, 'ATMP(' $ Stores.d.id $ ')', 'Screen=ATBE&Store_Code=' $ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
	<MvIF EXPR = "{ l.leftnav }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can" VALUE = "{ CanI( 'ATMP', 0, 1, 0, 0 ) }">
		<MvIF EXPR = "{ l.can }">
			<MvLOCALIZED NAME = "l.label" ID = "MER-ADM-00857">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Attribute Template</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.leftnav" VALUE = "{ LeftNavigation_Dot( 3, 'Screen=ATMP&Store_Code=' $ encodeattribute( Stores.d.code ), 'Main', l.label ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

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

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( g.Edit_AttributeTemplate ) }">
	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AttributeTemplate_Validate() }">
		
		<MvIF EXPR = "{ l.valid }">
			<MvASSIGN NAME = "l.template_code" VALUE = "{ AttributeTemplates.d.code }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Delete( AttributeTemplates.d.code ) }">

			<MvIF EXPR = "{ l.ok }">
				<MvLOCALIZED NAME = "g.Message"  ID = "MER-ATT-000001">
					<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ encodeentities( l.template_code ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Template '%code%' deleted</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvASSIGN NAME = "g.Edit_AttributeTemplate" VALUE = "">
				<MvASSIGN NAME = "g.Tab" VALUE = "">
			</MvIF>
		</MvIF>
	</MvIF>

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

<MvFUNCTION NAME = "Action_AttributeTemplates_BatchEdit_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" VALUE = "{ CanI( 'ATMP', 0, 0, 1, 0 ) }">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.can_delete" VALUE = "{ CanI( 'ATMP', 0, 0, 0, 1 ) }">

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

	<MvIF EXPR = "{ l.valid }">
		<MvIF EXPR = "{ l.ok AND l.can_modify }">
			<MvIF EXPR = "{ len( g.Edit_AttributeTemplates ) NE 0 }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Update( g.Edit_AttributeTemplates, g.AttributeTemplates_Code, g.AttributeTemplates_Name ) }">
				<MvASSIGN NAME = "l.modified" VALUE = "1">
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.ok AND l.can_delete }">
			<MvASSIGN NAME = "l.AttributeTemplates" VALUE = 1>
			<MvWHILE EXPR = "{ l.ok AND ( l.AttributeTemplates LE g.AttributeTemplates_Count ) }">
				<MvIF EXPR = "{ g.AttributeTemplates_Remove[ l.AttributeTemplates ] }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Delete( g.AttributeTemplates_Remove_Code[ l.AttributeTemplates ] ) }">
					<MvASSIGN NAME = "l.modified" VALUE = "1">
				</MvIF>

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

		<MvIF EXPR = "{ l.ok AND l.can_modify }">
			<MvASSIGN NAME = "g.Edit_AttributeTemplates" VALUE = "">
			<MvASSIGN NAME = "g.Edit_AttributeTemplates_Code" VALUE = "">

			<MvIF EXPR = "{ l.modified }">
				<MvLOCALIZED NAME = "g.Message"  ID = "MER-ATT-000002">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Templates table updated</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
			<MvELSE>
				<MvASSIGN NAME = "g.Message" VALUE = "">
			</MvIF>
		</MvIF>
	</MvIF>

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

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

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

	<MvIF EXPR = "{ NOT g.Have_List_Fields }">
		<MvASSIGN NAME = "g.AttributeTemplates_Stack" VALUE = "">
		<MvASSIGN NAME = "g.AttributeTemplates_Search" VALUE = "">
		<MvASSIGN NAME = "g.AttributeTemplates_Offset" VALUE = 0>
		<MvASSIGN NAME = "g.AttributeTemplates_Display" VALUE = "{ g.Admin_User_PageLen }">
	<MvELSE>
		<MvASSIGN NAME = "g.AttributeTemplates_Display" VALUE = "{ int( g.AttributeTemplates_Display ) }">
		<MvIF EXPR = "{ g.AttributeTemplates_Display LT 1 }">
			<MvASSIGN NAME = "g.AttributeTemplates_Display" VALUE = 1>
		</MvIF>
	</MvIF>

	<MvLOCALIZED NAME = "l.screen_label"  ID = "MER-ATT-000003">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Templates</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ BeginScreen( l.screen_label, 'ATBE', 'Help:atbe.html' ) }">
	<INPUT TYPE = "hidden" NAME = "Have_List_Fields" VALUE = "1">

	<MvLOCALIZED NAME = "l.tab_list"  ID = "MER-ATT-000004">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">ATBE:Attribute Templates</MvLOCALIZED-TEXT>
	</MvLOCALIZED>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawTabs( 'ATBE', l.tab_list ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ BeginContent() }">
	<SCRIPT LANGUAGE = "JavaScript">
<!--
function EditAttributeTemplate( AttributeTemplates_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplates' ].value = unescape( AttributeTemplates_code );
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

//-->
	</SCRIPT>

	<MvHIDE FIELDS = "g.Edit_AttributeTemplates">

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

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

	<MvIF EXPR = "{ len( g.Edit_AttributeTemplates ) EQ 0 AND
					l.can_delete }">
		<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
			<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1"><B>
			<MvLOCALIZED  ID = "MER-ATT-000006">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			</B></FONT>
			<BR>
			<MvLOCALIZED NAME = "l.check_all" ID = "MER-ATT-00088">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Check All</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

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

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

	<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1"><B>
		<MvLOCALIZED  ID = "MER-ATT-000007">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Code</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" WIDTH = "100%">
		<FONT FACE = "Arial, Helvetica" COLOR = "#ffffff" SIZE = "-1"><B>
		<MvLOCALIZED  ID = "MER-ATT-000008">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Prompt</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		</B></FONT>
	</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
		<FONT FACE = "Arial, Helvetica" SIZE = "-1">
		<MvIF EXPR = "{ l.can_add }">
			<MvLOCALIZED NAME = "l.alt"  ID = "MER-ATT-000009">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Attribute Template</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

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

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

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.nextoffset" VALUE = "{ AttributeTemplates_FindOffset_All( g.AttributeTemplates_Offset, g.AttributeTemplates_Search ) }">
	<MvWHILE EXPR = "{ ( l.shown LT g.AttributeTemplates_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>

		<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplates ) NE 0 ) AND
						( g.Edit_AttributeTemplates EQ AttributeTemplates.d.code ) }">
			<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
				<MvASSIGN NAME = "g.AttributeTemplates_Code" VALUE = "{ AttributeTemplates.d.code }">
				<MvASSIGN NAME = "g.AttributeTemplates_ID" VALUE = "{ AttributeTemplates.d.id }">
				<MvASSIGN NAME = "g.AttributeTemplates_Name" VALUE = "{ AttributeTemplates.d.prompt }">
			</MvIF>

			<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "hidden" NAME = "AttributeTemplates_ID" VALUE = "{ encodeentities( g.AttributeTemplates_ID) }">
				<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplates_Code" VALUE = "{ encodeentities( g.AttributeTemplates_Code ) }" ONCHANGE = "SetModified();">
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = 30 NAME = "AttributeTemplates_Name" VALUE = "{ encodeentities( g.AttributeTemplates_Name ) }" ONCHANGE = "SetModified();">
				</FONT>
			</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere( '1' ) }">
					<A HREF = "JavaScript:EditAttributeTemplate( '' );"><MvEVAL EXPR = "{ l.button }"></A>

					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Edit('0')  }">
					<A HREF = "{ g.sessionurl $ 'Screen=ATMP&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_AttributeTemplate=' $ encodeattribute( AttributeTemplates.d.code ) }"><MvEVAL EXPR = "{ l.button }"></A>
				</FONT>
			</TD></TR>
		<MvELSE>
			<TR>

			<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplates ) EQ 0 ) AND
							l.can_delete }">
				<TD ALIGN = "center" VALIGN = "middle" NOWRAP BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "hidden" NAME = "{ 'AttributeTemplates_Remove_Code[' $ l.shown $ ']' }" VALUE = "{ encodeentities( AttributeTemplates.d.code ) }">
					<INPUT TYPE = "checkbox" NAME = "{ 'AttributeTemplates_Remove[' $ l.shown $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
					</FONT>
				</TD>
			</MvIF>

			<TD ALIGN = "left" VALIGN = "middle" NOWRAP BGCOLOR = "{ l.bgcolor }">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ len( AttributeTemplates.d.code ) }">
					<MvEVAL EXPR = "{ encodeentities( AttributeTemplates.d.code ) }">
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" NOWRAP BGCOLOR = "{ l.bgcolor }">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvEVAL EXPR = "{ encodeentities( AttributeTemplates.d.prompt ) }">
				</FONT>
			</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ l.can_modify }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere('0') }">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode" VALUE = "{ JavaScriptEncode( AttributeTemplates.d.code ) }">
					<A HREF = "{ 'JavaScript:EditAttributeTemplate( \'' $ l.encode $ '\' );' }"><MvEVAL EXPR = "{ l.button }"></A>
				<MvELSE>
					&nbsp;
				</MvIF>
				
				<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Edit('0')  }">
				<A HREF = "{ g.sessionurl $ 'Screen=ATMP&Store_Code=' $ encodeattribute( g.Store_Code ) $ '&Edit_AttributeTemplate=' $ encodeattribute( AttributeTemplates.d.code ) }"><MvEVAL EXPR = "{ l.button }"></A>
				</FONT>
			</TD></TR>
		</MvIF>

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

		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.nextoffset" VALUE = "{ AttributeTemplates_FindNext_All( l.nextoffset, g.AttributeTemplates_Search ) }">
	</MvWHILE>

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

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

		 <MvIF EXPR = "{ l.nextoffset }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Next('0') }">
			<MvEVAL EXPR = "{ '<A HREF = "JavaScript:ListNext( \'AttributeTemplates_Offset\', \'AttributeTemplates_Stack\', ' $ l.lastoffset $ ' );">' }"><MvEVAL EXPR = "{ l.button }"><MvEVAL EXPR = "</A>">
		 </MvIF>
		</FONT>
	</TD></TR>
	</TABLE>
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ EndContent() }">

	<MvIF EXPR = "{ l.can_modify OR l.can_delete OR l.can_add }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( 'ATBE:[UPDATE]' ) }">
		<MvEVAL EXPR = "{ l.button }">
	<MvELSE>
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawButtons( '' ) }">
		<MvEVAL EXPR = "{ l.button }">
	</MvIF>
	<MvASSIGN NAME = "g.EndScreen" VALUE = "1">
	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ EndScreen() }">

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

<MvFUNCTION NAME = "AttributeTemplate_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AttributeTemplate_Code" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Code ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Prompt" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Prompt ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.AttributeTemplate_Code ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATMP', 'AttributeTemplate_Code', g.Validation_Message ) }">
	<MvELSE>
		<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplate ) EQ 0 ) OR ( toupper( g.Edit_AttributeTemplate ) NE toupper( g.AttributeTemplate_Code ) ) }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplate_Code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000011">
					<MvLOCALIZED-TOKEN NAME = "template" VALUE = "{ g.AttributeTemplate_Code }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">An Attribute Template with the code '%template%' already exists</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATMP', 'AttributeTemplate_Code', l.error_message ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.AttributeTemplate_Prompt ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000012">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an attribute template prompt</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATMP', 'AttributeTemplate_Prompt', l.error_message ) }">
	</MvIF>

	<MvIF EXPR = "{ g.Action EQ 'DATA' }">
		<MvASSIGN NAME = "g.Templates" VALUE = "">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplate_Code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found2" VALUE = "{ Attribute_Find_TemplateID( AttributeTemplates.d.id ) }">
			<MvIF EXPR = "{ l.found2 }">
				<MvASSIGN NAME = "g.Templates" VALUE = "{ AttributeTemplates.d.code }">
				<MvASSIGN NAME = "l.can_not_delete" VALUE = 1>
			</MvIF>
		</MvIF>

		<MvIF EXPR = "{ l.can_not_delete }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-00090">
				<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ g.Templates }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">The Attribute Template '%code%' is assigned to one or more products and cannot be deleted</MvLOCALIZED-TEXT>
			</MvLOCALIZED>

			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATMP', 'AttributeTemplate_Code', l.error_message ) }">
		</MvIF>
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AttributeTemplate_Attribute_Validate" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Code" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Attribute_Code ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Prompt" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Attribute_Prompt ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Price" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Attribute_Price ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Cost" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Attribute_Cost ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.AttributeTemplate_Attribute_Code ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Attribute_Code', g.Validation_Message ) }">
	<MvELSE>
		<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplate_Attribute ) EQ 0 ) OR ( toupper( g.Edit_AttributeTemplate_Attribute ) NE toupper( g.AttributeTemplate_Attribute_Code ) ) }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000014">
					<MvLOCALIZED-TOKEN NAME = "attribute" VALUE = "{ g.AttributeTemplate_Attribute_Code }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">An attribute with the code '%attribute%' already exists</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Attribute_Code', l.error_message ) }">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.AttributeTemplate_Attribute_Prompt ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000015">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an attribute prompt</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Attribute_Prompt', l.error_message ) }">
	</MvIF>

	<MvIF EXPR = "{ ( g.AttributeTemplate_Attribute_Type NE 'checkbox' ) AND ( g.AttributeTemplate_Attribute_Type NE 'radio' ) AND
					( g.AttributeTemplate_Attribute_Type NE 'text' ) AND ( g.AttributeTemplate_Attribute_Type NE 'select' ) AND ( g.AttributeTemplate_Attribute_Type NE 'memo' ) }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-000016">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please select a type</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', '', l.error_message ) }">
	</MvIF>

	<MvIF EXPR = "{ g.Add_AttributeTemplate_Attribute }">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplate_Code ) }">
		<MvIF EXPR = "{ l.found }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-000017">
					<MvLOCALIZED-TOKEN NAME = "attribute" VALUE = "{ g.AttributeTemplate_Attribute_Code }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">This attribute code '%attribute%' already exists</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', '', l.error_message ) }">
			</MvIF>
		</MvIF>
	</MvIF>

 	<MvIF EXPR = "{ g.Edit_AttributeTemplate_Attribute }">
		<MvIF EXPR = "{ g.Edit_AttributeTemplate_Attribute NE g.AttributeTemplate_Attribute_Code }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplate_Code ) }">
			<MvIF EXPR = "{ l.found }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code ) }">
				<MvIF EXPR = "{ l.found }">
					<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-000018">
						<MvLOCALIZED-TOKEN NAME = "attribute" VALUE = "{ g.AttributeTemplate_Attribute_Code }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">This attribute code '%attribute%' already exists</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', '', l.error_message ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.AttributeTemplate_Attribute_Price ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Attribute_Price', g.Validation_Message ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.AttributeTemplate_Attribute_Cost ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Attribute_Cost', g.Validation_Message ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AttributeTemplate_Option_Validate"  STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.AttributeTemplate_Option_Code" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Option_Code ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Option_Prompt" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Option_Prompt ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Option_Price" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Option_Price ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplate_Option_Cost" VALUE = "{ ltrim( rtrim( g.AttributeTemplate_Option_Cost ) ) }">

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.AttributeTemplate_Option_Code ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Code', g.Validation_Message ) }">
	<MvELSE>
		<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) OR ( toupper( g.Edit_AttributeTemplate_Option ) NE toupper( g.AttributeTemplate_Option_Code ) ) }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Edit_AttributeTemplate_AttributeTemplateAttribute ) }">
			<MvIF EXPR = "{ l.found }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, g.AttributeTemplate_Option_Code ) }">
				<MvIF EXPR = "{ l.found }">
					<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000020">
						<MvLOCALIZED-TOKEN NAME = "option" VALUE = "{ g.AttributeTemplate_Option_Code }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">An option with the code '%option%' already exists</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Code', l.error_message ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ len( g.AttributeTemplate_Option_Prompt ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000021">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an option prompt</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Prompt', l.error_message ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found_template" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplate_Code ) }">
	<MvIF EXPR = "{ l.found_template }">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found_temp_attrib" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Edit_AttributeTemplate_Attribute ) }">

		<MvIF EXPR = "{ l.found_temp_attrib }">
			<MvIF EXPR = "{ g.Add_AttributeTemplate_Option }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found_temp_attrib_opt" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, g.AttributeTemplate_Option_Code ) }">
				<MvIF EXPR = "{ l.found_temp_attrib_opt }">
					<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000022">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">This option code already exists in this attribute</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Code', l.error_message ) }">
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ g.Edit_AttributeTemplate_Option }">
				<MvIF EXPR = "{ g.Edit_AttributeTemplate_Option NE g.AttributeTemplate_Option_Code }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found_temp_attrib_opt" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, g.AttributeTemplate_Option_Code ) }">
					<MvIF EXPR = "{ l.found_temp_attrib_opt }">
						<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-000023">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">This option code already exists in this attribute</MvLOCALIZED-TEXT>
						</MvLOCALIZED>
						<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Code', l.error_message ) }">
					</MvIF>
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.AttributeTemplate_Option_Price ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Price', g.Validation_Message ) }">
	</MvIF>

	<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Currency_Required( g.AttributeTemplate_Option_Cost ) }">
	<MvIF EXPR = "{ NOT l.valid }">
		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'AttributeTemplate_Option_Cost', g.Validation_Message ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

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

	<MvLOCALIZED NAME = "l.title"  ID = "MER-ATT-000024">
		<MvLOCALIZED-TEXT LANGUAGE = "en-US">Add Attribute Template</MvLOCALIZED-TEXT>
	</MvLOCALIZED>

	<MvASSIGN NAME = "l.action" VALUE = "IPRD">
	<MvASSIGN NAME = "l.product_id" VALUE = 0>
	<MvASSIGN NAME = "l.buttons" VALUE = "Help:atmp.html">

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

	<MvIF EXPR = "{ len( g.Edit_AttributeTemplate ) EQ 0 AND l.can_add EQ 0 }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok"	VALUE = "{ Screen_Blank() }">
		<MvFUNCTIONRETURN VALUE = "{ l.ok }">
	</MvIF>

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

	<MvIF EXPR = "{ l.ok }">
		<MvIF EXPR = "{ len( g.Edit_AttributeTemplate ) }">
							   
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( g.Edit_AttributeTemplate ) }">

			<MvIF EXPR = "{ l.ok }">
				<MvLOCALIZED NAME = "l.title"  ID = "MER-ATT-000025">
					<MvLOCALIZED-TOKEN NAME = "template" VALUE = "{ encodeentities( AttributeTemplates.d.code ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Edit Attribute Template: %template%</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				<MvASSIGN NAME = "l.action" VALUE = "UATA">
				<MvASSIGN NAME = "l.product_id" VALUE = "{ AttributeTemplates.d.id }">
				<MvASSIGN NAME = "l.buttons" VALUE = "{ 'Help:atmp.html' }">

				<MvIF EXPR = "{ g.Load_Fields }">
					<MvASSIGN NAME = "g.AttributeTemplate_Code" VALUE = "{ AttributeTemplates.d.code }">
					<MvASSIGN NAME = "g.AttributeTemplate_Prompt" VALUE = "{ AttributeTemplates.d.prompt }">
				</MvIF>
			</MvIF>
		<MvELSE>
			<MvIF EXPR = "{ g.Load_Fields }">
				<MvASSIGN NAME = "g.AttributeTemplate_Code" VALUE = "">
				<MvASSIGN NAME = "g.AttributeTemplate_Prompt" VALUE = "">
			</MvIF>
		</MvIF>
	</MvIF>

	<MvIF EXPR = "{ l.ok }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ BeginScreen( l.title, l.action, l.buttons ) }">

		<MvIF EXPR = "{ len( g.Edit_AttributeTemplate ) }">
			<INPUT TYPE = "hidden" NAME = "Edit_AttributeTemplate" VALUE = "{ encodeentities( g.Edit_AttributeTemplate ) }">
		</MvIF>
		
		<MvLOCALIZED NAME = "l.tabs" ID = "MER-ATT-000026">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">ATMP:Template</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvIF EXPR = "{ len( g.Edit_AttributeTemplate ) }">
			<MvLOCALIZED NAME = "l.moretabs"  ID = "MER-ATT-000027">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">ATTR:Attributes and Options</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvASSIGN NAME = "l.tabs" VALUE = "{ l.tabs $ ',' $ l.moretabs }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawTabs( 'ATMP', l.tabs ) }">

		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ BeginContent() }">
		
		
		<MvIF EXPR = "{ g.Tab EQ 'ATMP' }">
			<TABLE BORDER = 0 CELLPADDING = 2 CELLSPACING = 0 WIDTH = "100%">
			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED  ID = "MER-ATT-000028">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Template Code:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = 20 NAME = "AttributeTemplate_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Code ) }">
				</FONT>
			</TD></TR>

			<TR><TD NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1"><B>
				<MvLOCALIZED  ID = "MER-ATT-000029">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Template Prompt:</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<INPUT TYPE = "text" SIZE = 40 NAME = "AttributeTemplate_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Prompt ) }">
				</FONT>
			</TD></TR>
			</TABLE>
		<MvELSE>
			<INPUT TYPE = "hidden" NAME = "AttributeTemplate_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Code ) }">
			<INPUT TYPE = "hidden" NAME = "AttributeTemplate_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Prompt ) }">
		</MvIF>
	
		<MvIF EXPR = "{ g.Tab EQ 'ATTR' }">
		<SCRIPT LANGUAGE = "JavaScript">
<!--
function AddAttribute( add )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = add;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = 0;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = '';
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = '';
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

function EditAttribute( attr_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = 0;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = 0;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = unescape( attr_code );
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = '';
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

function SwapAttributes( attr_code1, attr_code2 )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = 0;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = 0;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = '';
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].elements[ 'Swap_AttributeTemplate_Attribute_1' ].value = unescape( attr_code1 );
		document.forms[ Screen ].elements[ 'Swap_AttributeTemplate_Attribute_2' ].value = unescape( attr_code2 );
		document.forms[ Screen ].submit();
	}
}

function NewOption( add, attr_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = 0;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = add;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = unescape( attr_code );
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = '';
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;

		document.forms[ Screen ].submit();
	}
}

function EditOption( attr_code, opt_code )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = 0;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = 0;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = unescape( attr_code );
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = unescape( opt_code );
		document.forms[ Screen ].elements[ 'Action' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].submit();
	}
}

function SwapOptions( attr_code, opt_code1, opt_code2 )
{
	if ( CheckModified() )
	{
		document.forms[ Screen ].elements[ 'Screen' ].value = Screen;
		document.forms[ Screen ].elements[ 'Tab' ].value = Tab;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Attribute' ].value = 0;
		document.forms[ Screen ].elements[ 'Add_AttributeTemplate_Option' ].value = 0;
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Attribute' ].value = '';
		document.forms[ Screen ].elements[ 'Edit_AttributeTemplate_Option' ].value = '';
		document.forms[ Screen ].elements[ 'Have_Fields' ].value = 1;
		document.forms[ Screen ].elements[ 'Swap_AttributeTemplate_Option_Attribute' ].value = unescape( attr_code );
		document.forms[ Screen ].elements[ 'Swap_AttributeTemplate_Option_1' ].value = unescape( opt_code1 );
		document.forms[ Screen ].elements[ 'Swap_AttributeTemplate_Option_2' ].value = unescape( opt_code2 );
		document.forms[ Screen ].submit();
	}
}
//-->
		</SCRIPT>
			<MvHIDE FIELDS = "g.Add_AttributeTemplate_Attribute, g.Add_AttributeTemplate_Option, g.Edit_AttributeTemplate_Attribute, g.Edit_AttributeTemplate_Option">

			<INPUT TYPE = "hidden" NAME = "Swap_AttributeTemplate_Attribute_1" VALUE = "">
			<INPUT TYPE = "hidden" NAME = "Swap_AttributeTemplate_Attribute_2" VALUE = "">

			<INPUT TYPE = "hidden" NAME = "Swap_AttributeTemplate_Option_Attribute" VALUE = "">
			<INPUT TYPE = "hidden" NAME = "Swap_AttributeTemplate_Option_1" VALUE = "">
			<INPUT TYPE = "hidden" NAME = "Swap_AttributeTemplate_Option_2" VALUE = "">

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

			<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
							( len( g.Edit_AttributeTemplate_Attribute ) EQ 0 ) AND
							( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) AND
							l.can_modify }">
				<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
					<MvLOCALIZED  ID = "MER-ATT-000030">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Remove</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					</B></FONT>
				</TD>
			</MvIF>
			<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" COLSPAN = 2>
				&nbsp;
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000031">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Code</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000032">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Prompt</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" Colspan = "2" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000033">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Image</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080" WIDTH = "100%">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED ID = "MER-ATT-000034">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Type</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000035">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Price</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000036">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Cost</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000037">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">D</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "#000080">
				<FONT FACE = "Arial, Helvetica" SIZE = "-1" COLOR = "#ffffff"><B>
				<MvLOCALIZED  ID = "MER-ATT-000038">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">R</MvLOCALIZED-TEXT>
				</MvLOCALIZED>
				</B></FONT>
			</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "#000080" NOWRAP>
				<FONT FACE = "Arial, Helvetica" SIZE = "-1">
				<MvIF EXPR = "{ l.can_modify }">
					<MvLOCALIZED NAME = "l.alt"  ID = "MER-ATT-000039">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Attribute</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.Add_AttributeTemplate_Attribute }">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_NewX( 1, l.alt ) }">
						<A HREF = "JavaScript:AddAttribute( 0 );"><MvEVAL EXPR = "{ l.button }"></A>
					<MvELSE>
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_NewX( 0, l.alt) }">
						<A HREF = "JavaScript:AddAttribute( 1 );"><MvEVAL EXPR = "{ l.button }"></A>
					</MvIF>
				<MvELSE>
					&nbsp;
				</MvIF>
				</FONT>
			</TD></TR>
			<MvASSIGN NAME = "l.green" VALUE = 0>
			<MvASSIGN NAME = "l.attribute" VALUE = 0>
			<MvASSIGN NAME = "l.previous_attribute_code" VALUE = "">

			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.attribute_found" VALUE = "{ AttributeTemplateAttribute_FindFirst_AttributeTemplate( AttributeTemplates.d.id ) }">
			<MvWHILE EXPR = "{ l.attribute_found }">
				<MvASSIGN NAME = "l.attribute" VALUE = "{ l.attribute + 1 }">

				<MvASSIGN NAME = "l.attribute_id" VALUE = "{ AttributeTemplateAttributes.d.id }">
				<MvASSIGN NAME = "l.attribute_default_id" VALUE = "{ AttributeTemplateAttributes.d.default_id }">
				<MvASSIGN NAME = "l.attribute_code" VALUE = "{ AttributeTemplateAttributes.d.code }">
				<MvASSIGN NAME = "l.attribute_prompt" VALUE = "{ AttributeTemplateAttributes.d.prompt }">
				<MvASSIGN NAME = "l.attribute_type" VALUE = "{ AttributeTemplateAttributes.d.type }">
				<MvASSIGN NAME = "l.attribute_image" VALUE = "{ AttributeTemplateAttributes.d.image }">
				<MvASSIGN NAME = "l.attribute_price" VALUE = "{ AttributeTemplateAttributes.d.price }">
				<MvASSIGN NAME = "l.attribute_cost" VALUE = "{ AttributeTemplateAttributes.d.cost }">
				<MvASSIGN NAME = "l.attribute_required" VALUE = "{ AttributeTemplateAttributes.d.required }">

				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.attribute_found" VALUE = "{ AttributeTemplateAttribute_FindNext_AttributeTemplate( AttributeTemplates.d.id ) }">

				<MvIF EXPR = "{ l.green }">
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
				<MvELSE>
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
				</MvIF>

				<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
								( NOT g.Add_AttributeTemplate_Option ) AND
								( len( g.Edit_AttributeTemplate_Attribute ) NE 0 ) AND
								( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) AND
								( g.Edit_AttributeTemplate_Attribute EQ l.attribute_code ) }">
					<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Code" VALUE = "{ l.attribute_code }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Prompt" VALUE = "{ l.attribute_prompt }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Image" VALUE = "{ l.attribute_image }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Type" VALUE = "{ l.attribute_type }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Price" VALUE = "{ l.attribute_price }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Cost" VALUE = "{ l.attribute_cost }">
						<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Required" VALUE = "{ l.attribute_required }">
					</MvIF>
					<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<MvIF EXPR = "{ ( len( l.previous_attribute_code ) OR l.attribute_found ) AND l.can_modify }">
							<MvIF EXPR = "{ len( l.previous_attribute_code ) }">
								<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000040">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Up</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.previous_attribute_code ) }">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
								<A HREF = "{ 'JavaScript:SwapAttributes( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_u.gif' }"></A>
							<MvELSE>
								<IMG BORDER = 0 WIDTH = 11 HEIGHT = 23 SRC = "{ g.AdminGraphics_Path $ 'blank.gif' }">
							</MvIF>

							<MvIF EXPR = "{ l.attribute_found }">
								<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000041">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Down</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( AttributeTemplateAttributes.d.code ) }">
								<A HREF = "{ 'JavaScript:SwapAttributes( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_d.gif' }"></A>
							</MvIF>
						<MvELSE>
							&nbsp;
						</MvIF>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						&nbsp;
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Code ) }" ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Prompt ) }" ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>

					<TABLE>
					<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Image" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Image ) }" ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Upload(0) }">
						<A HREF = "JavaScript:PopupFileUpload( 'Image', '', 'AttributeTemplate_Attribute_Image' );"><MvEVAL EXPR = "{ l.button }"></A>
						</FONT>
					</TD></TR>
					</TABLE>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						&nbsp;
					</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<SELECT NAME = "AttributeTemplate_Attribute_Type" ONCHANGE = "SetModified();">
						<MvLOCALIZED NAME = "l.option_text"  ID = "MER-ATT-000042">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Radio Buttons</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'radio', g.AttributeTemplate_Attribute_Type, l.option_text ) }">

						<MvLOCALIZED NAME = "l.option_text"  ID = "MER-ATT-000043">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Drop-down List</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'select', g.AttributeTemplate_Attribute_Type, l.option_text ) }">

						<MvLOCALIZED NAME = "l.option_text"  ID = "MER-ATT-000044">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Checkbox</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'checkbox', g.AttributeTemplate_Attribute_Type, l.option_text ) }">

						<MvLOCALIZED NAME = "l.option_text"  ID = "MER-ATT-000045">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Field</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'text', g.AttributeTemplate_Attribute_Type, l.option_text ) }">

						<MvLOCALIZED NAME = "l.option_text"  ID = "MER-ATT-000046">
							<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Area</MvLOCALIZED-TEXT>
						</MvLOCALIZED>

						<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.foo" VALUE = "{ DrawOption( 'memo', g.AttributeTemplate_Attribute_Type, l.option_text ) }">
						</SELECT>
						</FONT>
					</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Attribute_Price" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Price ) }" ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Attribute_Cost" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Cost ) }" ONCHANGE = "SetModified();">
						</FONT>
					</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						&nbsp;
					</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Required }">
							<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Attribute_Required" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
						<MvELSE>
							<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Attribute_Required" VALUE = "Yes" ONCLICK = "SetModified();">
						</MvIF>
						</FONT>
					</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawImgButton_EditHere(1) }">
						<MvEVAL EXPR = "{ '<A HREF = "JavaScript:EditAttribute( \'\' );">' }"><MvEVAL EXPR = "{ l.foo }"><MvEVAL EXPR = "</A>">

						<MvIF EXPR = "{ ( ( l.attribute_type EQ 'radio' ) OR ( l.attribute_type EQ 'select' ) ) AND l.can_modify }">
							<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000047">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Option</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
							<A HREF = "{ 'JavaScript:NewOption( 1, \'' $ l.encode $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'new.gif' }"></A>
						</MvIF>
						</FONT>
					</TD></TR>
				<MvELSE>
					<TR>
					<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
									( NOT g.Add_AttributeTemplate_Option ) AND
									( len( g.Edit_AttributeTemplate_Attribute ) EQ 0 ) AND
									( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) AND
									l.can_modify }">
						<TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "hidden" NAME = "{ 'AttributeTemplate_Attribute_Code[' $  l.attribute $ ']' }" VALUE = "{ encodeentities( l.attribute_code ) }">
							<INPUT TYPE = "checkbox" NAME = "{ 'AttributeTemplate_Attribute_Remove[' $ l.attribute $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
							</FONT>
						</TD>
					</MvIF>

					<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<MvIF EXPR = "{ ( len( l.previous_attribute_code ) OR l.attribute_found ) AND l.can_modify }">
							<MvIF EXPR = "{ len( l.previous_attribute_code ) }">
								<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000048">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Up</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.previous_attribute_code ) }">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
								<A HREF = "{ 'JavaScript:SwapAttributes( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_u.gif' }"></A>
							<MvELSE>
								<IMG BORDER = 0 WIDTH = 11 HEIGHT = 23 SRC = "{ g.AdminGraphics_Path $ 'blank.gif' }">
							</MvIF>

							<MvIF EXPR = "{ l.attribute_found }">
								<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000049">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Down</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( AttributeTemplateAttributes.d.code ) }">
								<A HREF = "{ 'JavaScript:SwapAttributes( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_d.gif' }"></A>
							</MvIF>
						<MvELSE>
							&nbsp;
						</MvIF>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						&nbsp;
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<B><MvEVAL EXPR = "{ encodeentities( l.attribute_code ) }"></B>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<B><MvEVAL EXPR = "{ encodeentities( l.attribute_prompt ) }"></B>
						</FONT>
					</TD><TD ALIGN = "left" Colspan = "2" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ len( l.attribute_image ) }">
							<MvASSIGN NAME = "l.attribute_image" VALUE = "{ encodeentities( l.attribute_image ) }">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.att_image" VALUE = "{ MMUI_Short_Path( l.attribute_image ) }">
							<MvEVAL EXPR = "{ l.att_image }">
						<MvELSE>
							&nbsp;
						</MvIF>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<B>
						<MvIF EXPR = "{ l.attribute_type EQ 'radio' }">
							<MvLOCALIZED  ID = "MER-ATT-000050">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Radio Buttons</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>

						<MvIF EXPR = "{ l.attribute_type EQ 'select' }">
							<MvLOCALIZED  ID = "MER-ATT-000051">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Drop-down List</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>

						<MvIF EXPR = "{ l.attribute_type EQ 'checkbox' }">
							<MvLOCALIZED  ID = "MER-ATT-000052">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Checkbox</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>

						<MvIF EXPR = "{ l.attribute_type EQ 'text' }">
							<MvLOCALIZED  ID = "MER-ATT-000053">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Field</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>

						<MvIF EXPR = "{ l.attribute_type EQ 'memo' }">
							<MvLOCALIZED  ID = "MER-ATT-000054">
								<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Area</MvLOCALIZED-TEXT>
							</MvLOCALIZED>
						</MvIF>
						</B>
						</FONT>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<MvIF EXPR = "{ ( l.attribute_type EQ 'checkbox' ) OR ( l.attribute_type EQ 'text' ) OR ( l.attribute_type EQ 'memo' ) }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvEVAL EXPR = "{ encodeentities( l.attribute_price ) }">
							</FONT>
						<MvELSE>
							<FONT FACE = "Arial, Helvetica" SIZE = "1">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.show_na" VALUE = "{ Show_NA() }">
							<MvEVAL EXPR = "{ l.show_na }">
							</FONT>
						</MvIF>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<MvIF EXPR = "{ ( l.attribute_type EQ 'checkbox' ) OR ( l.attribute_type EQ 'text' ) OR ( l.attribute_type EQ 'memo' ) }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvEVAL EXPR = "{ encodeentities( l.attribute_cost ) }">
							</FONT>
						<MvELSE>
							<FONT FACE = "Arial, Helvetica" SIZE = "1">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.show_na" VALUE = "{ Show_NA() }">
							<MvEVAL EXPR = "{ l.show_na }">
							</FONT>
						</MvIF>
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						&nbsp;
					</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawCheck_Required( l.attribute_required ) }">
						</FONT>
					</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
						<FONT FACE = "Arial, Helvetica" SIZE = "-1">
						<MvIF EXPR = "{ l.can_modify }">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere(0) }">
							<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
							<MvEVAL EXPR = "{ '<A HREF = "JavaScript:EditAttribute( \'' $ l.encode $ '\' );">' }"><MvEVAL EXPR = "{ l.button }"><MvEVAL EXPR = "</A>">

							<MvIF EXPR = "{ ( l.attribute_type EQ 'radio' ) OR ( l.attribute_type EQ 'select' ) }">
								<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000055">
									<MvLOCALIZED-TEXT LANGUAGE = "en-US">New Option</MvLOCALIZED-TEXT>
								</MvLOCALIZED>
								<MvIF EXPR = "{ g.Add_AttributeTemplate_Option AND ( g.Edit_AttributeTemplate_Attribute EQ l.attribute_code ) }">
									<A HREF = "{' JavaScript:NewOption( 0, \'\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ 'graphics/' $ s.miva_language  $ '/admin/new_p.gif' }"></A>
								<MvELSE>
									<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
									<A HREF = "{ 'JavaScript:NewOption( 1, \'' $ l.encode $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'new.gif' }"></A>
								</MvIF>
							</MvIF>
						<MvELSE>
							&nbsp;
						</MvIF>
						</FONT>
					</TD></TR>
				</MvIF>

				<MvIF EXPR = "{ ( l.attribute_type EQ 'radio' ) OR ( l.attribute_type EQ 'select' ) }">
					<MvASSIGN NAME = "l.option" VALUE = 0>
					<MvASSIGN NAME = "l.previous_option_code" VALUE = "">

					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.option_found" VALUE = "{ AttributeTemplateOption_FindFirst_Attribute( l.attribute_id ) }">

					<MvWHILE EXPR = "{ l.option_found }">
						<MvASSIGN NAME = "l.option" VALUE = "{ l.option + 1 }">

						<MvASSIGN NAME = "l.option_id" VALUE = "{ AttributeTemplateOptions.d.id }">
						<MvASSIGN NAME = "l.option_code" VALUE = "{ AttributeTemplateOptions.d.code }">
						<MvASSIGN NAME = "l.option_prompt" VALUE = "{ AttributeTemplateOptions.d.prompt }">
						<MvASSIGN NAME = "l.option_image" VALUE = "{ AttributeTemplateOptions.d.image }">
						<MvASSIGN NAME = "l.option_price" VALUE = "{ AttributeTemplateOptions.d.price }">
						<MvASSIGN NAME = "l.option_cost" VALUE = "{ AttributeTemplateOptions.d.cost }">

						<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.option_found" VALUE = "{ AttributeTemplateOption_FindNext_Attribute( l.attribute_id ) }">

						<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
										( NOT g.Add_AttributeTemplate_Option ) AND
										( len( g.Edit_AttributeTemplate_Attribute ) NE 0 ) AND
										( len( g.Edit_AttributeTemplate_Option ) NE 0 ) AND
										( g.Edit_AttributeTemplate_Attribute EQ l.attribute_code ) AND
										( g.Edit_AttributeTemplate_Option EQ l.option_code ) AND
										( l.can_modify OR l.can_add ) }">
							<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
								<MvASSIGN NAME = "g.AttributeTemplate_Option_Code" VALUE = "{ l.option_code }">
								<MvASSIGN NAME = "g.AttributeTemplate_Option_Prompt" VALUE = "{ l.option_prompt }">
								<MvASSIGN NAME = "g.AttributeTemplate_Option_Image" VALUE = "{ l.option_image }">
								<MvASSIGN NAME = "g.AttributeTemplate_Option_Price" VALUE = "{ l.option_price }">
								<MvASSIGN NAME = "g.AttributeTemplate_Option_Cost" VALUE = "{ l.option_cost }">

								<MvIF EXPR = "{ l.option_id EQ l.attribute_default_id }">
									<MvASSIGN NAME = "g.AttributeTemplate_Option_Default" VALUE = "Yes">
								<MvELSE>
									<MvASSIGN NAME = "g.AttributeTemplate_Option_Default" VALUE = "">
								</MvIF>
							</MvIF>

							<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ ( len( l.previous_option_code ) OR l.option_found ) }">
									<MvIF EXPR = "{ len( l.previous_option_code ) }">
										<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000056">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Up</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.previous_option_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode3" VALUE = "{ JavaScriptEncode( l.option_code ) }">
										<A HREF = "{ 'JavaScript:SwapOptions( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\', \'' $ l.encode3 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_u.gif' }"></A>
									<MvELSE>
										<IMG BORDER = 0 WIDTH = 11 HEIGHT = 23 SRC = "{ g.AdminGraphics_Path $ 'blank.gif' }">
									</MvIF>

									<MvIF EXPR = "{ l.option_found }">
										<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000057">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Down</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.option_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode3" VALUE = "{ JavaScriptEncode( AttributeTemplateOptions.d.code ) }">
										<A HREF = "{ 'JavaScript:SwapOptions( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\', \'' $ l.encode3 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_d.gif' }"></A>
									</MvIF>
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Code ) }" ONCHANGE = "SetModified();">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Prompt ) }" ONCHANGE = "SetModified();">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<TABLE>
								<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
									<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Image" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Image ) }" ONCHANGE = "SetModified();">
									</FONT>
								</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
									<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Upload(0) }">
									<A HREF = "JavaScript:PopupFileUpload( 'Image', '', 'AttributeTemplate_Option_Image' );"><MvEVAL EXPR = "{ l.button }"></A>
									</FONT>
								</TD></TR>
								</TABLE>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Option_Price" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Price ) }" ONCHANGE = "SetModified();">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Option_Cost" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Cost ) }" ONCHANGE = "SetModified();">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ g.AttributeTemplate_Option_Default }">
									<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Option_Default" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
								<MvELSE>
									<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Option_Default" VALUE = "Yes" ONCLICK = "SetModified();">
								</MvIF>
								</FONT>
							</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere(1) }">
								<MvEVAL EXPR = "{ '<A HREF = "JavaScript:EditOption( \'\', \'\' );">' }"><MvEVAL EXPR = "{ l.button }"><MvEVAL EXPR = "</A>">
								</FONT>
							</TD></TR>
						<MvELSE>
							<TR>
							<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
											( NOT g.Add_AttributeTemplate_Option ) AND
											( len( g.Edit_AttributeTemplate_Attribute ) EQ 0 ) AND
											( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) AND
											l.can_modify }">
								<TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
									<FONT FACE = "Arial, Helvetica" SIZE = "-1">
									<INPUT TYPE = "hidden" NAME = "{ 'AttributeTemplate_Option_Code[' $ l.attribute $ '][' $ l.option $ ']' }" VALUE = "{ encodeentities( l.option_code ) }">
									<INPUT TYPE = "checkbox" NAME = "{ 'AttributeTemplate_Option_Remove[' $ l.attribute $ '][' $ l.option $ ']' }" VALUE = "Yes" ONCLICK = "SetModified();">
									</FONT>
								</TD>
							</MvIF>

							<TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ ( len( l.previous_option_code ) OR l.option_found ) AND l.can_modify }">
									<MvIF EXPR = "{ len( l.previous_option_code ) }">
										<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000058">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Up</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.previous_option_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode3" VALUE = "{ JavaScriptEncode( l.option_code ) }">
										<A HREF = "{ 'JavaScript:SwapOptions( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\', \'' $ l.encode3 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_u.gif' }"></A>
									<MvELSE>
										<IMG BORDER = 0 WIDTH = 11 HEIGHT = 23 SRC = "{ g.AdminGraphics_Path $ 'blank.gif' }">
									</MvIF>

									<MvIF EXPR = "{ l.option_found }">
										<MvLOCALIZED NAME = "l.alt_text"  ID = "MER-ATT-000059">
											<MvLOCALIZED-TEXT LANGUAGE = "en-US">Move Down</MvLOCALIZED-TEXT>
										</MvLOCALIZED>
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.option_code ) }">
										<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode3" VALUE = "{ JavaScriptEncode( AttributeTemplateOptions.d.code ) }">
										<A HREF = "{ 'JavaScript:SwapOptions( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\', \'' $ l.encode3 $ '\' );' }"><IMG ALT = "{ l.alt_text }" BORDER = 0 SRC = "{ g.AdminGraphics_Path $ 'move_d.gif' }"></A>
									</MvIF>
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( l.option_code ) }">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( l.option_prompt ) }">
								</FONT>
							</TD><TD ALIGN = "left"  Colspan = "2" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ len( l.option_image ) }">
									<MvEVAL EXPR = "{ encodeentities( l.option_image ) }">
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( l.option_price ) }">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvEVAL EXPR = "{ encodeentities( l.option_cost ) }">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawCheck_Default( l.option_id EQ l.attribute_default_id ) }">
								</FONT>
							</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								&nbsp;
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvIF EXPR = "{ l.can_modify }">
									<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_EditHere(0) }">
									<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode1" VALUE = "{ JavaScriptEncode( l.attribute_code ) }">
									<MvDO FILE = "{ g.Module_Admin }" NAME = "l.encode2" VALUE = "{ JavaScriptEncode( l.option_code ) }">
									<MvEVAL EXPR = "{ '<A HREF = "JavaScript:EditOption( \'' $ l.encode1 $ '\', \'' $ l.encode2 $ '\' );">' }"><MvEVAL EXPR = "{ l.button }"><MvEVAL EXPR = "</A>">
								<MvELSE>
									&nbsp;
								</MvIF>
								</FONT>
							</TD></TR>
						</MvIF>

						<MvASSIGN NAME = "l.previous_option_code" VALUE = "{ l.option_code }">
					</MvWHILE>

					<MvIF EXPR = "{ g.Add_AttributeTemplate_Option AND ( g.Edit_AttributeTemplate_Attribute EQ l.attribute_code ) }">
						<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
							<MvASSIGN NAME = "g.AttributeTemplate_Option_Code" VALUE = "">
							<MvASSIGN NAME = "g.AttributeTemplate_Option_Prompt" VALUE = "">
							<MvASSIGN NAME = "g.AttributeTemplate_Option_Image" VALUE = "">

							<MvASSIGN NAME = "g.AttributeTemplate_Option_Price" VALUE = "0.00">
							<MvASSIGN NAME = "g.AttributeTemplate_Option_Cost" VALUE = "0.00">
							<MvASSIGN NAME = "g.AttributeTemplate_Option_Default" VALUE = "">
						</MvIF>
						<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP COLSPAN = 2>
							&nbsp;
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Code ) }" ONCHANGE = "SetModified();">
							</FONT>
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Prompt ) }" ONCHANGE = "SetModified();">
							</FONT>
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
							<TABLE>
							<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Option_Image" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Image ) }" ONCHANGE = "SetModified();">
								</FONT>
							</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
								<FONT FACE = "Arial, Helvetica" SIZE = "-1">
								<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Upload(0) }">
								<A HREF = "JavaScript:PopupFileUpload( 'Image', '', 'AttributeTemplate_Option_Image' );"><MvEVAL EXPR = "{ l.button }"></A>
								</FONT>
							</TD></TR>
							</TABLE>
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							&nbsp;
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
							&nbsp;
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Option_Price" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Price ) }" ONCHANGE = "SetModified();">
							</FONT>
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Option_Cost" VALUE = "{ encodeentities( g.AttributeTemplate_Option_Cost ) }" ONCHANGE = "SetModified();">
							</FONT>
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							<FONT FACE = "Arial, Helvetica" SIZE = "-1">
							<MvIF EXPR = "{ g.AttributeTemplate_Option_Default }">
								<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Option_Default" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
							<MvELSE>
								<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Option_Default" VALUE = "Yes" ONCLICK = "SetModified();">
							</MvIF>
							</FONT>
						</TD><TD ALIGN = "center" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							&nbsp;
						</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
							&nbsp;
						</TD></TR>
					</MvIF>
				</MvIF>

				<INPUT TYPE = "hidden" NAME = "{ 'AttributeTemplate_Option_Count[' $ l.attribute $ ']' }" VALUE = "{ encodeentities( l.option ) }">

				<MvASSIGN NAME = "l.green" VALUE = "{ NOT l.green }">
				<MvASSIGN NAME = "l.previous_attribute_code" VALUE = "{ l.attribute_code }">
			</MvWHILE>

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

			<MvIF EXPR = "{ g.Add_AttributeTemplate_Attribute AND ( l.can_modify OR l.can_add ) }">
				<MvIF EXPR = "{ l.green }">
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffdd">
				<MvELSE>
					<MvASSIGN NAME = "l.bgcolor" VALUE = "#ffffff">
				</MvIF>

				<MvIF EXPR = "{ NOT g.Data_Entry_Error }">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Code" VALUE = "">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Prompt" VALUE = "">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Image" VALUE = "">
					
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Type" VALUE = "radio">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Price" VALUE = "0.00">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Cost" VALUE = "0.00">
					<MvASSIGN NAME = "g.AttributeTemplate_Attribute_Required" VALUE = "">
				</MvIF>
				<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP COLSPAN = 2>
					&nbsp;
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Code" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Code ) }" ONCHANGE = "SetModified();">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Prompt" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Prompt ) }" ONCHANGE = "SetModified();">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>

				<TABLE>
				<TR><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" SIZE = 15 NAME = "AttributeTemplate_Attribute_Image" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Image ) }" ONCHANGE = "SetModified();">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvDO FILE = "{ g.Module_Admin }" NAME = "l.button" VALUE = "{ DrawImgButton_Upload(0) }">
					<A HREF = "JavaScript:PopupFileUpload( 'Image', '', 'AttributeTemplate_Attribute_Image' );"><MvEVAL EXPR = "{ l.button }"></A>
					</FONT>
				</TD></TR>
				</TABLE>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					&nbsp;
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<SELECT NAME = "AttributeTemplate_Attribute_Type" ONCHANGE = "SetModified();">
					<MvLOCALIZED NAME = "l.type" ID = "MER-ATT-000060">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Radio Buttons</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Type EQ 'radio' }">
						<OPTION VALUE = "radio" SELECTED><MvEVAL EXPR = "{ l.type }"></OPTION>
					<MvELSE>
						<OPTION VALUE = "radio"><MvEVAL EXPR = "{ l.type }"></OPTION>
					</MvIF>

					<MvLOCALIZED NAME = "l.type" ID = "MER-ATT-000061">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Drop-down List</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Type EQ 'select' }">
						<OPTION VALUE = "select" SELECTED><MvEVAL EXPR = "{ l.type }"></OPTION>
					<MvELSE>
						<OPTION VALUE = "select"><MvEVAL EXPR = "{ l.type }"></OPTION>
					</MvIF>

					<MvLOCALIZED NAME = "l.type" ID = "MER-ATT-000062">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Checkbox</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Type EQ 'checkbox' }">
						<OPTION VALUE = "checkbox" SELECTED><MvEVAL EXPR = "{ l.type }"></OPTION>
					<MvELSE>
						<OPTION VALUE = "checkbox"><MvEVAL EXPR = "{ l.type }"></OPTION>
					</MvIF>

					<MvLOCALIZED NAME = "l.type"  ID = "MER-ATT-000063">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Field</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Type EQ 'text' }">
						<OPTION VALUE = "text" SELECTED><MvEVAL EXPR = "{ l.type }"></OPTION>
					<MvELSE>
						<OPTION VALUE = "text"><MvEVAL EXPR = "{ l.type }"></OPTION>
					</MvIF>

					<MvLOCALIZED NAME = "l.type"  ID = "MER-ATT-000064">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">Text Area</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Type EQ 'memo' }">
						<OPTION VALUE = "memo" SELECTED><MvEVAL EXPR = "{ l.type }"></OPTION>
					<MvELSE>
						<OPTION VALUE = "memo"><MvEVAL EXPR = "{ l.type }"></OPTION>
					</MvIF>

					</SELECT>
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Attribute_Price" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Price ) }" ONCHANGE = "SetModified();">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }" NOWRAP>
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<INPUT TYPE = "text" SIZE = 5 NAME = "AttributeTemplate_Attribute_Cost" VALUE = "{ encodeentities( g.AttributeTemplate_Attribute_Cost ) }" ONCHANGE = "SetModified();">
					</FONT>
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					&nbsp;
				</TD><TD ALIGN = "left" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					<FONT FACE = "Arial, Helvetica" SIZE = "-1">
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Required }">
						<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Attribute_Required" VALUE = "Yes" CHECKED ONCLICK = "SetModified();">
					<MvELSE>
						<INPUT TYPE = "checkbox" NAME = "AttributeTemplate_Attribute_Required" VALUE = "Yes" ONCLICK = "SetModified();">
					</MvIF>
					</FONT>
				</TD><TD ALIGN = "right" VALIGN = "middle" BGCOLOR = "{ l.bgcolor }">
					&nbsp;
				</TD></TR>
			</MvIF>
			</TABLE>
		</MvIF>

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

		<MvIF EXPR = "{ len( g.Edit_AttributeTemplate ) }">
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawButtons( 'UATA:[UPDATE]:ATMP:0:1:0,DATA:[DELETE]:ATMP:0:0:1' ) }">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Admin }" NAME = "l.foo" VALUE = "{ DrawButtons( 'IATA:[ADD]:ATMP:1:0:0' ) }">
		</MvIF>

		<MvASSIGN NAME = "g.EndScreen" VALUE = "1">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.ok" VALUE = "{ EndScreen() }">
	</MvIF>

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

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

	<MvIF EXPR = "{ AttributeTemplate_Validate() }">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.product_id" VALUE = "{ AttributeTemplates_Insert( g.AttributeTemplate_Code, g.AttributeTemplate_Prompt ) }">

		<MvIF EXPR = "{ NOT l.product_id }">
			<MvASSIGN NAME = "l.ok" VALUE = 0>
		<MvELSE>
			<MvLOCALIZED NAME = "g.Message"  ID = "MER-ATT-000064">
				<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( g.AttributeTemplate_Code ) }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Template '%product%' added</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvASSIGN NAME = "g.Edit_AttributeTemplate" VALUE = "{ g.AttributeTemplate_Code }">
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Tab" VALUE = "ATMP">

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

<MvFUNCTION NAME = "Action_AttributeTemplate_Update" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( g.Edit_AttributeTemplate ) }">

	<MvIF EXPR = "{ l.ok }">
		<MvASSIGN NAME = "l.original_name" VALUE = "{ AttributeTemplates.d.code }">
		<MvASSIGN NAME = "l.valid" VALUE = "{ AttributeTemplate_Validate() }">

		<MvIF EXPR = "{ l.valid AND
						( g.Add_AttributeTemplate_Attribute OR len( g.Edit_AttributeTemplate_Attribute ) ) AND
						( NOT g.Add_AttributeTemplate_Option ) AND
						( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) }">

			<MvASSIGN NAME = "l.valid" VALUE = "{ AttributeTemplate_Attribute_Validate() }">
		</MvIF>
		
		<MvIF EXPR = "{ l.valid AND ( g.Add_AttributeTemplate_Option OR ( len( g.Edit_AttributeTemplate_Attribute ) AND len( g.Edit_AttributeTemplate_Option ) ) ) }">
			<MvASSIGN NAME = "l.valid" VALUE = "{ AttributeTemplate_Option_Validate() }">
		</MvIF>


		<MvIF EXPR = "{ l.ok AND l.valid }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Update( g.Edit_AttributeTemplate, g.AttributeTemplate_Code, g.AttributeTemplate_Prompt ) }">

			<MvIF EXPR = "{ len( g.Swap_AttributeTemplate_Attribute_1 ) AND
							len( g.Swap_AttributeTemplate_Attribute_2 ) }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Swap_AttributeTemplate_Attribute_1 ) }">

				<MvIF EXPR = "{ l.ok }">
					<MvASSIGN NAME = "l.id_1" VALUE = "{ AttributeTemplateAttributes.d.id }">
					<MvASSIGN NAME = "l.order_1" VALUE = "{ AttributeTemplateAttributes.d.order }">

					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Swap_AttributeTemplate_Attribute_2 ) }">

					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "l.id_2" VALUE = "{ AttributeTemplateAttributes.d.id }">
						<MvASSIGN NAME = "l.order_2" VALUE = "{ AttributeTemplateAttributes.d.order }">
					</MvIF>
				</MvIF>

				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update_Order( l.id_1, l.order_2 ) }">
				</MvIF>

				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update_Order( l.id_2, l.order_1 ) }">
				</MvIF>
			</MvIF>


			<MvIF EXPR = "{ ( NOT g.Add_AttributeTemplate_Attribute ) AND
							( NOT g.Add_AttributeTemplate_Option ) AND
							( len( g.Edit_AttributeTemplate_Attribute ) EQ 0 ) AND
							( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) }">
				<MvASSIGN NAME = "l.attribute" VALUE = 1>
				<MvWHILE EXPR = "{ l.ok AND ( l.attribute LE g.AttributeTemplate_Attribute_Count ) }">
					<MvIF EXPR = "{ g.AttributeTemplate_Attribute_Remove[ l.attribute ] }">
						<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code[ l.attribute ] ) }">
						<MvIF EXPR = "{ l.ok }">
							<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Delete( AttributeTemplateAttributes.d.id ) }">
						</MvIF>
					<MvELSE>
						<MvASSIGN NAME = "l.attribute_found" VALUE = 0>
						<MvASSIGN NAME = "l.option" VALUE = 1>
						<MvWHILE EXPR = "{ l.ok AND ( l.option LE g.AttributeTemplate_Option_Count[ l.attribute ] ) }">
							<MvIF EXPR = "{ g.AttributeTemplate_Option_Remove[ l.attribute ][ l.option ] }">
								<MvIF EXPR = "{ NOT l.attribute_found }">
									<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code[ l.attribute ] ) }">
									<MvIF EXPR = "{ l.ok }">
										<MvASSIGN NAME = "l.attribute_found" VALUE = 1>
									</MvIF>
								</MvIF>

								<MvIF EXPR = "{ l.ok }">
									<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, g.AttributeTemplate_Option_Code[ l.attribute ][ l.option ] ) }">
									<MvIF EXPR = "{ l.ok AND ( AttributeTemplateOptions.d.id EQ AttributeTemplateAttributes.d.default_id ) }">
										<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, 0, AttributeTemplateAttributes.d.code,
																												   AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt,
																												   AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost,
																												   AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
									</MvIF>

									<MvIF EXPR = "{ l.ok }">
										<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Delete( AttributeTemplateOptions.d.id ) }">
									</MvIF>
								</MvIF>
							</MvIF>

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

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

			<MvIF EXPR = "{ len( g.Swap_AttributeTemplate_Option_Attribute ) AND
							len( g.Swap_AttributeTemplate_Option_1 ) AND
							len( g.Swap_AttributeTemplate_Option_2 ) }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Swap_AttributeTemplate_Option_Attribute ) }">

				<MvIF EXPR = "{ l.ok }">
					<MvASSIGN NAME = "l.attribute_template_id" VALUE = "{ l.ok }">
				</MvIF>

				<MvIF EXPR = "{ l.ok }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Find_Code( l.attribute_template_id, g.Swap_AttributeTemplate_Option_1 ) }">

					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "l.id_1" VALUE = "{ AttributeTemplateOptions.d.id }">
						<MvASSIGN NAME = "l.order_1" VALUE = "{ AttributeTemplateOptions.d.order }">

						<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Find_Code( l.attribute_template_id, g.Swap_AttributeTemplate_Option_2 ) }">
						<MvIF EXPR = "{ l.ok }">
							<MvASSIGN NAME = "l.id_2" VALUE = "{ AttributeTemplateOptions.d.id }">
							<MvASSIGN NAME = "l.order_2" VALUE = "{ AttributeTemplateOptions.d.order }">
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ l.ok }">
						<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Update_Order( l.id_1, l.order_2 ) }">
					</MvIF>

					<MvIF EXPR = "{ l.ok }">
						<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Update_Order( l.id_2, l.order_1 ) }">
					</MvIF>
				</MvIF>
			</MvIF>
			
			<MvIF EXPR = "{ l.ok AND len( g.Edit_AttributeTemplate_Attribute ) }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, g.Edit_AttributeTemplate_Attribute ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok AND len( g.Edit_AttributeTemplate_Option ) }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, g.Edit_AttributeTemplate_Option ) }">
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvIF EXPR = "{ g.Add_AttributeTemplate_Option }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.option_id" VALUE = "{ AttributeTemplateOption_Insert( AttributeTemplateAttributes.d.id, g.AttributeTemplate_Option_Code,
																								   g.AttributeTemplate_Option_Prompt, g.AttributeTemplate_Option_Price,
																								   g.AttributeTemplate_Option_Cost, g.AttributeTemplate_Option_Image ) }">
					<MvIF EXPR = "{ NOT l.option_id }">
						<MvASSIGN NAME = "l.ok" VALUE = 0>
					<MvELSE>
						<MvIF EXPR = "{ g.AttributeTemplate_Option_Default }">
							<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, l.option_id, AttributeTemplateAttributes.d.code,
																									   AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt,
																									   AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost,
																									   AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
						</MvIF>
					</MvIF>
				</MvIF>

				<MvIF EXPR = "{ len( g.Edit_AttributeTemplate_Attribute ) AND len( g.Edit_AttributeTemplate_Option ) }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Update( AttributeTemplateOptions.d.id, g.AttributeTemplate_Option_Code, g.AttributeTemplate_Option_Prompt, g.AttributeTemplate_Option_Price, g.AttributeTemplate_Option_Cost, g.AttributeTemplate_Option_Image ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvIF EXPR = "{ g.AttributeTemplate_Option_Default }">
							<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, AttributeTemplateOptions.d.id, AttributeTemplateAttributes.d.code,
																									   AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt,
																									   AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost,
																									   AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
						<MvELSE>
							<MvIF EXPR = "{ AttributeTemplateOptions.d.id EQ AttributeTemplateAttributes.d.default_id }">
								<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, 0, AttributeTemplateAttributes.d.code,
																										   AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt,
																										   AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost,
																										   AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
							</MvIF>
						</MvIF>
					</MvIF>

					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "g.Edit_AttributeTemplate_Attribute" VALUE = "">
						<MvASSIGN NAME = "g.Edit_AttributeTemplate_Option" VALUE = "">
					</MvIF>
				</MvIF>
				<MvIF EXPR = "{ g.Add_AttributeTemplate_Attribute }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Insert( AttributeTemplates.d.id, g.AttributeTemplate_Attribute_Code,
																							   g.AttributeTemplate_Attribute_Type, g.AttributeTemplate_Attribute_Prompt,
																							   g.AttributeTemplate_Attribute_Price, g.AttributeTemplate_Attribute_Cost,
																							   g.AttributeTemplate_Attribute_Required, g.AttributeTemplate_Attribute_Image ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvIF EXPR = "{ ( g.AttributeTemplate_Attribute_Type EQ 'radio' ) OR ( g.AttributeTemplate_Attribute_Type EQ 'select' ) }">
							<MvASSIGN NAME = "g.Add_AttributeTemplate_Attribute" VALUE = 0>
							<MvASSIGN NAME = "g.Add_AttributeTemplate_Option" VALUE = 1>
							<MvASSIGN NAME = "g.Edit_AttributeTemplate_Attribute" VALUE = "{ g.AttributeTemplate_Attribute_Code }">
						</MvIF>
					</MvIF>
				</MvIF>
				<MvIF EXPR = "{ ( len( g.Edit_AttributeTemplate_Attribute ) NE 0 ) AND ( ( NOT g.Add_AttributeTemplate_Option ) AND ( len( g.Edit_AttributeTemplate_Option ) EQ 0 ) ) }">
					<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, AttributeTemplateAttributes.d.default_id,
																							   g.AttributeTemplate_Attribute_Code, g.AttributeTemplate_Attribute_Type,
																							   g.AttributeTemplate_Attribute_Prompt, g.AttributeTemplate_Attribute_Price,
																							   g.AttributeTemplate_Attribute_Cost, g.AttributeTemplate_Attribute_Required,
																							   g.AttributeTemplate_Attribute_Image ) }">
					<MvIF EXPR = "{ l.ok }">
						<MvASSIGN NAME = "g.Edit_AttributeTemplate_Attribute" VALUE = "">
					</MvIF>
				</MvIF>
			</MvIF>

			<MvIF EXPR = "{ l.ok }">
				<MvLOCALIZED NAME = "g.Message"  ID = "MER-ATT-000066">
					<MvLOCALIZED-TOKEN NAME = "product" VALUE = "{ encodeentities( l.original_name ) }">
					<MvLOCALIZED-TEXT LANGUAGE = "en-US">Attribute Template '%product%' updated</MvLOCALIZED-TEXT>
				</MvLOCALIZED>

				<MvASSIGN NAME = "g.Edit_AttributeTemplate" VALUE = "{ g.AttributeTemplate_Code }">
			</MvIF>
		</MvIF>
	</MvIF>
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Product_Attribute_Validate_Template_Duplicate">

	<MvIF EXPR = "{ NOT( g.Product_Attribute_Template_Code EQ g.Product_Attribute_Code ) AND ( NOT( l.found ) ) AND ( NOT( g.Original_Product_Attribute_Code ) ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Attribute_FindFirst_Product( Products.d.id ) }">
	</MvIF>

	<MvIF EXPR = "{ NOT( l.found ) AND ( NOT( g.Product_Attribute_Template_Code EQ g.Original_Product_Attribute_Code ) ) AND ( g.Original_Product_Attribute_Code ) }">
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Attribute_FindFirst_Product( Products.d.id ) }">
	</MvIF>

	<MvWHILE EXPR = "{ l.found }">
		<MvIF EXPR = "{ ( Attributes.d.code EQ g.Product_Attribute_Template_Code ) AND ( NOT g.Product_Attribute_Copy ) }">
			<MvLOCALIZED NAME = "l.error_message"  ID = "MER-ATT-00001">
				<MvLOCALIZED-TOKEN NAME = "template_code" VALUE = "{ g.Product_Attribute_Template_Code }">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">An attribute template with the code '%template_code%' already exists</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATTR', 'Product_Attribute_Prompt', l.error_message ) }">
		</MvIF>
		<MvDO FILE = "{ g.Module_Library_DB }" NAME = "l.found" VALUE = "{ Attribute_FindNext_Product( Products.d.id ) }">
	</MvWHILE>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "AttributeTemplates_BatchEdit_Validate" STANDARDOUTPUTLEVEL = "text,html">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.attribute_templates" VALUE = 1>
	<MvASSIGN NAME = "g.AttributeTemplates_Code" VALUE = "{ ltrim( rtrim( g.AttributeTemplates_Code ) ) }">
	<MvASSIGN NAME = "g.AttributeTemplates_Name" VALUE = "{ ltrim( rtrim( g.AttributeTemplates_Name ) ) }">

	<MvIF EXPR = "{ g.Edit_AttributeTemplates }">
		<MvDO FILE = "{ g.Module_Admin }" NAME = "l.valid" VALUE = "{ Validate_Code( g.AttributeTemplates_Code ) }">
		<MvIF EXPR = "{ NOT l.valid }">
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATBE', 'AttributeTemplates_Code', g.Validation_Message ) }">
		<MvELSE>
			<MvIF EXPR = "{ ( toupper( g.Edit_AttributeTemplates ) NE toupper( g.AttributeTemplates_Code ) ) }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplates_Code ) }">
				<MvIF EXPR = "{ l.found }">
					<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-00072">
						<MvLOCALIZED-TOKEN NAME = "template" VALUE = "{ g.AttributeTemplates_Code }">
						<MvLOCALIZED-TEXT LANGUAGE = "en-US">An Attribute Template with the code '%template%' already exists</MvLOCALIZED-TEXT>
					</MvLOCALIZED>
					<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATBE', 'AttributeTemplates_Code', l.error_message ) }">
				</MvIF>
			</MvIF>
		</MvIF>
	</MvIF>
	
	<MvIF EXPR = "{ g.Edit_AttributeTemplates }">
		<MvIF EXPR = "{ len( g.AttributeTemplates_Name ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error_message" ID = "MER-ATT-00073">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">Please specify an attribute template prompt</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATBE', 'AttributeTemplates_Name', l.error_message ) }">
		</MvIF>
	</MvIF>

	<MvASSIGN NAME = "g.Templates" VALUE = "">
	<MvWHILE EXPR = "{ l.ok AND ( l.attribute_templates LE g.AttributeTemplates_Count ) }">
		<MvIF EXPR = "{ g.AttributeTemplates_Remove[ l.attribute_templates ] }">
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( g.AttributeTemplates_Remove_Code[ l.attribute_templates ] ) }">
			<MvIF EXPR = "{ l.found }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ Attribute_Find_TemplateID( AttributeTemplates.d.id ) }">
				<MvIF EXPR = "{ l.found OR AttributeTemplates.d.refcount GT 0 }">
					<MvASSIGN NAME = "g.Templates" VALUE = "{ AttributeTemplates.d.code }">
					<MvASSIGN NAME = "l.can_not_delete" VALUE = 1>
				</MvIF>
			</MvIF>
		</MvIF>

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

	<MvIF EXPR = "{ l.can_not_delete OR AttributeTemplates.d.refcount GT 0 }">
		<MvLOCALIZED NAME = "l.error_message" ID = "MER-DTB-01352">
			<MvLOCALIZED-TOKEN NAME = "code" VALUE = "{ g.Templates }">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">The Attribute Template '%code%' is assigned to one or more products and cannot be deleted</MvLOCALIZED-TEXT>
		</MvLOCALIZED>

		<MvFUNCTIONRETURN VALUE = "{ FieldError( 'ATBE', '', l.error_message ) }">
	</MvIF>

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>

<MvFUNCTION NAME = "FieldError" PARAMETERS = "tab, field, message" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "g.Tab" VALUE = "{ l.tab }">
	<MvASSIGN NAME = "g.Error_Field" VALUE = "{ l.field }">
	<MvASSIGN NAME = "g.Error_Field_Message" VALUE = "{ l.message }">
	<MvASSIGN NAME = "g.Data_Entry_Error" VALUE = 1>

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

<MvFUNCTION NAME = "EndScreen" STANDARDOUTPUTLEVEL = "text, html, compresswhitespace">
	</FORM>
	</BODY>
	<MvFUNCTIONRETURN VALUE = "1">
</MvFUNCTION>

<MvFUNCTION NAME = "ATT_Provision_Add_Update_AttributeTemplate" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<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.prompt" 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-ATT-00074">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00002', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">

		<MvIF EXPR = "{ len( l.name ) }">
			<MvASSIGN NAME = "AttributeTemplates.d.prompt" VALUE = "{ l.prompt }">
		</MvIF>
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplate_Update( AttributeTemplates.d.code, AttributeTemplates.d.code, AttributeTemplates.d.prompt) }">
	
	<MvELSE>
		<MvIF EXPR = "{ len( l.prompt ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00075">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					AttributeTemplate prompt required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00003', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplates_Insert( l.code, l.prompt ) }">
	</MvIF>

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

<MvFUNCTION NAME = "ATT_Provision_Add_Update_AttributeTemplateAttribute" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.type" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.required" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00076">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00004', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00077">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplateAttribute code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00005', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvIF EXPR = "{ 'template' CIN l.type }">
		<MvASSIGN NAME = "l.template" VALUE = "{ ltrim( rtrim( gettoken( l.data, ':', 2 ) ) ) }">
		<MvASSIGN NAME = "l.type" VALUE = "{ ltrim( rtrim( gettoken( l.data, ':', 1 ) ) ) }">
		<MvIF EXPR = "{ NOT g.Features:AttributeTempates:Enabled }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00078">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					AttributeTemplateAttribute code required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00006', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		<MvELSE>
			<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.template ) }">
			<MvIF EXPR = "{ l.ok }">
				<MvASSIGN NAME = "l.template_id" VALUE = "{ AttributeTemplateAttributeTemplates.d.id }"> 
			</MvIF>
		</MvIF>
	<MvELSE>
		<MvASSIGN NAME = "l.template_id" VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, l.attribute_code ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.type ) }">
			<MvASSIGN NAME = "AttributeTemplateAttributes.d.type" VALUE = "{ l.type }">
			<MvASSIGN NAME = "AttributeTemplateAttributes.d.attemp_id" VALUE = "{ l.template_id }">
		</MvIF>

		<MvIF EXPR = "{ len( l.prompt ) }">
			<MvASSIGN NAME = "AttributeTemplateAttributes.d.thumbnail" VALUE = "{ l.thumbnail }">
		</MvIF>

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

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

		<MvIF EXPR = "{ len( l.required ) }">
			<MvASSIGN NAME = "AttributeTemplateAttributes.d.desc" VALUE = "{ l.desc }">
		</MvIF>

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

		<MvIF EXPR = "{ len( l.required ) }">
			<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "AttributeTemplateAttributes.d.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, AttributeTemplateAttributes.d.default_id, AttributeTemplateAttributes.d.code, AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt, AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost, AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.prompt ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00079">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					AttributeTemplateAttribute prompt required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00007', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "AttributeTemplateAttributes.d.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">

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

		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Insert( AttributeTemplates.d.id, l.attribute_code, l.type, l.prompt, l.price, l.cost, AttributeTemplateAttributes.d.required, l.image ) }">
	</MvIF>

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


<MvFUNCTION NAME = "ATT_Provision_Delete_AttributeTemplateAttribute" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00080">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00008', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00081">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplateAttribute code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00009', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, l.attribute_code ) }">
	
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Delete( AttributeTemplateAttributes.d.id ) }">
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "ATT_Provision_Add_Update_AttributeTemplateOption" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.option_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.default" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00082">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00010', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00083">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplateOption code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00011', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, l.attribute_code ) }">
		
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, l.option_code ) }">
	
	<MvIF EXPR = "{ l.found }">
		<MvIF EXPR = "{ len( l.prompt ) }">
			<MvASSIGN NAME = "AttributeTemplateOptions.d.thumbnail" VALUE = "{ l.thumbnail }">
		</MvIF>

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

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

		<MvIF EXPR = "{ len( l.required ) }">
			<MvASSIGN NAME = "AttributeTemplateOptions.d.desc" VALUE = "{ l.desc }">
		</MvIF>

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

		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplateOption_Update( AttributeTemplateOptions.d.id,  AttributeTemplateOptions.d.code, AttributeTemplateOptions.d.prompt, AttributeTemplateOptions.d.price, AttributeTemplateOptions.d.cost, AttributeTemplateOptions.d.image ) }">
	<MvELSE>
		<MvIF EXPR = "{ len( l.prompt ) EQ 0 }">
			<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00084">
				<MvLOCALIZED-TEXT LANGUAGE = "en-US">
					AttributeTemplateOption prompt required.
				</MvLOCALIZED-TEXT>
			</MvLOCALIZED>
			<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00012', l.error ) }">
			<MvFUNCTIONRETURN VALUE = "0">
		</MvIF>

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

		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "l.required" VALUE = "{ PRV_Parse_Boolean( l.required ) }">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Insert( AttributeTemplateAttributes.d.id, l.option_code, l.prompt, l.price, l.cost, l.image ) }">
	</MvIF>
	
	<MvIF EXPR = "{ len( l.default ) }">
		<MvDO FILE = "{ g.Module_Feature_PRV_AD }" NAME = "l.default" VALUE = "{ PRV_Parse_Boolean( l.default ) }">
		<MvIF EXPR = "{ l.default }">
			<MvIF EXPR = "{ AttributeTemplateAttributes.d.default_id NE AttributeTemplateOptions.d.id }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, AttributeTemplateOptions.d.id, AttributeTemplateAttributes.d.code, AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.prompt, AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost, AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
			</MvIF>
		<MvELSE>
			<MvIF EXPR = "{ AttributeTemplateAttributes.d.default_id EQ AttributeTemplateOptions.d.id }">
				<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplateAttribute_Update( AttributeTemplateAttributes.d.id, 0, AttributeTemplateAttributes.d.code, AttributeTemplateAttributes.d.type, AttributeTemplateAttributes.d.attemp_id, AttributeTemplateAttributes.d.prompt, AttributeTemplateAttributes.d.price, AttributeTemplateAttributes.d.cost, AttributeTemplateAttributes.d.required, AttributeTemplateAttributes.d.image ) }">
			</MvIF>
		</MvIF>
	</MvIF>

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

<MvFUNCTION NAME = "ATT_Provision_Delete_AttributeTemplateOption" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.product_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.attribute_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.option_code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.prompt" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.price" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.cost" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	<MvASSIGN NAME = "l.image" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	<MvASSIGN NAME = "l.pos" VALUE = "{ l.pos + 1 }">
	
	<MvIF EXPR = "{ len( l.product_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00085">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00013', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Find_Code( l.product_code ) }">
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>

	<MvIF EXPR = "{ len( l.attribute_code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00086">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplateOption code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00014', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateAttribute_Find_Code( AttributeTemplates.d.id, l.attribute_code ) }">
		
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplateOption_Find_Code( AttributeTemplateAttributes.d.id, l.option_code ) }">
	
	<MvIF EXPR = "{ NOT l.ok }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
	
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{AttributeTemplateOption_Delete( AttributeTemplateOptions.d.id ) }">

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

<MvFUNCTION NAME = "ATT_Provision_Delete_AttributeTemplate" PARAMETERS = "version, store_code, delimiter, data" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.ok" VALUE = "1">
	<MvIF EXPR = "{NOT len( l.store_code )}">
		<MvFUNCTIONRETURN VALUE = "{ PRV_Error_StoreRequired('Store_Module_UI_Set') }">
	</MvIF>
	
	<MvASSIGN NAME = "l.pos" VALUE = "1">
	<MvASSIGN NAME = "l.code" VALUE = "{ ltrim( rtrim( gettoken( l.data, l.delimiter, l.pos ) ) ) }">
	
	<MvIF EXPR = "{ len( l.code ) EQ 0 }">
		<MvLOCALIZED NAME = "l.error" ID = "MER-ATT-00087">
			<MvLOCALIZED-TEXT LANGUAGE = "en-US">
				AttributeTemplate code required.
			</MvLOCALIZED-TEXT>
		</MvLOCALIZED>
		<MvDO FILE = "{ g.Module_Library_Utilities }" NAME = "l.ok" VALUE = "{ Error( 'MER-ATT-00015', l.error ) }">
		<MvFUNCTIONRETURN VALUE = "0">
	</MvIF>
		
	<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.found" VALUE = "{ AttributeTemplate_Find_Code( l.code ) }">

	<MvIF EXPR = "{ l.found }">
		<MvDO FILE = "{ g.Module_Feature_ATT_DB }" NAME = "l.ok" VALUE = "{ AttributeTemplate_Delete( AttributeTemplates.d.code ) }">
	</MvIF>

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

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


	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'attempl.dbf',
																	   'id			NUMBER,
																		code		CHAR( 50 ),
																		prompt		CHAR( 50 ),
																		refcount	NUMBER' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Change_Insert( 4.10, 'attempl.dbf',
																	   'id			NUMBER,
																		code		CHAR( 50 ),
																		prompt		CHAR( 50 ),
																		refcount	NUMBER' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplates', 'attempl.dbf', 'attempli.mvx', 'AttributeTemplates.d.id', 'nounique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.11, 'AttributeTemplates', 'attempl.dbf', 'attemplc.mvx', 'toupper( AttributeTemplates.d.code )', 'nounique, ascending' ) }">

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

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'atmpatt.dbf',
																	   'id			NUMBER,
																		attemp_id	NUMBER,
																		default_id	NUMBER,
																		order		NUMBER,
																		code		CHAR( 50 ),
																		type		CHAR( 20 ),
																		prompt		MEMO,
																		price		NUMBER( 10.2 ),
																		cost		NUMBER( 10.2 ),
																		required	BOOL,
																		image		CHAR( 254 )' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateAttributes', 'atmpatt.dbf', 'atmpatti.mvx', 'AttributeTemplateAttributes.d.id', 'unique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateAttributes', 'atmpatt.dbf', 'atmpattc.mvx', 'AttributeTemplateAttributes.d.attemp_id $ \':\' $ toupper( AttributeTemplateAttributes.d.code )', 'nounique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateAttributes', 'atmpatt.dbf', 'atmpatta.mvx', 'AttributeTemplateAttributes.d.attemp_id $ \':\' $ padl( AttributeTemplateAttributes.d.order, 10, \'0\' )', 'nounique, ascending' ) }">

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

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_New_Insert( 4.00, 'attmpop.dbf',
																	   'id			NUMBER,
																		attmpat_id	NUMBER,
																		order		NUMBER,
																		code		CHAR( 50 ),
																		prompt		MEMO,
																		price		NUMBER( 10.2 ),
																		cost		NUMBER( 10.2 ),
																		image		CHAR( 254 )' ) }">

	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateOptions', 'attmpop.dbf', 'attmpopi.mvx', 'AttributeTemplateOptions.d.id', 'unique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateOptions', 'attmpop.dbf', 'attmpopc.mvx', 'AttributeTemplateOptions.d.attmpat_id $ \':\' $ toupper( AttributeTemplateOptions.d.code )', 'nounique, ascending' ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_DB_Index_Insert( 4.00, 'AttributeTemplateOptions', 'attmpop.dbf', 'attmpopa.mvx', 'AttributeTemplateOptions.d.attmpat_id $ \':\' $ padl( AttributeTemplateOptions.d.order, 10, \'0\' )', 'nounique, ascending' ) }">
	
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_Key_New_Insert( 4.00, 'AttributeTemplates', 1 ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_Key_New_Insert( 4.00, 'AttributeTemplateAttributes', 1 ) }">
	<MvDO FILE = "{ g.Module_Upgrade }" NAME = "l.null" VALUE = "{ Store_Key_New_Insert( 4.00, 'AttributeTemplateOptions', 1 ) }">

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

</MvFUNCTION>

<MvFUNCTION NAME = "ATT_Upgrade_Fix_Refcount" PARAMETERS = "directory">
	<MvASSIGN NAME = "l.ok" VALUE = 1>
	<MvASSIGN NAME = "l.refc" VALUE = 0>

	<MvOPEN NAME = "AttributeTemplates"
			DATABASE = "{ l.directory $ 'attempl.dbf' }" 
			INDEXES = "{ l.directory $ 'attemplc.mvx, ' $ l.directory $ 'attempli.mvx' }">
	<MvIF EXPR = "{ MvOPEN_Error }">
		<MvASSIGN NAME = "l.ok" VALUE = 0>
		<MvDO FILE = "g.Module_Upgrade" VALUE = "{ Upgrade_Log_Error( g.Current_Store_Name, 'ATT_Upgrade_Fix_Refcount_1', MvOPEN_Error ) }">
	<MvELSE>
		<MvOPEN NAME = "Products"
				DATABASE = "{ l.directory $ 'products.dbf' }" 
				INDEXES = "{ l.directory $ 'prd_id.mvx' }">

		<MvIF EXPR = "{ MvOPEN_Error }">
			<MvASSIGN NAME = "l.ok" VALUE = 0>
			<MvEVAL EXPR = "{ Upgrade_Log_Error( g.Current_Store_Name, 'ATT_Upgrade_Fix_Refcount', MvOPEN_Error ) }">
		<MvELSE>
			<MvFILTER NAME = "Products" FILTER = "{ NOT Products.d.deleted }">

			<MvPRIMARY NAME = "Products" INDEX = "{ l.directory $ 'prd_id.mvx' }">
			<MvPRIMARY NAME = "AttributeTemplates" INDEX = "{ l.directory $ 'attemplc.mvx' }">
			<MvPRIMARY NAME = "Attributes" INDEX = "{ l.directory $ 'atr_at_i.mvx' }">

			<MvIF EXPR = "{ l.ok }">
				<MvGO NAME = "AttributeTemplates" ROW = "top">

				<MvWHILE EXPR = "{ NOT AttributeTemplates.d.EOF }">
					<MvFIND NAME = "Attributes" VALUE = "{ AttributeTemplates.d.id }">

					<MvWHILE EXPR = "{ ( NOT Attributes.d.EOF ) AND ( AttributeTemplates.d.id EQ Attributes.d.attemp_id ) }">
						<MvFIND NAME = "Products" VALUE = "{ Attributes.d.product_id }" EXACT>
						<MvIF EXPR = "{ NOT Products.d.EOF }">
							<MvASSIGN NAME = "l.refc" VALUE = "{ l.refc + 1 }">
						</MvIF>
						
						<MvSKIP NAME = "Attributes" ROWS = 1>
					</MvWHILE>

					<MvASSIGN NAME = "AttributeTemplates.d.refcount" VALUE = "{ l.refc }">

					<MvUPDATE NAME = "AttributeTemplates">
	

					<MvSKIP NAME = "AttributeTemplates" ROWS = 1>
					<MvASSIGN NAME = "l.refc" VALUE = 0>
				</MvWHILE>
			</MvIF>
		</MvIF>
		
		<MvCLOSE NAME = "Products">
		<MvCLOSE NAME = "AttributeTemplates">
	</MvIF>
	
	<MvFUNCTIONRETURN VALUE = "{ l.ok }">
</MvFUNCTION>

<MvFUNCTION NAME = "Check_Old_ATT" PARAMETERS = "directory" STANDARDOUTPUTLEVEL = "">
	<MvASSIGN NAME = "l.found" VALUE = 0>

	<MvREVEALSTRUCTURE NAME = "Attributes" 
				DATABASE = "{ l.directory $ 'attr-str.dbf' }">

	<MvOPEN NAME = "TempStruct" DATABASE = "{ l.directory $ 'attr-str.dbf' }">

	<MvIF EXPR = "{ MvOPEN_Error }">
		<MvASSIGN NAME = "l.ok" VALUE = 0>
		<MvDO FILE = "g.Module_Upgrade" VALUE = "{ Upgrade_Log_Error( g.Current_Store_Name, 'ATT_Upgrade_Fix_Refcount_2', MvOPEN_Error ) }">
	<MvELSE>
		<MvWHILE EXPR = "{ NOT TempStruct.d.EOF }">
			<MvIF EXPR = "{ TempStruct.d.field_name EQ 'ATTEMP_ID' }">
				<MvASSIGN NAME = "l.found" VALUE = 1>
				<MvWHILESTOP>
			</MvIF>

			<MvSKIP	NAME = "TempStruct" ROWS = 1>
		</MvWHILE>
	</MvIF>
	
	<MvCLOSE NAME = "TempStruct">

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


<MvFUNCTION NAME = "STP_Upgrade_Store_DB_New_AttributeTemplates" STANDARDOUTPUTLEVEL = "text,html">
	<MvASSIGN NAME = "Temporary.d.id"			VALUE = "{ Original.d.id }">
	<MvASSIGN NAME = "Temporary.d.code"			VALUE = "{ Original.d.code }">
	<MvASSIGN NAME = "Temporary.d.prompt"		VALUE = "{ Original.d.prompt }">
	<MvASSIGN NAME = "Temporary.d.refcount"		VALUE = "{ Original.d.refcount }">

	<MvADD NAME = "Temporary">

	<MvFUNCTIONRETURN VALUE = 1>
</MvFUNCTION>
