
jQuery.fn.gradient=function(settings){this.each(function(){var el=$(this);try{var height=el.outerHeight();var width=el.outerWidth();var position=el.offset();var top=position.top;var left=position.left;}catch(e){var width=parseInt(el.css('width'));var height=parseInt(el.css('height'));var top=parseInt(el.css('top'));var left=parseInt(el.css('left'));}
if(width==0||height==0)return;settings=jQuery.extend({rightcolor:'#000000',leftcolor:'#ffffff',topcolor:'#000000',bottomcolor:'#ffffff',horizontal:true,opacity:false},settings||{});if(settings.horizontal){var r=[parseInt(settings.rightcolor.substr(1,2),16),parseInt(settings.rightcolor.substr(3,2),16),parseInt(settings.rightcolor.substr(5,2),16)];var l=[parseInt(settings.leftcolor.substr(1,2),16),parseInt(settings.leftcolor.substr(3,2),16),parseInt(settings.leftcolor.substr(5,2),16)];var d=[(r[0]-l[0])/width,(r[1]-l[1])/width,(r[2]-l[2])/width];var w=width;}else{var r=[parseInt(settings.bottomcolor.substr(1,2),16),parseInt(settings.bottomcolor.substr(3,2),16),parseInt(settings.bottomcolor.substr(5,2),16)];var l=[parseInt(settings.topcolor.substr(1,2),16),parseInt(settings.topcolor.substr(3,2),16),parseInt(settings.topcolor.substr(5,2),16)];var d=[(r[0]-l[0])/width,(r[1]-l[1])/width,(r[2]-l[2])/width];var w=height;}
if(settings.opacity){var opacity='opacity:'
+settings.opacity/100+';'
+'filter:alpha(opacity='+settings.opacity+');'
+'-moz-opacity: '+Math.round(settings.opacity/10)/10+';';}
for(var i=0;i<w;i++){var c=[Math.floor(l[0]+i*d[0]),Math.floor(l[1]+i*d[1]),Math.floor(l[2]+i*d[2])];var theSlice='<div style="font-size: 1px; display: block; position: absolute;'
+'top: '+(settings.horizontal?top:top+i)+'px;'
+'left: '+(settings.horizontal?left+i:left)+'px;'
+'width: '+(settings.horizontal?'1':width)+'px;'
+'height: '+(settings.horizontal?height:'1')+'px;'
+(settings.opacity?opacity:'')
+'background-color: rgb('+c[0]+','+c[1]+','+c[2]+');" ></div>';$("body").prepend(theSlice);}});return this;};
