// JavaScript Document

$( function() {
	
	$('#menu li a, footer nav li a')
	.each( function() {
		$(this).append('<em></em>')	;
	})
	.hover( 
		function() {
			if ( !$(this).closest('li').hasClass('current') ) {
				$('em',this).fadeIn(100);
			}
		}, 
		function() {
			if ( !$(this).closest('li').hasClass('current') ) {
				$('em',this).stop(1,1).fadeOut(200)	;
			}
		}
	)

	$('table').each( function() {
		$('tr:even',this).addClass('alt');
	});
	
	$('.comment:odd').addClass('alt');

	$('table.sexy').wrap('<div class="sexyBorder">');
	
	$('hr').replaceWith('<div class="hr"></div>');
	
    $('.kwicks').kwicks({  
        max : 440,  
        spacing : 0,
		defaultKwick: 0,
		sticky: true
    });  
	
	$('#goTop').click( function() {
		$(document).scrollTo(0,500);
		return false;	
	})
	
	$('input.clr, textarea.clr').each( function() {
		var def = $(this).val();			
		$(this).focus( function() {
			if ( $(this).val()==def ) {
				$(this).attr('value','');
			}
		});
		$(this).blur( function() {
			if ( $(this).val()=='' ){
				$(this).attr('value',def);
			}
		})
	})
	
})
