// JavaScript Document

$(function(){
$('#searchcat').click(function(){
		$('#searchdropdown').toggle('slow'); 
		});

$('.dmclosehbtn').click(function(){$('#searchdropdown').hide('slow'); });
//$('#loginbtn').click(function(){alert('This section of the website is currently under development. Please visit again soon.');});
$('#mobver-tab').click(function(){alert('Раздел в стадии разработки.');});
});




$(document).ready(function(){
	$('#rightmenu .rightmenuheading-inactive').click(function() {
		$(this).next('.rightmenubody').toggle('slow');
		return false;
	});
	
	$('#mainmenu .mainmenuhead').click(function() {
		$(this).next('.mainmenusub').toggle('slow');
		return false;
	}).next('.mainmenusub').hide();
	
	$('#mainmenu .mainmenuhead').toggle(function(){
		$(this).css({'background':'#EB008B url(images/fold.png) no-repeat right'});
		}, function () {
		$(this).css({'background':'#EB008B url(images/expand.png) no-repeat right'});
	});
});



 
    $(document).ready(function(){ 
        $("ul.sf-menu").superfish(); 
    }); 
	
	

$(document).ready(function(){

$('#commentbtn').click(function(){

$('#loading').ajaxStart(function(){
   $(this).show();
});
$('#loading').ajaxStop(function(){
   $(this).hide();
}); 
  $.ajax({
    url: 'comment/add',
    type: 'POST',
    dataType: 'json',
    timeout: 10000,
    data: $('#commentform').serialize(),
    error: function(){
        $('#comment_form').html('Please try again later. Sorry for inconvenience.');
    },
    success: function(msg){
    if(msg.reply=='ok'){
        $('#close_comment_box').after('<div id="comment_result"><br/><center>Спасибо за Ваш коментарий. Коментарий опубликуется на сайте только после проверки администраторами. Вы можете открыть окно.</center><br/> Имя: '+msg.name+' <br/> Почта: '+msg.email+' <br/> Коментарий: '+msg.comment+' <br/> IP: '+msg.ip+'</div>');
        $('#add_comment_lnk').after('<span id=\'add_comment_tnk\'>СПасибо за коментарий</span>').remove();
        $('#comment_form').remove(); 
        }else{
		$('#comment_error').show();
		}
    }
});	   
								});
					});

$(document).ready(function(){
	
	var first = 0;
	var speed = 700;
	var pause = 3500;
	
		function removeFirst(){
			first = $('ul#listticker li:first').html();
			$('ul#listticker li:first')
			.animate({opacity: 0}, speed)
			.slideUp(1000, function() {$(this).remove();});
			addLast(first);
		}
		
		function addLast(first){
			last = '<li style="display:none">'+first+'</li>';
			$('ul#listticker').append(last)
			$('ul#listticker li:last')
			.animate({opacity: 1}, speed)
			.fadeIn('slow')
		}
	
	interval = setInterval(removeFirst, pause);
});
$(document).ready(function(){
						   $('#filtertitle').toggle(function(){$('#filter').show(500);$('#filterclosebox').css('background','url(./images/filter-open.png) no-repeat');},function(){$('#filter').hide(500);$('#filterclosebox').css('background','url(./images/filter-close.png) no-repeat');});
						   
						   });

$(document).ready(function(){
						   $("ul").each(
  							function() {
    						var elem = $(this);
   							 if (elem.children().length == 0) {
								 elem.prev(".sf-sub-indicator").remove();
      							elem.remove();
    						}
  							}
							);


						   });


$(document).ready(function(){
						   
						   $("ul").each(
  function() {
    var elem = $(this);
    if (elem.children().length == 0) {
      elem.remove();
    }
  }
);
						   $('.sf-menu ul>li').show();
						   });


