/*==================================================================================================================*\
	IE A:FOCUS FIX
\*==================================================================================================================*/
if (_IE_) {
	function hideFocusDot() {
		$('body').find('a').each(function() {
			$(this).focus(function() {
				$(this).attr('hideFocus', true);
			});
		});
	}
}

/*==================================================================================================================*\
	IE6/7 :HOVER, :ACTIVE, :FOCUS SUPPORT
// \*==================================================================================================================*/
if (_IE6_ || _IE7_) {
	function ieCSSactionFix() {
		window.CSSHover = (function() {
			var f				= /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active|focus))/i,
				REG_AFFECTED	= /(.*?)\:(hover|active|focus)/i,
				REG_PSEUDO		= /[^:]+:([a-z-]+).*/i,
				REG_SELECT		= /(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi,
				REG_CLASS		= /\.([a-z0-9_-]*on(hover|active|focus))/i,
				REG_MSIE		= /msie (5|6|7)/i,
				REG_COMPAT		= /backcompat/i,
				g				= 'csh-',
				h				= {
					elements	: [],
					callbacks	: {},
					init		: function() {
						if (!REG_MSIE.test(navigator.userAgent) && !REG_COMPAT.test(window.document.compatMode)) {
							return;
						}
						var a = window.document.styleSheets,
							l = a.length;
						for (var i = 0; i < l; i++) {
							this.parseStylesheet(a[i]);
						}
				},
				parseStylesheet: function(a) {
					if (a.imports) {
						try{
							var b = a.imports,
								l = b.length;
							for (var i = 0; i < l; i++) {
								this.parseStylesheet(a.imports[i]);
							}
						}
						catch (securityException) {
						}
					}
					try{
						var c = a.rules,
							l = c.length;
						for (var j = 0; j < l; j++) {
							this.parseCSSRule(c[j], a);
						}
					}
					catch (securityException) {
					}
				},
				parseCSSRule: function(a, b) {
					var c = a.selectorText;
					if (f.test(c)) {
						var d			= a.style.cssText,
							affected	= REG_AFFECTED.exec(c)[1],
							pseudo		= c.replace(REG_PSEUDO, 'on$1'),
							newSelect	= c.replace(REG_SELECT, '.$2' + pseudo),
							className	= REG_CLASS.exec(newSelect)[1],
							e			= affected + className;
						if (!this.callbacks[e]) {
							b.addRule(affected, g + className + ':expression(CSSHover(this, "' + pseudo + '", "' + className + '"))');
							this.callbacks[e] = true;
						}
						b.addRule(newSelect, d);
					}
				},
				patch: function(a, b, c) {
					var d = g + c;
					if (a.style[d]) {
						a.style[d] = null;
					}
					if (!a.csshover) {
						a.csshover = [];
					}
					if (!a.csshover[c]) {
						a.csshover[c] = true;
						var e = new CSSHoverElement(a, b, c);
						this.elements.push(e);
					}
					return b;
				},
				unload: function() {
					try {
						var l = this.elements.length;
						for (var i = 0; i < l; i++) {
							this.elements[i].unload();
						}
						this.elements = [];
						this.callbacks = {};
					}
					catch (e) {
					}
				}
			};
			window.attachEvent('onbeforeunload', function() {
				h.unload();
			});
			var k = {
				onhover: {
					activator	: 'onmouseenter',
					deactivator	: 'onmouseleave'
				},
				onactive: {
					activator	: 'onmousedown',
					deactivator	: 'onmouseup'
				},
				onfocus: {
					activator	: 'onfocus',
					deactivator	: 'onblur'
				}
			};
			function CSSHoverElement(a, b, c) {
				this.node = a;
				this.type = b;
				var d = new RegExp('(^|\\s)' + c + '(\\s|$)', 'g');
				this.activator = function() {
					a.className += ' ' + c;
				};
				this.deactivator = function() {
					a.className = a.className.replace(d, ' ');
				};
				a.attachEvent(k[b].activator, this.activator);
				a.attachEvent(k[b].deactivator, this.deactivator);
			}
			CSSHoverElement.prototype = {
				unload: function() {
					this.node.detachEvent(k[this.type].activator, this.activator);
					this.node.detachEvent(k[this.type].deactivator, this.deactivator);
					this.activator		= null;
					this.deactivator	= null;
					this.node			= null;
					this.type			= null;
				}
			};
			return function(a, b, c) {
				if (a) {
					return h.patch(a, b, c);
				}
				else {
					h.init();
				}
			}
		})();
	}
	ieCSSactionFix();
	CSSHover();
}
