//
// Project  Name:
// File / Folder: /dropshadow.js
// File Language: javascript
// Copyright (C): 2007 The Richard Group, Inc.
// First  Author: Liam Bryan
// First Created: 2007.08.06 07:21:23
// Last Modifier: Liam Bryan
// Last Modified: 2007.08.06 08:10:50

function addShadow(node){
    var firstShadow = document.createElement('div');
    var secondShadow = document.createElement('div');
    firstShadow.className = 'firstShadow';
    secondShadow.className = 'secondShadow';
    firstShadow.style.width = (node.offsetWidth - 2) + 'px';
    secondShadow.style.width = (node.offsetWidth - 2) + 'px';
    firstShadow.style.height = (node.offsetHeight - 2) + 'px';
    secondShadow.style.height = (node.offsetHeight - 2) + 'px';
    
    node.appendChild(secondShadow);
    node.appendChild(firstShadow);
}

function rgShadow(){
    var potential = document.getElementsByTagName('div');
    for (var n = 0; n < potential.length; ++n) {
        if (potential[n].className.indexOf('dropshadow') > -1) {
            addShadow(potential[n]);
        }
    }
}

var shadowerOldOnload = window.onload;
window.onload = function(){
    if (shadowerOldOnload) {
        shadowerOldOnload();
    }
    rgShadow();
}

