function updateSize(which) {
	var val = $('#'+which).val();
	
	if(val != '') {
		if(val.match(/^[0-9]+%?$/)) {
			if(which=='box_width') var newCode = $('#box_code').val().replace(/width="[^"]+/, 'width="' + (val || 100));
			if(which=='box_height') var newCode = $('#box_code').val().replace(/height="[^"]+/, 'height="' + (val || 100));
			$('#box_code').val(newCode);
			if(which=='box_width') $('#width_info').removeClass('red');
			if(which=='box_height') $('#height_info').removeClass('red');
		} else {
			if(which=='box_width') $('#width_info').addClass('red');
			if(which=='box_height') $('#height_info').addClass('red');
		}
	}  
}

function toggleBox(box_id) {
	($('#'+box_id).css('display')=='block') ? $('#'+box_id).slideUp('fast') : $('#'+box_id).slideDown('slow');
} 

$(function() {
	$('.formBox .inputB input, .formBox .inputB textarea')
		.focus(function(){$(this).parent().addClass('focus');})
		.blur(function(){$(this).parent().removeClass('focus');});
	$('.formBox .inputB')
		.mouseenter(function(){
			box = $(this).children('input, textarea').attr('id');
			$('#'+box+'_hint').addClass('hover');
		})
		.mouseleave(function(){
			box = $(this).children('input, textarea').attr('id');
			$('#'+box+'_hint').removeClass('hover');
		});
	$('.hint_error').hide();
	$('#'+activeLink).addClass('selected');
	$('#checkoutform li input:checked').live('change', function(){
		$('#checkoutform label').css('font-weight','normal');
		$(this).next('label').css('font-weight','bold');
	});
});

