
cms.registration = {
	next : function() {
		var form  = document.forms['frmRegistration'];
		if (form['payment_method']) {				
			for(var i=0; i<form['payment_method'].length;i++) {
				if (form['payment_method'][i].checked == true) {
					if (form['payment_method'][i].value == '1' ) {
						if (cms.forms.validate(document.frmRegistration)) {
							document.frmRegistration.submit();
						}
					} else {
						document.frmRegistration.submit();
					}
				}
			}
		} else {
			if (cms.forms.validate(document.frmRegistration)) {
				document.frmRegistration.submit();
			}
		}
		return false;
	},
	back : function () {
		document.frmRegistration.step.value = document.frmRegistration.step.value - 2;
		document.frmRegistration.submit();
	}



}

var payment = {
	changeLogo : function (obj,image) {
		document.getElementById('paymentCreditCardLogo').className = obj.value;
	},
	whatIsCVN : function (module) {
		var cvn = window.open(
			'components/' + module + '/whatiscvn.html', 
			'CVN',
			'scrollbars=no,menubar=no,height=300,width=300,resizable=yes,toolbar=no,location=no,status=no'
		);
		return false;
	},
	changeType : function (obj,prefix) {
		var formsContainer = document.getElementById('paymentForms');
		for (var i =0; i< formsContainer.childNodes.length;i++) {
			if (formsContainer.childNodes[i].id == prefix + obj.value) {
				formsContainer.childNodes[i].style.display = 'block';
			} else {
				formsContainer.childNodes[i].style.display = 'none';
			}
		}	
	}
}
