/* Created by Martin Hintzmann 2008 martin [a] hintzmann.dk
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 *
 * Version: 0.1
 *
 * Requires:
 *   jQuery 1.2+
 */
(function(jq) {
    jq.fn.boxShadow = function(xOffset, yOffset, IEAbsoluteX, IEAbsoluteY, blurRadius, shadowColor) {
        if (!jq.browser.msie)
        {
            return this.each(function(){
                jq(this).css({
                'box-shadow':           xOffset+'px '+yOffset+'px '+blurRadius+'px '+shadowColor,
                '-o-box-shadow':        xOffset+'px '+yOffset+'px '+blurRadius+'px '+shadowColor,
                '-moz-box-shadow':      xOffset+'px '+yOffset+'px '+blurRadius+'px '+shadowColor,
                '-webkit-box-shadow':   xOffset+'px '+yOffset+'px '+blurRadius+'px '+shadowColor
                });
            });
        }
        return this.each(function(){
            jq(this).css({
                position:   "relative",
                zoom:       1,
                zIndex:     "100"
            });
            jq(this).parent().css({
                    position:   "relative"
            });
            
            var div=document.createElement("div");
            jq(this).append(div);

            var _top, _left, _width, _height;
            if (blurRadius !== 0) {
                jq(div).css("filter", "progid:DXImageTransform.Microsoft.Blur(pixelRadius="+(blurRadius)+", enabled='true')");
                _top =      IEAbsoluteY-blurRadius-1;
                _left =     IEAbsoluteX-blurRadius-1;
                _width =    jq(this).find("ul.navTreeLevel1 li a").width();
                _height =   jq(this).find("ul.navTreeLevel1").outerHeight()-16;
            } else {
                _top =      IEAbsoluteY;
                _left =     IEAbsoluteX;
                _width =    jq(this).outerWidth()-10;
                _height =   jq(this).outerHeight()+12;
            }
            jq(div).css({
                top:        _top,
                left:       _left,
                width:      _width,
                height:     _height,
                background: shadowColor,
                position:   "absolute",
                zIndex:     "99"
            });
        });
    };
})(jQuery);
