/* http://keith-wood.name/svg.html
   SVG filters for jQuery v1.2.0.
   Written by Keith Wood (kbwood@virginbroadband.com.au) August 2007.
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and 
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses. 
   Please attribute the author if you use it. */
(function($){$.svg.addExtension('filters',SVGFilter);$.extend($.svg._wrapperClass.prototype,{filter:function(a,b,x,y,c,d,e){return this._makeNode(a,'filter',$.extend({id:b,x:x,y:y,width:c,height:d},e||{}))}});function SVGFilter(a){this._wrapper=a}$.extend(SVGFilter.prototype,{distantLight:function(a,b,c,d,e){return this._wrapper._makeNode(a,'feDistantLight',$.extend({result:b,azimuth:c,elevation:d},e||{}))},pointLight:function(a,b,x,y,z,c){return this._wrapper._makeNode(a,'fePointLight',$.extend({result:b,x:x,y:y,z:z},c||{}))},spotLight:function(a,b,x,y,z,c,d,e,f){if(typeof c=='object'){f=c;c=null}var g=$.extend({result:b,x:x,y:y,z:z},(c!=null?{pointsAtX:c,pointsAtY:d,pointsAtZ:e}:{}));return this._wrapper._makeNode(a,'feSpotLight',$.extend(g,f||{}))},blend:function(a,b,c,d,e,f){return this._wrapper._makeNode(a,'feBlend',$.extend({result:b,mode:c,'in':d,in2:e},f||{}))},colorMatrix:function(a,b,c,d,e,f){if(isArray(e)){var g='';for(var i=0;i<e.length;i++){g+=(i==0?'':' ')+e[i].join(' ')}e=g}else if(typeof e=='object'){f=e;e=null}var h=$.extend({result:b,'in':c,type:d},(e!=null?{values:e}:{}));return this._wrapper._makeNode(a,'feColorMatrix',$.extend(h,f||{}))},componentTransfer:function(a,b,c,d){var e=this._wrapper._makeNode(a,'feComponentTransfer',$.extend({result:b},d||{}));var f=['R','G','B','A'];for(var i=0;i<Math.min(4,c.length);i++){var g=c[i];var h=$.extend({type:g[0]},(g[0]=='table'||g[0]=='discrete'?{tableValues:g[1].join(' ')}:(g[0]=='linear'?{slope:g[1],intercept:g[2]}:(g[0]=='gamma'?{amplitude:g[1],exponent:g[2],offset:g[3]}:{}))));this._wrapper._makeNode(e,'feFunc'+f[i],h)}return e},composite:function(a,b,c,d,e,f,g,h,i,j){if(typeof f=='object'){j=f;f=null}var k=$.extend({result:b,operator:c,'in':d,in2:e},(f!=null?{k1:f,k2:g,k3:h,k4:i}:{}));return this._wrapper._makeNode(a,'feComposite',$.extend(k,j||{}))},convolveMatrix:function(a,b,c,d,e){var f='';for(var i=0;i<d.length;i++){f+=(i==0?'':' ')+d[i].join(' ')}d=f;return this._wrapper._makeNode(a,'feConvolveMatrix',$.extend({result:b,order:c,kernelMatrix:d},e||{}))},diffuseLighting:function(a,b,c,d){if(typeof c=='object'){d=c;c=null}return this._wrapper._makeNode(a,'feDiffuseLighting',$.extend($.extend({result:b},(c?{'lighting-color':c}:{})),d||{}))},displacementMap:function(a,b,c,d,e){return this._wrapper._makeNode(a,'feDisplacementMap',$.extend({result:b,'in':c,in2:d},e||{}))},flood:function(a,b,x,y,c,d,e,f,g){if(arguments.length<6){e=x;f=y;g=c;x=null}var h=$.extend({result:b,'flood-color':e,'flood-opacity':f},(x!=null?{x:x,y:y,width:c,height:d}:{}));return this._wrapper._makeNode(a,'feFlood',$.extend(h,g||{}))},gaussianBlur:function(a,b,c,d,e,f){if(typeof e=='object'){f=e;e=null}return this._wrapper._makeNode(a,'feGaussianBlur',$.extend({result:b,'in':c,stdDeviation:d+(e?' '+e:'')},f||{}))},image:function(a,b,c,d){var e=this._wrapper._makeNode(a,'feImage',$.extend({result:b},d||{}));e.setAttributeNS($.svg.xlinkNS,'href',c);return e},merge:function(a,b,c,d){var e=this._wrapper._makeNode(a,'feMerge',$.extend({result:b},d||{}));for(var i=0;i<c.length;i++){this._wrapper._makeNode(e,'feMergeNode',{'in':c[i]})}return e},morphology:function(a,b,c,d,e,f,g){if(typeof f=='object'){g=f;f=null}return this._wrapper._makeNode(a,'feMorphology',$.extend({result:b,'in':c,operator:d,radius:e+(f?' '+f:'')},g||{}))},offset:function(a,b,c,d,e,f){return this._wrapper._makeNode(a,'feOffset',$.extend({result:b,'in':c,dx:d,dy:e},f||{}))},specularLighting:function(a,b,c,d,e,f,g){if(typeof d=='object'){g=d;d=null}if(typeof e=='object'){g=e;e=null}if(typeof f=='object'){g=f;f=null}return this._wrapper._makeNode(a,'feSpecularLighting',$.extend({result:b,'in':c,surfaceScale:d,specularConstant:e,specularExponent:f},g||{}))},tile:function(a,b,c,x,y,d,e,f){return this._wrapper._makeNode(a,'feTile',$.extend({result:b,'in':c,x:x,y:y,width:d,height:e},f||{}))},turbulence:function(a,b,c,d,e,f){if(typeof e=='object'){f=e;e=null}return this._wrapper._makeNode(a,'feTurbulence',$.extend({result:b,type:c,baseFrequency:d,numOctaves:e},f||{}))}});function isArray(a){return(($.browser.safari&&typeof a=='object'&&a.length)||(a&&a.constructor&&a.constructor.toString().match(/\Array\(\)/)))}})(jQuery)