//DOM Drop Shadows script- © Dynamic Drive (www.dynamicdrive.com)
//Last modified date: April 18th, 06

var bottomshadowsrc="shadow-bottom.gif" //Full URL to bottom shadow gif on your server
var rightshadowsrc="shadow-right.gif" //Full URL to right shadow gif on your server

var shadowcreator={
browserchk: document.getElementById, //apply effect only to DOM based browsers

addshadow:function(containerid, bottomshadowsrc, rightshadowsrc, shadowheight){
if (!this.browserchk) return
this.container=document.getElementById(containerid)
this.boxWidth=this.container.offsetWidth
this.boxHeight=this.container.offsetHeight
this.boxoffsetx=getposOffset(this.container, "left")
this.boxoffsety=getposOffset(this.container, "top")
this.shadowheight=shadowheight
this.internal_createshadow(bottomshadowsrc, "bottom")
this.internal_createshadow(rightshadowsrc, "right")
},

internal_createshadow:function(shadowsrc, position){
var shadow=document.createElement("img")
shadow.setAttribute("src", shadowsrc)
var cssString="position: absolute; width:"+this.boxWidth+"px; height:"+this.shadowheight
shadow.setAttribute("style", cssString)
if (shadow.style.cssText=="")
shadow.style.cssText=cssString
if (position=="bottom"){
shadow.style.left=this.boxoffsetx+"px"
shadow.style.top=this.boxHeight+this.boxoffsety+"px"
}
else if (position=="right"){
shadow.style.left=this.boxWidth+this.boxoffsetx+"px"
shadow.style.top=this.boxoffsety+"px"
shadow.style.width=parseInt(this.shadowheight)+"px"
shadow.style.height=this.boxHeight+parseInt(this.shadowheight)-1+"px"
}
document.body.appendChild(shadow)
}
}

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

