//<![CDATA[

/**
* Adds hover support to IE6 browsers
* 
* This jQuery plugin will parse the stylesheets
* for any :hover rules and append them using Javascript
* while creating a new rule in the stylesheet with a .hover class
*
* Initilaize using:
*  
* $(document).ready(function(){
*	  $.ie6CSSHover();
* });
*
* Limitations:
* This script is not meant to parse :hover pseudo classes
* that contain :hover within a selector:
*
* Example:
* div span:hover p{font-size:12px} // WILL NOT WORK
* div span p:hover{font-size:12px} // WILL WORK
*
**/   

$.extend({

	ie6CSSHover:function(){   
		if($.browser.msie && /6.0/.test(navigator.userAgent)){			
			var len=document.styleSheets.length;				
			for(z=0;z<len;z++){			
				var sheet=document.styleSheets[z];					
				var css =sheet.cssText;					
				var r=new RegExp(/[a-zA-Z0-9\.-_#].*:hover\s?\{.[^\}]*\}/gi);					
				var m=css.match(r);			
					
				if(m!=null && m.length>0){					
					for(i=0;i<m.length;i++){   								
						var c=m[i].match(/\{(.[^\}]*)}/);							
						if(c[1]){							
							var seljq=m[i].replace(':hover','').replace(c[0],'');							
							var selcss=m[i].replace(':hover','.hover').replace(c[0],'');								
							var rule=c[1].replace(/^\s|\t|\s$|\r|\n/g,'');								
							document.styleSheets[z].addRule(selcss,rule);								
							if(!seljq.match(/a\:hover/i)){		
								$(seljq).hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')});
							}
						}					
					}				
				}   		
			}   	
		} 
	}

})(jQuery);

$(document).ready(function(){
	$.ie6CSSHover();
});

//]]>
