/*

 jQuery.Rule - Css Rules manipulation, the jQuery way.
 Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 Dual licensed under MIT and GPL.
 Date: 02/27/2008
 Compatible with jQuery 1.2.x, tested on FF 2, Opera 9, Safari 3, and IE 6, on Windows.
 (version 1.0.1.1 adds support for jQuery 1.4.2 to version 1.0.1)

*/
(function(c){var i=c('<style rel="alternate stylesheet" type="text/css" />').appendTo("head")[0],j=i.sheet?"sheet":"styleSheet",f=i[j],g=f.rules?"rules":"cssRules",m=f.deleteRule?"deleteRule":"removeRule";i=f.ownerNode?"ownerNode":"owningElement";var l=/^([^{]+)\{([^}]*)\}/m,n=/([^:]+):([^;}]+)/;f.disabled=true;var d=c.rule=function(a,b){if(!(this instanceof d))return new d(a,b);this.sheets=d.sheets(b);if(a&&l.test(a))a=d.clean(a);if(typeof a=="object"&&!a.exec)return this.setArray(a.get?a.get():
a.splice?a:[a]);this.setArray(this.sheets.cssRules().get());return a?this.filter(a):this};c.extend(d,{sheets:function(a){var b=a;if(typeof b!="object")b=c.makeArray(document.styleSheets);b=c(b).not(f);if(typeof a=="string")b=b.ownerNode().filter(a).sheet();return b},rule:function(a){if(a.selectorText)return["",a.selectorText,a.style.cssText];return l.exec(a)},appendTo:function(a,b,e){switch(typeof b){case "string":b=this.sheets(b);case "object":if(b[0])b=b[0];if(b[j])b=b[j];if(b[g])break;default:if(typeof a==
"object")return a;b=f}var h;if(!e&&(h=this.parent(a)))a=this.remove(a,h);a=this.rule(a);if(b.addRule)b.addRule(a[1],a[2]||";");else b.insertRule&&b.insertRule(a[1]+"{"+a[2]+"}",b[g].length);return b[g][b[g].length-1]},remove:function(a,b){b=b||this.parent(a);if(b!=f){var e=b?c.inArray(a,b[g]):-1;if(e!=-1){a=this.appendTo(a,0,true);b[m](e)}}return a},clean:function(a){return c.map(a.split("}"),function(b){if(b)return d.appendTo(b+"}")})},parent:function(a){if(typeof a=="string"||!c.browser.msie)return a.parentStyleSheet;
var b;this.sheets().each(function(){if(c.inArray(a,this[g])!=-1){b=this;return false}});return b},outerText:function(a){return!a?"":[a.selectorText+"{","\t"+a.style.cssText,"}"].join("\n").toLowerCase()},text:function(a,b){if(b!==undefined)a.style.cssText=b;return!a?"":a.style.cssText.toLowerCase()}});d.fn=d.prototype={pushStack:function(a,b){a=d(a,b||this.sheets);a.prevObject=this;return a},end:function(){return this.prevObject||d(0,[])},filter:function(a){var b;a||(a=/./);if(a.split){b=c.trim(a).toLowerCase().split(/\s*,\s*/);
a=function(){return!!c.grep(this.selectorText.toLowerCase().split(/\s*,\s*/),function(e){return c.inArray(e,b)!=-1}).length}}else if(a.exec){b=a;a=function(){return b.test(this.selectorText)}}return this.pushStack(c.grep(this,function(e,h){return a.call(e,h)}))},add:function(a,b){return this.pushStack(c.merge(this.get(),d(a,b)))},is:function(a){return!!(a&&this.filter(a).length)},not:function(a,b){a=d(a,b);return this.filter(function(){return c.inArray(this,a)==-1})},append:function(a){var b=this,
e;c.each(a.split(/\s*;\s*/),function(h,k){if(e=n.exec(k))b.css(e[1],e[2])});return this},text:function(a){return!arguments.length?d.text(this[0]):this.each(function(){d.text(this,a)})},outerText:function(){return d.outerText(this[0])}};c.each({ownerNode:i,sheet:j,cssRules:g},function(a,b){var e=b==g;c.fn[a]=function(){return this.map(function(){return e?c.makeArray(this[b]):this[b]})}});c.fn.cssText=function(){return this.filter("link,style").eq(0).sheet().cssRules().map(function(){return d.outerText(this)}).get().join("\n")};
c.each("remove,appendTo,parent".split(","),function(a,b){d.fn[b]=function(){var e=c.makeArray(arguments),h=this;e.unshift(0);return this.each(function(k){e[0]=this;h[k]=d[b].apply(d,e)||h[k]})}});c.each("each,index,get,size,eq,slice,map,attr,andSelf,css,show,hide,toggle,queue,dequeue,stop,animate,fadeIn,fadeOut,fadeTo".split(","),function(a,b){d.fn[b]=c.fn[b]});d.fn.setArray=function(a){this.length=0;Array.prototype.push.apply(this,a);return this};var o=c.curCSS;c.curCSS=function(a,b){return"selectorText"in
a?a.style[b]||c.prop(a,b=="opacity"?1:0,"curCSS",0,b):o.apply(this,arguments)};d.cache={};i=function(a){return function(b){var e=b.selectorText;if(e)arguments[0]=d.cache[e]=d.cache[e]||{};return a.apply(c,arguments)}};c.data=i(c.data);c.removeData=i(c.removeData);c(window).unload(function(){c(f).cssRules().remove()})})(jQuery);
