$(function (){
	$('.lang-switch').each(function (i,j){
		var he = '<a href="#" rel="lv" style="font-weight:bold;">LV</a>';
		
		if($(this).parent().find('.en').length > 0) {
			he += ' | <a href="#" rel="en">EN</a>';
		}
		if($(this).parent().find('.ru').length > 0) {
			he += ' | <a href="#" rel="ru">RU</a>';
		}
		
		$(this).html(he).find('a').click(function (){
			$(this).parent().find('a').css('font-weight', 'normal');
			$(this).css('font-weight', 'bold');
			var rel = $(this).attr('rel');
			$(this).parent().parent().find('.en,.ru,.lv').hide();
			$(this).parent().parent().find('.'+rel).show()
			return false;
		});
	});
});