<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- saved from url=(0045)http://web-graphics.com/mtarchive/DCCode.html -->
<HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>DomCorners.js code</TITLE>

<META name="generator" content="HAPedit 3.1">
<STYLE type="text/css">
pre{background-color: #FFC}
pre em{color: #0080FF}
a{color: #641B21}
</STYLE>
</HEAD><BODY>
<PRE><EM>//domCorners by Alessandro Fulciniti on web-graphics.com
read <A href="http://web-graphics.com/mtarchive/001660.php">related article</A></EM>

<B>function DomCheck()</B>{
return(document.createElement &amp;&amp; document.getElementById)
}

<B>function DomCorners(id,bk,h,tries)</B>{
var el=document.getElementById(id);
if(el==null){                              <EM>// if the element isn't ready in the DOM...</EM>
    if(tries==null) tries=200;
    if(tries&gt;0)                            <EM>// and there are still tries...</EM>
        setTimeout("DomCorners('"+id+"','"+bk+"',"+h+","+(--tries)+")",50);  <EM>// back in 50ms</EM>
    return;
    }
var c=new Array(4);
for(var i=0;i&lt;4;i++){                      <EM>// create the four elements for rounded corners</EM>
    c[i]=document.createElement("b");
    c[i].style.display="block";            <EM>// with necessary style declarations</EM>
    c[i].style.height=h+"px";
    c[i].style.fontSize="1px";
    if(i%2==0)
        c[i].style.background="url("+bk+") no-repeat 0 -"+ i*h + "px";
    else
        c[i].style.background="url("+bk+") no-repeat 100% -"+ i*h + "px";
    }
c[0].appendChild(c[1]);
c[2].appendChild(c[3]);
el.style.padding="0";
el.insertBefore(c[0],el.firstChild);       <EM>// add top corners</EM>
el.appendChild(c[2]);                      <EM>// and bottom ones</EM>
}
</PRE>

</BODY></HTML>