/* **
* 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.
* 
*/
jQuery.fn.boxshadow = function(options) {
var defaults = {
hOffset : 3,
vOffset : 3,
shadowblur : 3,
color : '#808080'
}
// Extend our default options with those provided.
var opts = jQuery.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 (jQuery.browser.opera) {
jQuery(this).css("box-shadow",shadowVal);
} else if (jQuery.browser.webkit) {
jQuery(this).css("-webkit-box-shadow",shadowVal);
} else if (jQuery.browser.mozilla) {
jQuery(this).css("-moz-box-shadow",shadowVal);
} else if (jQuery.browser.msie) {
jQuery(this).css("filter",filterVal);
}
}
