$(document).ready(function(){
	
	
	
	$('#cena_min').click( function() {
		 $(this).val('');
	});
	
	$('#nav ul li').hover(function() {
		$(this).find('ul').show();
		$(this).find('a:first').addClass('over'); 
	},function() { 
		$(this).find('ul').hide();
		$(this).find('a:first').removeClass('over');
	});
	
	$('#nav ul:first li a:last').attr('href', 'http://www.rusforum.bg/');
	
	
	$('#right_side ul li a').click( function(){
		var $ul = $(this).parent().find('ul:first');
		
		if ( $ul.is(':hidden') ) {
			$ul.show();
			//$ul.find('a').click( function() { return true });
		} else {
			$ul.hide();
		};
		
		return false;
	});
	
	$('#right_side ul li ul li a').click( function(){
		if ( $(this).parent().find('ul').length == 0 ) {
			var id = $(this).attr('href');
			window.location = $('base').attr('href') + id;
		}
	});
        
        var currentURL = window.location.href;
        var base = $('base').attr('href');
        
        $('#right_side ul li ul li a').each( function()  {
            //console.log( base + $(this).attr('href') );
            
            if ( ( base + $(this).attr('href') ) == currentURL ) {
                $(this).parents('ul').show().parents('ul').show().parents('ul').show();
                //alert('dsadsa');
            }
        });
        

});
