/* **
* jquery-boxshadow.js
*
$(object).boxshadow({
    hOffset : 3,
    vOffset : 3,
     shadowblur : 3,
     color : '#808080'
 })
*
* If you are using this with IE, you should set your object's background-color,
* otherwise the shadow is applied to all objects within your object as well.
*
*/


$.fn.boxshadow = function(options) {
var defaults = {
hOffset : 3,
vOffset : 3,
shadowblur : 3,
color : '#808080'
}
// Extend our default options with those provided.
var opts = $.extend(defaults, options);

var shadowVal = opts['hOffset'] + "px "+ opts['vOffset'] + "px " + opts['shadowblur'] + "px " + opts['color'];

if ((opts['hOffset'] > 0) && (opts['vOffset'] < 0)) { var direction = 45; var strength = opts['hOffset']; }
if ((opts['hOffset'] < 0) && (opts['vOffset'] > 0)) { var direction = -145; var strength = opts['hOffset'] * -1; }
if ((opts['hOffset'] > 0) && (opts['vOffset'] > 0)) { var direction = 145; var strength = opts['hOffset']; }
if ((opts['hOffset'] < 0) && (opts['vOffset'] < 0)) { var direction = -45; var strength = opts['hOffset'] * -1; }
var filterVal = "progid:DXImageTransform.Microsoft.Shadow(color='" + opts['color'] + "', Direction=" + direction + ", Strength=" + strength + ")"

if ($.browser.opera) {
$(this).css("box-shadow",shadowVal);
} else if ($.browser.webkit) {
$(this).css("-webkit-box-shadow",shadowVal);
} else if ($.browser.mozilla) {
$(this).css("-moz-box-shadow",shadowVal);
} else if ($.browser.msie) {
$(this).css("filter",filterVal);
}
}
