##
##  wml::des::preload - Preload Page Contents
##  Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. 
##  Copyright (c) 2000-2001 Denis Barbier
##

#  The <preserve>/<restore> tags with multiple arguments require WML 2.0.3
#use wml::mod::version
<require 2.0.3 />

#use wml::std::tags

<set-var __pl:count=0 />

<define-tag preload whitespace=delete>
<preserve src via />
<set-var via=size />
<set-var %attributes />
<increment __pl:count />
<when <string-eq "<get-var via />" "size" />>
<img name=preload_img_<get-var __pl:count />
     src="<get-var src />"
     width=1 height=1 alt="" />
</when>
<when <string-eq "<get-var via />" "js" />>
<copy-var src __pl:src />
#   the <group> tag prevents deletion of newlines
<group "
<javascript>
if (document.images) {
    preload_img_<get-var __pl:count /> = new Image();
    preload_img_<get-var __pl:count />.src = '<get-var __pl:src />';
}
</javascript>
" />
</when>
<restore  src via />
</define-tag>

##EOF##
