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