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

var bottomshadowsrc="../microsite/images/shadowbottom.png" //Full URL to bottom shadow gif on your server
var rightshadowsrc="../microsite/images/shadow_right.png" //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;
}

function Fade(id, opacStart, opacEnd, millisec) {
    try {
        //speed for each frame 
        var speed = Math.round(millisec / 100);
        var timer = 0;

        //determine the direction for the blending, if start and end are the same nothing happens 
        if (opacStart > opacEnd) {
            for (i = opacStart; i >= opacEnd; i--) {
                setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
                timer++;
            }
        }
        else if (opacStart < opacEnd) {
            for (i = opacStart; i <= opacEnd; i++) {
                setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
                timer++;
            }
        }
    } catch (e) { alert(e); }

}

//change the opacity for different browsers 
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";

} 
