//jQuery.noConflict();

jQuery(document).ready(function() {

jQuery('.lightbox').lightbox({fitToScreen: true});


jQuery('.one-navig-box').hover(function () {
jQuery(this).addClass('a-hover');
}, function () {
jQuery(this).removeClass('a-hover');
});

jQuery('.producers-wrap').hover(function () {
jQuery(this).addClass('a-hover');
}, function () {
jQuery(this).removeClass('a-hover');
});

	$(':button').click(function() {
		if($(this).next().length>0) {
			input=$(this).next();
			if($(this).attr('id')=='') {
				switch(input.attr('name')) {
					case 'supp-edit':
					case 'supp-add':
						window.location.href=input.attr('value');
						break;
					case 'mngr':
						if(input.attr('value').indexOf('remove')>0) {
							if(confirm('Уверены?')) {
								window.location.href=input.attr('value');
								return ;
							} else {
								return false;
							}
						} else {
							window.location.href=input.attr('value');
						}
					default:
					window.location.href='/manager/'+input.attr('name')+'/'+input.attr('value')+'/';
				}
			} else {
				if($(this).attr('id')=='go-history-back') {
					window.history.back();
				}
			}
		} else {
			return ;
		}
	});
	
	$('.remove-comment').click(function() {
		if(confirm('Уверены?')) {
			window.location.href=$(this).attr('href');
			return ;
		} else {
			return false;
		}
	});
	
	$('#show-hidden-comments').click(function() {
		$('#comments-hidden-block').slideToggle(500);
		$(this).hide();
		return false;
	});
	$('#hide-hidden-comments').click(function() {
		$('#comments-hidden-block').slideToggle(500);
		$('#show-hidden-comments').show();
		return false;
	});
	
	$('.slide-toggle-a').click(function(e) {
		e.preventDefault();
		$(this).parent().parent().next().slideToggle();
		if($(this).hasClass('down')) {
			$(this).removeClass('down');
		} else {
			$(this).addClass('down');
		}
	});
	
	$('#about-producer-a').click(function(e) {
		e.preventDefault();
		var link = $(this);
		$('#about-producer-block').slideToggle(function () {
			link.text((link.text() == 'Подробнее о компании' ? 'Скрыть' : 'Подробнее о компании'));
		});
	});
});

