function svgradient(start, end, round) {
    if (round != undefined) { round.replace('px', ''); var r = 'rx="' + round + '" ry="' + round + '"'; }
    else { var r = ''; }
    var svg = '<?xml version="1.0" ?><svg xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="gr" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:' + start + '"/><stop offset="100%" style="stop-color:' + end + '"/></linearGradient></defs><rect x="0" y="0" ' + r + ' width="100%" height="100%" style="fill:url(#gr)"/></svg>'; if ($.base64Encode) { return 'data:image/svg+xml;base64,' + $.base64Encode(svg); }
    else { return 'data:image/svg+xml,' + escape(svg); } 
}
function webgr(obj, start, end, height, padding) { var wghost = (("https:" == document.location.protocol) ? "https" : "http"); he = parseInt(height.replace('px', '')) + parseInt(padding.replace('px', '')) * 2; return obj.css({ 'background': 'url("' + wghost + '://webgradients.appspot.com/make?width=1&height=' + he + '&start=' + start.replace('#', '') + '&end=' + end.replace('#', '') + '") repeat-x' }); }
(function ($) {
    $.fn.jacg = function (options) {
        var o = options; return this.each(function () {
            obj = $(this).css({ 'border-radius': o.radius }); if ($.browser.webkit == true) { obj.css({ '-webkit-border-radius': o.radius }); }
            else if ($.browser.mozilla == true) { obj.css({ '-moz-border-radius': o.radius }); if (parseInt($.browser.version.replace('.', '').replace('.', '')) < 192) { webgr(obj, o.start, o.end, "300px", obj.css('padding-bottom')); } }
            else if ($.browser.opera == true) {
                if (opera.version() >= 10.50) { obj.css({ 'background': 'url("' + svgradient(o.start, o.end) + '")' }); }
                else { obj.css({ 'background': 'url("' + svgradient(o.start, o.end, o.radius) + '")' }); } 
            }
            else { webgr(obj, o.start, o.end, "300px", obj.css('padding-bottom')); } 
        });
    };
})(jQuery);
