
// Function for displaying hint text in text inputs
// http://web.covertprestige.info/test/45-champ-formulaire-texte-au-focus.html

function textInputDynamicValue (input_selector, text_to_use, def_class) {
	if (text_to_use == undefined) text_to_use = 'title';
	if (def_class == undefined) def_class = 'hint';
	$(input_selector).each(function() {
		var dynamic_value
		switch (text_to_use) {
			case 'title' :
				dynamic_value = $(this).attr('title');
				break;
			case 'value' :
				dynamic_value = $(this).attr('value');
				break;
			default :
				dynamic_value = text_to_use;
		}
		$(this).attr('value', dynamic_value).addClass(def_class)
		.focus(function() {
			if (this.value == dynamic_value) {
				this.value = '';
				$(this).removeClass(def_class);
			}
		})
		.blur(function() {
			if (this.value == '') {
				this.value = dynamic_value;
				$(this).addClass(def_class);
			};
		});
	});
};

$(document).ready(function(){
	textInputDynamicValue('input.use-hint');
});


// Function for hiding and then displaying the login form

$(document).ready(function(){
	$('#login').hide();
	$('#user .main strong.button').replaceWith('<a class="button" href="#login">Log in</a>')
	$('#user .main a.button').click(function(){
		$('#login').show();
		$("#post").hide();
		$("#username").focus();
//		$(this).replaceWith('<strong class="button">Log in</strong>')
		return false;
	});
});


// Hover effets for IE6

$(document).ready(function(){
	$('#activity .tweet').hover(function(){
		$(this).addClass('tweet-hover');
	},
	function(){
		$(this).removeClass('tweet-hover');
	});
});
