var fuckIE = function(){
	return;
	if($.browser.msie && $.browser.version < 8){
		$('table .number, table.products th').each(function(){
			$(this).html('<div style="white-space: nowrap;">'+$(this).html()+'</div>');
		});
	}
}

$(document).ready(function(){
	
	fuckIE();
	$('table.products tr.product').bind('mouseenter mouseleave', function(e){
		$(this).toggleClass('hover');
	});
	$('table.products tr.product').bind('click', function(e){
		window.location = $('a', this).attr('href');
	});
	$('a[rel="external"]').attr('target', '_blank').removeAttr('rel');
});

$(function(){
	$('span#sg-abv').each(function(){
		$(this).replaceWith(
			'<div id="sg-abv">'+
				'<h4>Calculate SG and Alcohol</h4>'+
				'<table>'+
					'<tr><th>Original Gravity</td><td><input type="text" id="og"/></td></tr>'+
					'<tr><th>Final Gravity</td><td><input type="text" id="fg"/></td></tr>'+
					'<tr><th>Actual Final Gravity</td><td id="afg"></td></tr>'+
					'<tr><th>Alcohol By Volume</td><td id="abv"></td></tr>'+
					'<tr><th>Alcohol By Weight</td><td id="abw"></td></tr>'+
				'</table>'+
			'</div>'
		)
		$('#sg-abv input').keyup(function(){
			og = $('#og').val();
			fg = $('#fg').val();
			ob = 261.3*(1-(1/og));
			fb = 261.3*(1-(1/fg));			
			afg = 1.001843 - (0.002318474*ob) - (0.000007775*ob*ob) - (0.000000034*ob*ob*ob) + (0.00574*fb) + (0.00003344*fb*fb) + (0.000000086*fb*fb*fb);
			if(isNaN(afg)) $('#afg').text();
			else $('#afg').text(afg.toFixed(4));
			v = (og-afg)*131;
			if(isNaN(v)) $('#abv').text();
			else $('#abv').text(v.toFixed(4)+'%');
			v = 76.08*(og-afg)/(1.775-og)
			if(isNaN(v)) $('#abw').text();
			else $('#abw').text(v.toFixed(4)+'%');			
		});
	});
});

$(function(){
$('#frm-payment').submit(function(){
$(this).find('.buttons').hide().end()
.find('input.text, select').attr('readonly', 'readonly').end()
.append('<p><strong>Please wait...</strong></p>');

});
});

