$(document).ready(function(){
	$('table.list tr td a img').each(setLoop);
	$('.gallery .photo a img').each(setLoop);
	hotNews();
	contents('.assyst_menu ul li');
	contents('.variants td');
	contents('.subpages ul li');
	//contents('.main_page_menu td');
	contents('.kak_priobresti td');
	validateSearch();
	//validateOverlayForms();
	highLight('.big_button');
	highLight('.activation');
	highLight('.download_wide');
	highLight('form input[type="submit"]');
	highLight('#products_add_menu_activated a');
	$('#products_add_menu_activated a').each(validateEmptyLinks);
	$('.products_add_menu a').each(validateEmptyLinks);
	anchorImitate();
	//hiddenAlert(window.innerWidth);

	$('.struct ul li').each(function() {
		var col = $('.struct ul li').length;
		var colY = 2;
		var colStr = Math.floor(col/colY);
		
		for (var i = 1; i <= colStr; i++) {
			var numY = (i*colY) - 1;
			var elt = $('.struct ul li').eq(numY);
			$(elt).addClass('rightcol')
		}	
	});


	
	$('input#spb').attr('checked', 'checked');

	$('.pager').each(function() {
		if ($(this).children().length === 1) {
			$(this).hide();
		}
	});
	
	
	
	
	
	$('#spb').bind('click', function() {
		$('.select_other_region').hide();
	});
	
	$('.dots a').each(function(i) {
		$(this).bind('click', function() {
			$('.dots a').removeClass('active');
			$(this).addClass('active');
			if (i==0) {
				//$('#informer').scrollTo('#how_much', 500);
				$('#informer').css('display', 'block');
				$('#how_much').css('display', 'none');
			}
			if (i==1) {
				//$('#how_much').scrollTo('#informer', 500);
				$('#how_much').css('display', 'block');
				$('#informer').css('display', 'none');
			}
			return false;
		});
	});


	$('.subpage_menu ul li').each(function() {
		var col = $('.subpage_menu ul li').length;
		var colY = 2;
		var colStr = Math.floor(col/colY);
		
		
		
		for (var i = 1; i <= colStr; i++) {
			var numY = (i*colY) - 1;
			var elt = $('.subpage_menu ul li').eq(numY);
			$(elt).addClass('rightcol')
		}	
	});
	


    $('.rounded_input #address').val("Москва");
    $('.rounded_input #phone_country').val("+7");
    $('.rounded_input select.region').change(function() {
                                
        var my_Choice =  $('.rounded_input select.region :selected').val();   
                            
        if (my_Choice == 'Москва') {
            $('.rounded_input #address').val("Москва");
        }
        else if (my_Choice == 'Санкт-Петербург') {
            $('.rounded_input #address').val("Санкт-Петербург");
        }
        else {
            $('.rounded_input #address').val("");
        }
                            
                                                
    });
	
	var city_form = $('.rounded_input select.region :selected').val();

	if(city_form != 'Москва'){
		$('.rounded_input #address').val("");
	}
	
	$('.rss img').each(function() {
		$(this).bind('mouseover', function() {
			$(this).attr('src', '/assets/templates/newcntd/images/rss.gif');
		});
		$(this).bind('mouseout', function() {
			$(this).attr('src', '/assets/templates/newcntd/images/rss_l.gif');
		});
	});
	
	$('#dif_icons ul li').each(function() {
		var catchUri = $(this).find('a').attr('href').replace('/','').replace('.html', '');
		switch (catchUri) {
			case 'manager_lawyer':
			$(this).attr('id', 'ruk1')
			break;
			case 'finance':
			$(this).attr('id', 'buh1')
			break;
			case 'medecine':
			$(this).attr('id', 'med1')
			break;
			case 'hr':
			$(this).attr('id', 'hr1')
			break;
			case 'sales_food':
			$(this).attr('id', 'torg1')
			break;
			case 'budget':
			$(this).attr('id', 'budg1')
			break;
			case 'info_docs': 
			$(this).attr('id', 'doc1')
			break;
			case 'cntd':
			$(this).attr('id', 'teh1')
			break;
		}
	});
	
	$('#ajaxSearch_submit').attr('value', '');
	
	if ($('body').hasClass('english')) { 
		$('#ajaxSearch_submit').css('background', 'url("/assets/templates/newcntd/images/en_find_small.png") no-repeat');
	} 
	
	$("input[type=file]").filestyle({ 
		 image: "/assets/templates/newcntd/images/obzor.gif",
		 imageheight : 24,
		 imagewidth : 58,
		 width : 100
 	});

	$('.subpages ul li').each(function() {
		$(this).bind('mouseover', function() {
			$(this).addClass('jshover');
		});
		$(this).bind('mouseout', function() {
			$(this).removeClass('jshover');
		});
	});
	
	$('.subpages2 ul li a').each(function() {
		$(this).bind('mouseover', function() {
			$(this).parent().addClass('jshover');
		});
		$(this).bind('mouseout', function() {
			$(this).parent().removeClass('jshover');
		});
	});

	$('#catList ul li').each(setTipByMouseover);
	$('ul.buttoned_ul li').each(setTip);
	
	$('.hided_lists li').each(function() {
		$(this).children('ul li ul').each(function() {
			$(this).hide();
	
			$(this).prev('span').bind('click', function() {
				$(this).next('ul').slideToggle('fast');
				$(this).next('ul').css('cursor', '');
			});
		});
		var elt = $(this).children('span');
		//link_imitate(elt, true);		
		isClickable($(elt));
	});
	
	$('.hided_lists_archive li').each(function() {
		$(this).children('span').css('border-bottom', '1px dashed #333');
		$(this).children('ul li ul').each(function() {
			$(this).hide();
	
			$(this).prev('span').bind('click', function() {
				$(this).next('ul').slideToggle('fast');
				$(this).next('ul').css('cursor', '');
			});
		});
		var elt = $(this).children('span');
		link_imitate($(elt), true);		
		//isClickable($(elt));
	});

	
	$('.main_menu ul li ul li a').each(function() {
			var elt = $(this).attr('href');
			if (elt == '/services.html') {
				$(this).parent().addClass('lineH');
				/*$(this).parent().next().addClass('lineH');*/
			}
		});



	
	$('.linkRe').each(function() {
		$('.review_block').css('display', 'none');
		$(this).bind('click', function() {
			$('.review_block').slideToggle('normal');
		});
	});


	
	$('.articles h3 span').each(function() {
		$(this).parent().next('div.layer').css('display', 'none');
		link_imitate($(this), true);
		$(this).bind('click', function() {
			$(this).parent().next('div.layer').slideToggle('normal');
		});
	});
	
	$("ul.only_for_main li span").each(function() {
		$(this).next('div.NewsFull').css('display', 'none');
		$(this).next('div.NewsFull').find('p').css('text-align', 'left');
		link_imitate_reverse($(this), true);
		$(this).bind("click", function() {
			$(this).next('div.NewsFull').slideToggle("fast");
		});
	});
		
	$('ul.centers li span').each(function() {
		link_imitate($(this), true);
		$(this).parent().bind("click", function() {
			$(this).children('p').slideToggle("fast");
		});
	});
	
	$("div.rounded_input div").each(function(i){
		var itsDiv = $(this).parent();
		$(this).children().focus(function() {
			if (!$(itsDiv).hasClass('active1')) {
				$(itsDiv).addClass('active1');
			}
			if ($(this).attr('value') !== '' && $(this).hasClass('completed')) {
				$(this).css('color', '#000');
			}
		});
		
		$(this).children().blur(function() {
			$(itsDiv).removeClass('active1');

			if ($(this).attr('value') !== '' && $(this).hasClass('completed')) {
				$(this).css('color', '#ccc');
				$(this).bind('change', function() {
					$(this).removeClass('completed');
				});
			}
		});
	});
	
	$("div.rounded_tarea textarea").each(function(i){
		var tarea = $(this).parent();
		$(this).focus(function() {
			if (!$(tarea).hasClass('active2')) {
				$(tarea).addClass('active2');
			}
		});
		$(this).blur(function() {
			$(tarea).removeClass('active2');
		});
	});
	
		var height_root = $('.wrapper').outerHeight();
		$('#fade').css('height', height_root);
		
		var width_root = $('.wrapper').outerWidth();
		$('#fade').css('width', width_root);
	
	scrollToPartners();
	if (jQuery.support.opacity) blik();

/*sub();*/
	
});

/*function sub() {
	var myUrl = document.location.href;
	if (myUrl == 'http://wnew.cntd.ru/form.html')  {
		$('.wrapper').css('min-width','1250px');
	}
}*/

function blik() {
	var elt = '.expertline';
	$(elt).each(function() {
		if (!$(this).parent().hasClass('wr')) {
			$(this).wrap('<div class="wr"></div>');
			$(this).parent().css('position', 'relative');
		}
		
		if (!$(this).next().hasClass('blik')) {
			$(this).parent().append('<img src="/assets/templates/newcntd/images/blik.png" class="blik">');
			$(this).next().css('left', '0');
		}
		
		var leftest = $(this).parent().css('width').replace('px', '') - $(this).next().css('width').replace('px', '');
		$(this).next().animate({
			left: leftest + 'px'
		}, 1500, 'linear', function() { $(this).remove() });

	});
	//setTimeout(blik, 5000);
}

function scrollToPartners() {
	if ($('#partner_table').offset() !== null) {
		var offsetPartners = $('#partner_table').offset().top.toFixed(0);
		$(document).scrollTop(offsetPartners);
	}
}



function showNewsList(elt, month, feed) {

	// Если класс элемента - открытый, удаляем список новостей и ставим класс закрытый
	if ($(elt).hasClass('opened')) {
		$('#nl_' + month).remove();
		$(elt).removeClass('opened').addClass('closed');
	} else {

		// Иначе ставим значок ожидания
		$(elt).after('<ul id="nl_' + month + '"><li><img src="/assets/templates/newcntd/images/spinner_little.gif" style="margin-left: 10px; position: absolute;" width="20" height="20" alt="" class="spinner"></li></ul>');
		
		// Отправляем AJAX-запрос на получение списка новостей
		$.getJSON( '/assets/templates/kodeks/ajax/news_archive.php', {command: 'get_titles', month: month, feed: feed}, _showNewsList);
	}
}

function _showNewsList(data) {
	
	// Если пришла неудача, пишем об ошибке
	if (data.failure) {
		$('#nl_' + data.data.month).html('<li>Нет новостей за данный период</li>');
	}
	
	// Если пришла удача, строим список новостей
	if (data.success) {

		var output = '';
		var len = data.data.data.length;
		for (var i = 0; i < len; i++) {
			output += '<li><a href="/news_view.html?id=' + data.data.data[i].id + '">' + data.data.data[i].date + ' - ' + data.data.data[i].title + '</a></li>';
		}
		
		$('#nl_' + data.data.month).html(output);
	}
	
	// Меняем класс на открытый
	$('#mc_' + data.data.month).removeClass('closed').addClass('opened');
	
}

function removeSpinner(elt) {
	$(elt).children('img.spinner').remove();
}

function anchorImitate() {
	$('.anchor_imitate').each(function() {
		$(this).bind('click', function() {
			var link = $(this).attr('href');
			link = link.replace('#', '');
			$('.thing').each(function() {
				$(this).css('display', 'none');
			});
			$('div#'+link).css('display', 'block');
			$('.subpages ul li').each(function() {
				$(this).removeClass('active');
			});
			$('.subpages ul li[name=' +link+ ']').addClass('active');
			
		});
	});
}

function autoComplete() {	
	var cnt = document.location.search;
	var reg = /region/gi;
	var city = /city/gi;
	
	if (cnt.match(reg)!== null) {
		var lastLayer = '#elt0';
		setCookie('lastLayer', lastLayer);
		document.location.hash = '#elt0';
	}
	
	if (cnt.match(city)!== null) {
		var lastLayer = '#elt0';
		setCookie('lastLayer', lastLayer);
		document.location.hash = '#elt0';
	}
	
	$('.newstyle form').each(function() {
		$(this).bind('submit', function(){
			var lastLayer = document.location.hash;
			setCookie('lastLayer', lastLayer);
		});
	});
	//alert(lastLayer);
}

function contents(givenClass)  {
	autoComplete();
	var elt = givenClass;
	
	$('.thing').each(function(i) {
		$(this).hide();
		var thingId = 'elt' + i;
		$(this).attr('id', thingId);
	});

	$(elt).each(function(i) {
		var eltName = 'elt' + i;
		$(this).attr('name', eltName);
	});

	var myHash = document.location.hash;
	
	
	if (givenClass === '.subpages') {
		var ifredirected = getCookie('lastLayer');
		//alert(ifredirected);
		if (ifredirected !== null) ifredirected = ifredirected.substring(3);
		if (ifredirected !== '' && ifredirected !== null && myHash === '') {
			myHash = '#' + ifredirected;
			//alert('we here');
		}
		setCookie('lastLayer', '');
		//ifredirected = '';
	}
	
	if (myHash !== '') {
		$('.thing').hide();
		$(myHash).css('display', 'block');
		var cnt = myHash.replace('#','');
		$(elt+'[name='+cnt+']').addClass('active');
		
	} else {
		var firstli = $(elt)[0];
		$(firstli).addClass('active');
		var firstThing = $('.thing')[0];
		$(firstThing).css('display', 'block');
		myHash = '#' + $(firstThing).attr('id');
	}

	$(elt).each(function(i) {
		$(this).find('span').css('border-bottom', '1px dashed #333');
		if ($(this).hasClass('active')) $(this).find('span').css('border-bottom', 'none');
		$(this).bind("click", function() {

			if (!$(this).hasClass('active')) {
				var anchorName = $(this).attr('name');
				document.location.hash = anchorName;
					
				$(elt).removeClass('active');
				$(elt).find('span').css('border-bottom', '1px dashed #333');
				
				$('.thing').hide();
				
				$(this).addClass('active');
				$(this).find('span').css('border', 'none');
				
				$('.thing[id=' + $(this).attr('name') + ']').toggle();
				
				if (!jQuery.support.cssFloat) { //проверка на браузер, можно выставить любое свойство
					$(document).scrollTop(0);
				}
			}

		});
			
		$(this).bind("mouseover",function() {
			if (!$(this).hasClass('active')) {
				$(this).css('cursor', 'pointer');
				$(this).find('span').css('border-bottom', 'none');
			}
		});
		
		$(this).bind("mouseout",function() {
			if (!$(this).hasClass('active')) {
				$(this).css('cursor', '');
				$(this).find('span').css('border-bottom', '1px dashed #333');
			}
		});  
	});
	
	
}


function ifResize() {
	
	function brLine() {
		var takeLi = $('.subpages ul li')[1];
		$(takeLi).after('<div style="clear: both;"></div>');
	}
	function unBrLine() {
		var takeLi = $('.subpages ul li')[1];
		$(takeLi).next('div').remove();
	}
//hiddenAlert($(window).width());
	if ($(window).width() < 1250) {
		unBrLine();
		brLine();
		$(window).resize(function() {
			unBrLine();
			if ($(window).width() < 1250) {
				brLine();
			}
		});
	} else {
		$(window).resize(function() {
			unBrLine();
			if ($(window).width() < 1250) {
				brLine();
			}
		});
	}
}



function hiddenAlert(elt) {
	$('#crumbles').append('<div style="color: #eaeaea; font-size: 10px;">'+ elt +'</div>');
}
	
function validateEmptyLinks() {
	if ($(this).attr('href') === '') {
		$(this).remove();
	}
}

	var setTip = function() {
		var tTip = {
			que: $(this).find('.get_tooltip'),
			ans: $(this).find('.tooltip'),
			scroll: $(this).find('.toscroll'),
			iks: $(this).find('.iks')
		}
		var que = tTip.que;
		var ans = tTip.ans;
		var scroll = tTip.scroll;
		var iks = tTip.iks;
		
		var hTip = '300px';
		var hScroll = '280px';
		
		que.bind('click', function() {
			ans.css('height', '0');
			scroll.css('height', hScroll);
			ans.css('width', '0');
			if (ans.css('display') === 'none') {
				ans.css('display', 'block');
				ans.animate({
					width: "500px",
					height: hTip
				}, 1000);
			} else {
				ans.hide();
			}
		});
		
		iks.bind('click', function() {
			if (ans.css('display') !== 'none') {
				ans.hide();
			}
		});
	}

var setTipByMouseover = function() {
	var tTip = {
		que: $(this).find('p'),
		ans: $(this).find('.tooltip')
	}
	var que = tTip.que;
	var ans = tTip.ans;
	//ans.parent().css('background', 'none');
	$(this).bind('mouseenter', function() {
		$(this).css('cursor', 'pointer');
		if (ans.css('display') === 'none') {
			$('.tooltip').css('display', 'none');
			$('.products_add_menu').css('background', 'none');
			ans.css('display', 'block');
			ans.parent().css('background', 'url(/assets/templates/newcntd/images/grad1.gif) top repeat-x');

		} else {
			$('.tooltip').hide();
			ans.parent().css('background', 'none');
		}
	});
	$(this).bind('mouseleave', function() {
		$('.tooltip').hide();
		ans.parent().css('background', 'none');
	});
}

function highLight(elt) {
	$(elt).each(function() {
		$(this).bind('mouseover', function() {
			$(this).css('opacity', '0.8');
		});
		$(this).bind('mouseout', function() {
			$(this).css('opacity', '1');
		});
	});
}

function link_imitate(elt, border) {
	$(elt).bind("mouseover", function(){
		$(elt).css('cursor', 'pointer');
		$(elt).css('border', 'none');
	});
	$(elt).bind("mouseout", function(){
		$(elt).css('cursor', '');
		if (border) {
			$(elt).css('border-bottom', '1px dashed #333');
		}
	});
}

function link_imitate_reverse(elt, border) {
	$(elt).bind("mouseover", function(){
		$(elt).css('cursor', 'pointer');
		$(elt).css('border-bottom', '1px dashed #333');
	});
	$(elt).bind("mouseout", function(){
		$(elt).css('cursor', '');
		if (border) {
			$(elt).css('border', 'none');
		}
	});
}


function setLoop() {
	var linkHref = $(this).parent().attr('href');
	var imgSrc = $(this).attr('src');
	if (linkHref!==imgSrc && linkHref.length !== 0) {
		$(this).parent().css('text-decoration', 'none');
		if ($('body').hasClass('english')) {
			$(this).parent().append('<span class="loop">Zoom image</span>');
		} else {
			$(this).parent().append('<span class="loop">Увеличить изображение</span>');
		}
		
	} else {
		$(this).parent().parent().html($(this).parent().html());
	}

}

function hotNews() {
	var current = $('.hotNews ul li')[0];
	$(current).css('float', 'left');	
	$(current).css('display', 'block');
	var j = $('.hotNews ul li').length - 1;
	
	var next;
	var prev;
	
	function delayNextIn() {
		$(next).fadeIn('fast');
		$(next).css('display', 'block');
	}	
	
	function delayCurOut() {
		$(current).fadeOut('fast');
	}

	function delayPrevIn() {
		$(prev).fadeIn('fast');
		$(prev).css('display', 'block');
	}
	
	function getNext() {
		if ($(current).next().html() == null ) {
			next = $('.hotNews ul li')[0];
		} else {
			next = $(current).next();
		}
	}
	
	function getPrev() {
		if ($(current).prev().html() == null ) {
			prev = $('.hotNews ul li')[j];
		} else {
			prev = $(current).prev();
		}
	}
	var stop = 0;
	var i = 0;
	function f() {
		if (stop === 0) {
			current = $('.hotNews ul li')[i];
			
			if (i===j) {
				next = $('.hotNews ul li')[0]
			} else {
				next = $('.hotNews ul li')[i+1];
			}
			
			$(next).css('float', 'left');
			
			delayCurOut();
			setTimeout(delayNextIn, 200);
	
			setTimeout(f, 5000); 
			
			if (i < j) i++;
			else i = 0;
			
		}
	}
	
	f();

	$('.link_Prev').bind('click', function(){
		stop = 1;
		$('.hotNews ul li').each(function() {
			if($(this).css('display') === 'block') {
				current = $(this);
				getPrev();
			}
		});

		$(current).fadeOut('fast');
		setTimeout(delayPrevIn, 200);
	});
	
	$('.link_Next').bind('click', function(){
		stop = 1;
		$('.hotNews ul li').each(function() {
			if($(this).css('display') === 'block') {
				current = $(this);
				getNext();
			}
		});
		
		$(current).fadeOut('fast');
		setTimeout(delayNextIn, 200);
	});
}

function validateSearch() {

	


	if ($('body').hasClass('english')) {
		var title = 'Search';
		$('#ajaxSearch_input').attr('value', 'Search');	
	} else {
		var title = 'Поиск';
		$('#ajaxSearch_input').attr('value', 'Поиск');
	}
	
	$('#hint span').bind('click', function() {
			var title = $(this).text();
			$('#ajaxSearch_input').attr('value', title);
			$('#ajaxSearch_input').attr('title', title);
			$('#ajaxSearch_input').css('color', '#c0c0c0');
			$('#ajaxSearch_input').css('font-style', 'normal');
	});
	
	
	$('#ajaxSearch_input').attr('title', title);
		
	
	function errorMsg(elt, msg) {
		if ($(elt).parent().parent().children('.searchError')[0] == undefined) {
			var divMsg = '<div class="searchError" style="display: none; cursor: pointer;">' + msg + '</div>';
			$(elt).parent().parent().append(divMsg);
			$('div.searchError').each(function() {
				$(this).slideDown('fast');
				$(this).bind('click', function() {
					$(this).slideUp('fast');
					$(this).remove();
				});
			});
		}
	}
	$('#ajaxSearch_submit').bind('click', function() {
		if ($('#ajaxSearch_input').attr('value')=== title) {
			if ($('body').hasClass('english')) {
				errorMsg($(this), 'Enter, please, search query');
			} else {
				errorMsg($(this), 'Введите, пожалуйста, запрос');
			}
			
			return false;
		} 
		if ($('#ajaxSearch_input').attr('value').length < 3) {
			if ($('body').hasClass('english')) {
				errorMsg($(this), 'Query should contain three symbols or more');
			} else {
				errorMsg($(this), 'Запрос должен содержать не менее трех символов');
			}
			
			return false;
		}
	});
	
	if ($('#ajaxSearch_input').attr('value') !== title && $('#ajaxSearch_input').attr('value') !== '') {
		$('#ajaxSearch_input').css('color', '#c0c0c0');
		$('#ajaxSearch_input').css('font-style', 'normal');
	}
	
	if ($('#ajaxSearch_input').attr('value') === '') {
		$('#ajaxSearch_input').attr('value', title);
	}
	
	$('#ajaxSearch_input').bind('focus', function() {
		$('#ajaxSearch_input').css('color', '#c0c0c0');
		$('#ajaxSearch_input').css('font-style', 'normal');
		$('#ajaxSearch_input').attr('title', '');
		if ($('#ajaxSearch_input').attr('value') === title) {
			$('#ajaxSearch_input').attr('value', '');
		}
 		$('.searchError').each(function() {
			$(this).remove();
		});
	});
	$('#ajaxSearch_input').bind('blur', function() {
		if ($('#ajaxSearch_input').attr('value') === '') {
			$('#ajaxSearch_input').attr('value', title); 
			$('#ajaxSearch_input').css('color', '#c0c0c0');
			$('#ajaxSearch_input').css('font-style', 'italic');
		}
	});
}


function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
       ((expires) ? "; expires=" + expires : "") +
       ((path) ? "; path=" + path : "") +
       ((domain) ? "; domain=" + domain : "") +
       ((secure) ? "; secure" : "");
}

function getCookie (name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = cookie.substring(offset, end);
		}
	}
	return(setStr);
}

/*function validateOverlayForms() {
	$('.overlay_form').find('form').each(function() {
		$(this).bind('submit', function() {
			var form = $(this);
			var result = true;
			$(form).find('td.required').each(function() {
				var inp = $(this).next().find('input');
				var warn = '<div class="errors_js">Заполните, пожалуйста, обязательные поля</div>';
				if ($(inp).attr('value') === '' ) {
					if ($(form).find('.errors_js').html() === null) {
						$(form).prepend(warn);
					}
					result = false;
				} 
			});
			return result;
		});
	});
}*/

function isClickable(elt) {
	if ($(elt).next('ul').length > 0 && 
		$(elt).next('ul').css('display') === 'none') 
	{
		$(elt).css('color', '#333');
		$(elt).css('border-bottom', '1px dashed #333');
		link_imitate($(elt), true);
	} else {
		$(elt).css('color', 'black');
	}
}
