/*
 * ufa_jquery Catfish Plugin - Version 1.3
 *
 * Copyright (c) 2007 Matt Oakes (http://www.gizone.co.uk)
 * Licensed under the MIT (LICENSE.txt)
 */

ufa_jquery.fn.catfish = function(options) {
	this.settings = {
		closeLink: 'none',
		animation: 'slide',
		height: '50'
	}
	if(options)
		ufa_jquery.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\'');
	}
	
	var id = this.attr('id');
	settings = this.settings;
	ufa_jquery(this).css('padding', '0').css('height', this.settings.height + 'px').css('margin', '0').css('width', '100%');
	ufa_jquery('html').css('padding', '0 0 ' + ( this.settings.height * 1 + 50 ) + 'px 0');
	if ( typeof document.body.style.maxHeight != "undefined" ) {
		ufa_jquery(this).css('position', 'fixed').css('bottom', '0').css('left', '0');
	}
	
	if ( this.settings.animation == 'slide' ) {
		ufa_jquery(this).slideDown('slow');
	}
	else if ( this.settings.animation == 'fade' ) {
		ufa_jquery(this).fadeIn('slow');
	}
	else {
		ufa_jquery(this).show();
	}
	if ( this.settings.closeLink != 'none' ) {
		ufa_jquery(this.settings.closeLink).click(function(){
			ufa_jquery.closeCatfish(id);
			return false;
		});
	}
	
	// Return ufa_jquery to complete the chain
	return this;
};
ufa_jquery.closeCatfish = function(id) {
	this.catfish = ufa_jquery('#' + id);
	ufa_jquery(this.catfish).hide();
	ufa_jquery('html').css('padding', '0');
	ufa_jquery('body').css('overflow', 'visible'); // Change IE6 hack back
};