$(document).ready(function() {
	
    $("#tag_links").append("<p id='reveal_tags'><a href='#all'>Все теги</a></p>");

	var $optionCookie = $.cookie('show_options');
    var $search_options = $('#search_options');
	var $search_bottom = $('#search_box_bottom');
	var $option_btn = $('#options');
	var $all_tags = $("#all_tag_links");
	
	$("#reveal_tags").click(function(){
		if($all_tags.hasClass("open")){
			$all_tags.css('height', '0');
			$all_tags.css('visibility', 'hidden');
			$all_tags.removeClass("open");
		} else {
			$all_tags.css('height', '100%');
			$all_tags.css('visibility', 'visible');
			$all_tags.addClass("open");
		}
		return false;
	});

	/*$('.result_title').dropShadow({left: 0, top: 1, blur: 0, opacity: 0.3, color: "#C3D9E6", swap: true});*/
	
    if($optionCookie == 'true'){
    	$option_btn.addClass("col");
    	$search_options.show();
    	$search_options.css({height:40});
    	$search_bottom.css({top:106});
    } else {
    	 $option_btn.addClass("exp");
    };
	
	$("#options").click(function(){
		if($search_options.is(':visible')){
		$option_btn.removeClass("col");
		$option_btn.addClass("exp");
		$.cookie('show_options', null);
	    $search_options.animate({ height: 0 }, { duration: 300, complete: function () {
	        $search_options.hide();
	    }
	    });
	    $search_bottom.animate({ top :66 }, {duration:300});
	    return false;		
	    } else {
		$option_btn.removeClass("exp");
		$option_btn.addClass("col");
		$.cookie('show_options', 'true', { expires: 365 }); 
	    $search_options.show().animate({ height : 40 }, { duration: 300 });
	    $search_bottom.animate({ top :106 }, {duration:300});
	    return false;
		}
    });
    return false;
    
});