$(document).ready(function() {
        $('#pricetable tbody.prices td').hover(function() {
            var nPreviousSiblings = 2 + $(this).prevAll('td').size();
            $(this).addClass('hover');
            $(this).parent().find('th').addClass('hover');
            $("#pricetable th:nth-child("+nPreviousSiblings+")").addClass('hover');
            var unitVal = $('input[name=units]').val();
            var price = parseFloat($(this).find('a strong').text().substr(1).replace(",",""));
	    var qty = parseInt($('#pricetable th:nth-child('+nPreviousSiblings+')').text().replace(",","")) / parseInt(unitVal);
            var results = formatNumber( price * qty, ",0.00" );
	    $('#product_total').text( results );

	    var setup_charge = $(this).parent().attr('setup_charge');
	    if(!isNaN(price) && setup_charge != '0.00') {
		    $('#setup-charge').text('$'+setup_charge);
	    } else {
		    $('#setup-charge').text('');
	    }

        }, function ( ) {
            $('th.hover, td.hover').removeClass('hover');
            $('#product_total').text( "0.00" );
        });
});
