set thehtml to ""
set bname to "a0"
tell application "Finder"
display dialog "Value:" buttons {"OK", "Cancel"} default answer "" default button "OK"
set itemz to text returned of result
set itemza to
set header to "<!--#include virtual=\"/inc/header.inc\" -->" as string
set footer to "<!--#include virtual=\"/inc/footer.inc\" -->" as string
set start to "<div id=\"left\">
<h2>Area Rugs:</h2>
<h3><!--#ystore_catalog id=" as string
set next to " field=\"name\" --></h3>
<span class=\"image\"><a href=\"javascript

optastic('<!--#ystore_catalog id=" as string
set nexter to " field=\"image\" -->');\"><!--#ystore_catalog id=" as string
set nexterer to "field=image format=html --></a></span><!--#ystore_catalog id="
set order to " field=caption -->
<form method=\"post\" action=\"<!--#ystore_order id=" as string
set closeup to " -->\">
<input type=\"submit\" value=\"Order\">
</form>
<br class=\"clear\" />
</div>" as string
set thehtml to thehtml & header & start & (bname & itemz) & next & (bname & itemz) & nexter & (bname & itemz) & nexterer & (bname & itemz) & order & (bname & itemz) & closeup & footer
repeat with itemz from 1 to itemz
set pat to "Mac:Users:Home

esktop:" as string
set open_file to ((pat & (bname & itemz) & ".htm") as string)
open for access (open_file) with write permission
write thehtml to (open_file as alias) as string starting at eof
close access (open_file as alias)
end repeat
end tell