$(document).ready(function() {
    if ($.browser.msie) {
        $('#footer').css({'top': '110px'});
    }
    memberHover();

    $('a.follow').hover(
        function() { $('div.unfollow-callout', $(this).parent()).fadeIn('fast'); },
        function() { $('div.unfollow-callout', $(this).parent()).fadeOut('fast'); }
    );      
    $('a.tooltipbtn').hover(
        function() { $('div.callout', $(this).parent()).fadeIn('fast'); },
        function() { $('div.callout', $(this).parent()).fadeOut('fast'); }
    );  
    
    $('#search').keydown(function(e) {
        switch (e.keyCode) {
            case 13:
                search($('#search').val());
                break;
        }
    });

    $(".datepicker").datepicker({dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: '0d'});
	$(".autocomplete").autocomplete('/add/taglist', {
	    width: 222,
	    margin: 2,
		mustMatch: false,
		autoFill: true,
		cacheLength: 1,
		max: 100,
		matchContains: true,
		multipleSeparator: ';',
        parse: function(data) {
			return $.map(eval(data), function(row) {
				return {
					data: row,
					value: row.tag,
					result: row.tag
				}
			});
		},		
		formatItem: function(item) {
		    return item.tag + ' | ' + item.count;
		}
	});
    
    TwitterTop.updateStatusText(0);
    
    $('input.tag').keyup(function(e) {
        TwitterTop.updateStatusText(e.keyCode);
    });        
    
    statusUpdate = (typeof(window['statusUpdate']) == "undefined")? false : true;
    setCharCount('#status_text');
    bindCounter('#content #status_text');
});