//-----------------------------------------------------------
// Site JS
//-----------------------------------------------------------
var cr = {};

cr.UpdateCart = function(action,classID){
	dom.$('CartMessage').innerHTML = '<img src="/images/e1/t1/ajax-loader.gif" />';
	var myVars = {
		'IDX'		: 'class_reg.update_cart.process',
		'Action'	: action,
		'ClassID'	: classID,
		'Refresh'	: (arguments[2] != null) ? arguments[2] : ''
	};
	xh.postResponse( '/', myVars, 'cr.AddToCartCallback' );
}

cr.AddToCartCallback = function(myReturn){
	myReturn = myReturn.split('|');
	if(myReturn[0] == 'SUCCESS'){
	
		if(dom.$('AddRemove'+myReturn[1]).innerHTML == 'add'){
			dom.$('AddRemove'+myReturn[1]).innerHTML = 'remove';
		} else {
			dom.$('AddRemove'+myReturn[1]).innerHTML = 'add';
		}

		dom.$('CartMessage').innerHTML = myReturn[2];
		if(myReturn[3] == 'true'){
			window.location.reload();
		}
	}else{
		dom.$('CartMessage').innerHTML = myReturn[0];
	}
}

cr.SelectPymtMethod = function(pymtMethod){
	if(pymtMethod == 'CC'){
		dom.$('Offline').style.display = 'none';
		dom.$('CC').style.display = 'block';	
		dom.$('PaymentType').value = pymtMethod;
	}else{
		dom.$('Offline').style.display = 'block';
		dom.$('CC').style.display = 'none';
		dom.$('PaymentType').value = pymtMethod;
	}
}

//-----------------------------------------------------------