$(document).ready(function() {

	if ($.browser.msie) {
		$(document.body).addClass('ie');
		if (parseInt($.browser.version) == 6) $(document.body).addClass('ie6');	
		else if (parseInt($.browser.version) == 7) $(document.body).addClass('ie7');	
	}
	
	$('#navigation-main li:first').addClass('first-child');
	$('#navigation-main li:last').addClass('last-child');
	
	$('#col3 li:first').addClass('first-child');
	$('#col3 li:last').addClass('last-child');
	

	$('a.hover')
		.mouseover(function(e) {
			var target = e.target;
			if (target.tagName.toLowerCase() != 'a') target = target.parentNode;

			var over	= $(target).find('.hover');
			if (over.length == 0) return;
			var normal	= $(target).find('.normal');

			normal.hide();
			over.show();

		})
		.mouseout(function(e) {
			var target = e.target;
			if (target.tagName.toLowerCase() != 'a') target = target.parentNode;
			
			var over 	= $(target).find('.hover');
			if (over.length == 0) return;
			var normal	= $(target).find('.normal');

			over.hide();
			normal.show();
		});

	$('.image-link')
		.mouseover(function(e) {
			var target = e.target;
			
			if (target.tagName.toLowerCase()=='div') return;

			target = target.parentNode;

			var over = $(target).find('.icon_hover');
			if (over.length > 0) {
				$(target).data('hover',true);
				
				var normal = $(target).find('.icon');
				over.stop();

				over.show();

				over.css('opacity',1);
			}
		})
		.mouseout(function(e) {
			var target = e.target;
			
			if (target.tagName.toLowerCase()=='div') return;

			target = target.parentNode;

			var over = $(target).find('.icon_hover');
			if (over.length > 0) {
				$(target).data('hover',false);
				setTimeout(function() {
					
					var normal = $(target).find('.icon');
					over.stop();

					if ($(target).data('hover')) return;
					
					over.fadeOut(500);
				},100);
			}
		})
		;

});
