/*
 * jQuery plugins
 *
 * Author: Kamil Kuczmera
 * E-mail: kamil@kuczmera.com
 */
 
/* Clearing input ---------------------------- */
jQuery.fn.clear_input = function() {
	return this.each(function() {
		var value = $(this).attr('value');
		
		$(this).focus(function() {
		 	if ($(this).attr('value') == value)
				$(this).attr('value', '');
		});
		
		$(this).blur(function() {			
		 	if ($(this).attr('value') == '')
				$(this).attr('value', value);
		});
	});
};

/* Scroll to top ---------------------------- */
jQuery.fn.scroll_to_top = function(options) {
	var defaults = {
		time: 1000
	};
	
	var options = $.extend(defaults, options);
	
	return this.each(function() {
		$(this).click(function() {
			if ($.browser.safari) 
				$('body').animate({scrollTop: 0}, options.time);
			else 
				$('html').animate({scrollTop: 0}, options.time);
			
			return false;
		});
	});
};
