$(document).ready(function() {

// img alt fix
	$('img').each(function(){
	if (!$(this).attr('alt')) { $(this).attr('alt',""); }
});

// skipnav
/* 	$('a').click(function(){
		if (($(this).attr('href').substr(0,4) != "http") && ($(window).scrollTop() > ($('#menu').position().top) - 100) && ($(this).parent().parent().attr('id') != 'bar')) {
			var href = $(this).attr('href') + '#skipnav';
			$(this).attr('href',href);
		}
	}); */
// png fix
	if ($.browser.msie) {
		$(this).find("img[src$='.png']").css('behavior','url(img/iepngfix.htc)');
	}
	$('.def').click(function(){
		if ($(this).attr('value') == 'Поиск по сайту') {
			$(this).attr('value','')
		}
	});
	$('.def').blur(function(){
		if ($(this).attr('value') == '') {
			$(this).attr('value','Поиск по сайту');	
		}
	});	
	
	
	$('div.select').each(function(){
		$(this).width($(this).find('span.select').width() + 26);
		$(this).find('ul.select').width($(this).find('span.select').width() + 26);
	});
	$('a.select').click(function(){
		if ($(this).parent().attr('open') != '1') {
			$(this).parent().css('z-index','200').attr('open','1').find('ul.select').css('visibility','visible');
		} else {
			$(this).parent().css('z-index','100').attr('open','0').find('ul.select').css('visibility','hidden');
		}
		return false;
	});
	
	$('ul.select li').click(function(){
		$(this).offsetParent().parent().find('input[type="hidden"]').val($(this).text());
		$(this).offsetParent().parent().find('span.select').text($(this).text());
		$(this).parentsUntil('div.select').parent().css('z-index','100').attr('open','0').find('ul.select').css('visibility','hidden');
		return false;
	});
	$('div.select').hover(function(){
		
	},function(){
		$(this).css('z-index','100').attr('open','0').find('ul.select').css('visibility','hidden');
	});
	$('#menu td').hover(function(){
		$(this).find('ul').show();
	}, function(){
		$(this).find('ul').hide();
	});
	$('ul.drop').each(function(){
		$(this).find('li:last-child').css('background','none');
	});
});
