var id = null;
var settings = null;

$.fn.catfish = function(options) {
	this.settings = {
		animation: 'slide',
		height: '100',
		bottom: '2'
	}
	if(options)
		$.extend(this.settings, options);
	
	if ( this.settings.animation != 'slide' && this.settings.animation != 'none' && this.settings.animation != 'fade' ) {
		alert('animation can only be set to \'slide\', \'none\' or \'fade\'');
	}
	
	id = $(this).attr('id');
	settings = this.settings;
	var adv = true;
	if ($.cookie('catfish') == null || $.cookie('catfish') == 'big') {
		height = this.settings.height;
	} else {
		height = this.settings.bottom;
		adv = false;
	}
	$(this).css('position', 'fixed').css('bottom', '0').css('left', '0').css('padding', '0').css('height', height + 'px').css('margin', '0').css('width', '100%').css('display', 'none');
	$('html').css('padding', '0 0 ' + this.settings.bottom + 'px 0');
	if ( jQuery.browser.msie ) {
		$('html').css('height', '100%').css('overflow', 'hidden').css('width', 'auto');
		$(this).css('position', 'absolute').css('z-index', '100');
		$('#wrapper').css('width', '100%').css('padding', '0').css('margin', '0').css('height', '100%').css('overflow', 'auto').css('position', 'relative');
	}
	if ( this.settings.animation == 'slide' ) {
		$(this).slideDown('slow');
	}
	else if ( this.settings.animation == 'fade' ) {
		$(this).fadeIn('slow');
	}
	if (!adv) {
		$('#open_adv').slideDown('fast');
	}
	$('#close_adv').click(function () {
		$('#' + id).animate({height:'2px'}, 700, function() {$('#open_adv').slideDown('fast');});
		$.cookie('catfish', 'small', { expires: 30, path: '/' });
		return false;
	});
	$('#open_adv').click(function () {
		$(this).hide();
		$('#' + id).animate({height:'100px'}, 700);
		$.cookie('catfish', 'big', { expires: 30, path: '/' });
	});
	return this;
};
