// JavaScript Document
var currentClient = null;
function showDetails(elm){
	elm.addClassName('currentClient');
	var id = elm.getAttribute('id');
	id = id.replace("client","");
	new Ajax.Updater(
		'col3','/bdjax.php',{
			parameters:{clientid:id, action:'getClient'},
			onComplete:function(){
				document.getElementsByClassName('client_image').each(function(node){
					new Control.Modal(node, {
						opacity: 0.85,
						loading: '/img/loading.gif',
						fade: true,
						fadeDuration: 0.25
					});
				});
				
				if(currentClient && currentClient != elm){
					currentClient.removeClassName('currentClient');
				}
				currentClient = elm;
				
				// if($('modal_container')){
					Event.observe('modal_container','click',Control.Modal.close());
				// }
				// if($('modal_loading')){
					Event.observe('modal_loading','click',Control.Modal.close());
				// }
			}
		}
	);
}

function addCommas(val){
	return val;
}
var payTotal = 0.00;
function updateTotal(chbox,val){
	payTotal = (chbox.checked == true) ? payTotal + val : payTotal - val;
	$('total').value = addCommas(payTotal);
}