$(function(){
	$('input[placeholder]').placeholder();
	$(".list").link();
})

$.fn.link = function() {
	$('tbody tr', this).each(function(){
		var id = $('td:first a', this).attr('href');
		if(id && id != '')
		{
			$(this)
				.mouseover(function(){
					$(this).css('cursor', 'pointer');
					window.status = id;
				})
				.click(function(){
					window.location = id;
				})
				.mouseout(function(){
					window.status = '';
				})
		}
	})
}

$.fn.placeholder = function(){

	// quit if there's support for html5 placeholder
	if (this[0] && 'placeholder' in document.createElement('input')) return; 

	if ($(this).val() === '' || $(this).val() === $(this).attr('placeholder')){
		$(this).val( $(this).attr('placeholder') ).css({color:'#808080'});
	}

	return this
		.live('focusin',function(){

			if ($(this).val() === $(this).attr('placeholder')) {
				$(this).val('').css({color:'#000'});
			}

		}).live('focusout',function(){

			if ($(this).val() === ''){
				$(this).val( $(this).attr('placeholder') ).css({color:'#808080'});
			}
		});
}
