$().ready(function() {
	$('TABLE.chart TR:even').addClass("alt");
	$('TABLE.chart TR').mouseover(function () {
		$(this).addClass("over");
	});
	$('TABLE.chart TR').mouseout(function () {
		$(this).removeClass("over");
	});
	$('TABLE.chart TR').each(function(){
        $(this).children(":first").css('text-align','left');
        $(this).children(":last").css('text-align','right');
	});
	
	$('a[href="/sizing_chart.php"]').click(function (e) {
		o_top  = $('#main').offset().top;
		o_left = $('#main').offset().left;
	
		if($(window).height() > $('html').height()) {
			m_height = $(window).height();
		} else {
			m_height = $('html').height();
		}
		
		if($(window).width() > $('body').width()) {
			m_width = $(window).width();
		} else {
			m_width = $('body').width();
		}
		
		$('#hide_back').height(m_height);
		$('#hide_back').width(m_width);
		
		o_top = '-' + o_top + 'px';
		o_left = '-' + o_left + 'px';
		
		$('#hide_back').css({top: o_top,left: o_left});
		
		$('#hide_back').css('display','block');		
		$('#chart').show('slow');						
		$('#hide_back').fadeTo(0,0.33);
		e.preventDefault();		
	});
	
	$('#chart #close').click(function (e) {
		e.preventDefault();
		$('#chart').hide('slow');
		$('#hide_back').fadeTo(1000,0).hide();
	});
});
