<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE ELEMENT SYSTEM "/u/web/ucpusa/mpc/data/dtd/element.dtd">
<ELEMENT>
	<VERSION>1</VERSION>
	<TYPE>Merc_ItemImage</TYPE>
	<GLOBAL TYPE="never"></GLOBAL>
	<UIGRAPHIC></UIGRAPHIC>
	<UITEXT></UITEXT>
	<!-- Can't be deleted -->
	<PERMISSIONS>666</PERMISSIONS>
	<PROPERTIES>
		<PROPERTY NAME="width">
			<VALUE>300</VALUE>
		</PROPERTY>
		<PROPERTY NAME="height">
			<VALUE>200</VALUE>
		</PROPERTY>
		<PROPERTY NAME="style">
			<VALUE>text-prodname</VALUE>
		</PROPERTY>
		<PROPERTY NAME="visible">
			<VALUE>Yes</VALUE><VALUE>No</VALUE>
		</PROPERTY>
		<PROPERTY NAME="resizeBy">
			<VALUE>none</VALUE>
		</PROPERTY>
		<PROPERTY NAME="imageSizeWidth">
			<VALUE></VALUE>
		</PROPERTY>
		<PROPERTY NAME="imageSizeHeight">
			<VALUE></VALUE>
		</PROPERTY>
	</PROPERTIES>
	<SCRIPT NAME="common" TYPE="common" VERSION="1.0"><![CDATA[
	]]></SCRIPT>
	<SCRIPT NAME="output" TYPE="output" VERSION="1.0"><![CDATA[
	function output(type)
	{
		if (visible.selectedIndex != -1 && visible[visible.selectedIndex] == "No")
			return true;

		if (type == "text/html")
		{
			if (resizeBy == 'none')
			{
				/* set default size */
				width = 300;
				height = 200;
			}
			write('<div id="newLayer'+merc_elementid+'" name="newLayer'+merc_elementid+'" ');
			write('style="position:absolute; width:'+width+'px; ');
			write('height:'+height+'px; left:'+merc_xpos+'px; top:'+merc_ypos+'px;');
			write('z-index:'+merc_zindex+';">');

			write('<scr');
				writeln('ipt runat="merc_server">');

			writeln('key = doActionEx("REQ_GET_FORMVALUE","Result","ItemKey","ItemKey");');
			writeln('if (key && key != "")');
			writeln('{');
			writeln('	var rowName = MERC_ITEMCACHE.GetFirstItem();');
			writeln('	var name = MERC_ITEMCACHE.GetItemData(rowName,"PictureFile");');
			writeln ('	if (name && name != ""){');
			write('		write(\'<img src="\'+name+\'"\');');
			if (resizeBy == 'none')
				writeln('		writeln(">");');
			else if (resizeBy == 'width')
				writeln('		writeln(" width='+imageSizeWidth+'>");');
			else /* height */
				writeln('		writeln(" height='+imageSizeHeight+'>");');
			writeln('	}');
			writeln('}');

			write('</scr');
				writeln('ipt>');
			write('</div>');
			return true;
		}
		else if (type == "text/wml")
		{
			// output WML
		}
	}
	]]></SCRIPT>
	<SCRIPT NAME="output_edit_mode" TYPE="output_edit_mode" VERSION="1.0"><![CDATA[
	function output_edit_mode(type)
	{
		if (type == "text/html")
		{
			/* set default size */
			width = 300;
			height = 200;
			if (resizeBy == 'width')
			{
				width = imageSizeWidth;
				var tmpRat = imageSizeWidth / 300;
				height = Math.round(height * tmpRat);
			}
			else if (resizeBy == 'height')
			{
				var tmpRat = imageSizeHeight / 200;
				height = imageSizeHeight;
				width= Math.round(width * tmpRat);
			}
			write('<div id="newLayer'+merc_elementid+'" name="newLayer'+merc_elementid+'" ');
			if (style && style != '')
			{
				write(' class="'+style+'" ');
			}
			write('style="position:absolute; width:'+width+'px; ');
			write('height:'+height+'px; left:'+merc_xpos+'px; top:'+merc_ypos+'px;');
			write('z-index:'+merc_zindex+';">');

			write('<table border=1 cellspacing="0" cellpadding="0"><tr>');
			write('<td width='+width+' height='+height);
			if (visible.selectedIndex != -1 && visible[visible.selectedIndex] == "No")
			{
				write(' background="/cgi-docs/Mercantec/PC_F_6.6.1/images/highlite_inactive_sm.gif">');
				write('<font color="#999999">');
			}
			else
				write('>');
			writeln('<center>');
			writeln("Your image goes here");
			writeln('</center>');
			if (visible.selectedIndex != -1 && visible[visible.selectedIndex] == "No")
				writeln('</font>');
			writeln('</td></tr></table>');

			write('</div>');
			return true;
		}
		else if (type == "text/wml")
		{
			// output WML
		}
	}
	]]></SCRIPT>
	<SCRIPT NAME="edit_properties" TYPE="edit_properties" VERSION="1.0"><![CDATA[
	function edit_properties()
	{
		//write out html for EditProperties dialog box
		// The input "names" have to match the <name> tags above.
		write('<form name="saveprop">');
		var addEditMode = doAction('REQ_GET_FORMVALUE', "ElementAddEdit", "ElementAddEdit");
		writeln('<input type=hidden name="ElementAddEdit" value="'+addEditMode+'">');
		writeln('<input type=hidden name="ElementID" value="'+merc_elementid+'">');

		writeln('<p align="center"><span class="dialog-title">Item Image</span></p>');
		writeln('<table width="407" border="0" cellspacing="0" cellpadding="0" align="center" class="table-bkgrd-main">');
		writeln('<tr valign="top"><td colspan="2" class="field-label"><center>');

		writeln('<table border=0 width="344">');
		writeln('<tr valign="top"><td colspan="2">&nbsp;');
		writeln('</td></tr>');
		writeln('</table>');
		writeln('<table width="344" border="1" cellspacing="0" cellpadding="0">');
		writeln('<tr class="table-bkgrd-main">');
		writeln('<td width="25%" rowspan="4" class="table-header2">');
		writeln('<span class="field-label">Size: </span>');
		writeln('</td></tr>');
		writeln('<tr class="table-bkgrd-main">');
		writeln('<td width="75%" class="table-bkgrd-main">');
		var checked = "";
		if (resizeBy == 'none')
		{
			checked = "checked";
			imageSizeWidth = imageSizeHeight = 0;
		}
		writeln('<input type="radio" class="table-bkgrd-main" name="resizeBy" value="none" '+checked+' onClick="clearSizes(0);">');
		writeln('	Keep Current Size');
		writeln('</td></tr>');
		writeln('<td width="75%" class="table-bkgrd-main">');
		if (resizeBy == 'width')
		{
			checked = "checked";
			imageSizeHeight = 0;
		}
		else
		{
			checked = "";
			imageSizeWidth = 0;
		}
		writeln('<input type="radio" class="table-bkgrd-main" name="resizeBy" value="width" '+checked+' onClick="clearSizes(1);this.form.imageSizeWidth.focus();">');
		writeln('	Resize by Width <input type="text" name="imageSizeWidth" size="5" value="'+(imageSizeWidth?imageSizeWidth:"")+'">');
		writeln('	pixels');
		writeln('</td></tr>');
		writeln('<td width="75%" class="table-bkgrd-main">');
		if (resizeBy == 'height')
			checked = "checked";
		else
			checked = "";
		writeln('<input type="radio" class="table-bkgrd-main" name="resizeBy" value="height" '+checked+' onClick="clearSizes(2);this.form.imageSizeHeight.focus();">');
		writeln('	Resize by Height <input type="text" name="imageSizeHeight" size="5" value="'+(imageSizeHeight?imageSizeHeight:"")+'">');
		writeln('	pixels');
		writeln('</td></tr>');
		writeln('</table>');
		writeln('<table border=0 width="344">');
		writeln('<tr valign="top"><td colspan="2">');
		writeln('<span class="instr-note">Select \"Keep Current Size\" to have all item images display in their actual size when published.</span>');
		writeln('<span class="instr-note">Select \"Resize\" to force all item images to scale to the same width or height in the published site.</span>');
		writeln('</td></tr>');
		writeln('</table>');
		writeln('<table border=0 width="344">');
		writeln('<tr valign="top"><td colspan="2">&nbsp;');
		writeln('</td></tr>');
		writeln('</table>');

		writeln('<table width="344" border="1" cellspacing="0" cellpadding="0">');
		writeln('<tr><td width="96" class="table-header2"><span class="field-label">Visible:</span></td>');
		writeln('<td colspan="2" width="212">');
		var visSelect = (visible.selectedIndex == -1 ? 0 : visible.selectedIndex);
		for (i=0; i < visible.length; i++)
		{
			write('<input type="radio" class="table-bkgrd-main" name="visible" value="'+visible[i]+'"');
			if (i == visSelect)
				write(' CHECKED');
			writeln('>'+visible[i]);
		}
		writeln('</td></tr></table>');
		writeln('<table width="75%" border="0" cellspacing="0" cellpadding="0">');
		writeln('<tr valign="top"><td colspan="2">');
		writeln('<span class="instr-note">If you do not want this element to appear on your product pages, select \"No\" for \"Visible\"</span>');
		writeln('</td></tr></table>');

		writeln('</center></td></tr>');
		writeln('</table>');

		writeln('<table width="407" border="0" cellspacing="0" cellpadding="0" align="center" class="table-bkgrd-main">');
		writeln('<tr><td><center>');
<!--BEGIN HELP WINDOW LINK-->
var helpdomain = doAction('DATA_GETCONFIGDATA', 'ObjectName', 'HelpCfg', 'RowName', 'helpdomain', 'ColName', 'Domain');
var helpversion = doAction('DATA_GETCONFIGDATA', 'ObjectName', 'HelpCfg', 'RowName', 'helpversion', 'ColName', 'Domain');

writeln('<a href="javascript:void(opener.parent.openHelpWindow(\'http://'+helpdomain+'/cgi-bin/helpsrvr.exe?R+helpsrvr+OH_RTL_ELMT_ITMIMG+SoftCart+'+helpversion+'+en-us\', \'Alane\'));"> <img src="/cgi-docs/Mercantec/PC_F_6.6.1/images/help2.gif" width="97" height="30" border="0" name="help" alt="Help"></a><!--END HELP WINDOW LINK--><a>');


		writeln('<a href="javascript:opener.CloseWinSubmitForm(\'PE_Cancel\', \'Layout1.htm\', \'mainFrame\', document.saveprop);"><img src="/cgi-docs/Mercantec/PC_F_6.6.1/images/Cancel_Nbtn_base.gif" width="86" height="30" alt="Cancel" border="0"></a>');
		writeln('<a href="javascript:if(validate())opener.CloseWinSubmitForm(\'PE_SaveProperties\', \'Layout1.htm\', \'mainFrame\', document.saveprop);">');
		writeln('<img src="/cgi-docs/Mercantec/PC_F_6.6.1/images/Save_Nbtn_base.gif" width="86" height="30" alt="Ok" border="0"></a>');
		writeln('</td></tr></table>');
		write('</form>');
		writeln ("<SCRIPT language=javascript>");+
		writeln('self.resizeTo(500, 400);');
		writeln('function clearSizes(mode){if (mode != 1)document.saveprop.imageSizeWidth.value="";if (mode !=2)document.saveprop.imageSizeHeight.value="";}');
		writeln('function validate(){if (document.saveprop.resizeBy[1].checked && parseInt(document.saveprop.imageSizeWidth.value) > 0)');
		writeln('		return true;');
		writeln('	if (document.saveprop.resizeBy[2].checked && parseInt(document.saveprop.imageSizeHeight.value) > 0)');
		writeln('		return true;');
		writeln('	if (document.saveprop.resizeBy[0].checked)');
		writeln('		return true;');
		writeln('	alert("Please enter a valid number");');
		writeln('	return false;}');
		writeln('</script>');
		return true;
	}
	]]></SCRIPT>
	<SCRIPT NAME="save_properties" TYPE="save_properties" VERSION="1.0"><![CDATA[
	// May not need to do anything in all cases
	// Save things to Prod DB on price/desc? - automatic based on dbentry
	// if there is a reason not to dismiss the properties dialog, return false
	function save_properties()
	{
		return true;
	}
	]]></SCRIPT>
	<SCRIPT NAME="create_element" TYPE="create_element" VERSION="1.0"><![CDATA[
	function create_element()
	{
		return true;
	}
	]]></SCRIPT>
	<SCRIPT NAME="destroy_element" TYPE="destroy_element" VERSION="1.0"><![CDATA[
	function destroy_element()
	{
		return true;
	}
	]]></SCRIPT>
</ELEMENT>

