function getJsonResponse(object) {
	switch (object.type) {
		case 'function':
			switch (object.value) {
				case 'reload':
					window.location.href = '/?m=welcome&a=login&r=' + encodeURIComponent(window.location.href);
					break;
			}
			break;
		case 'html':
			return object.value;
	}
	return false;
}


function cps(checkbox) {
	$.getJSON(
		'/',
		{
			m :'adm',
			a :'payment',
			s : checkbox.checked ? '1' : '0',
			u : checkbox.value
		},
		function(data) {
			alert(getJsonResponse(data));
			window.location.reload();
		}
	);
}

function mg(checkbox) {
	$.getJSON(
		'/',
		{
			m :'adm',
			a :'mygdc',
			s : checkbox.checked ? '1' : '0',
			u : checkbox.value
		},
		function(data) {
			alert(getJsonResponse(data));
		}
	);
}

function ac(checkbox) {
	$.getJSON(
		'/',
		{
			m :'adm',
			a :'confirm',
			s : checkbox.checked ? '1' : '0',
			u : checkbox.value
		},
		function(data) {
			alert(getJsonResponse(data));
		}
	);
}


function ac_en(checkbox) {
	$.getJSON(
		'/',
		{
			m :'adm',
			a :'confirm_en',
			s : checkbox.checked ? '1' : '0',
			u : checkbox.value
		},
		function(data) {
			alert(getJsonResponse(data));
		}
	);
}

function bc(checkbox) {
	var code = createRandomNumeric(16);
	$.getJSON(
		'/',
		{
			m :'adm',
			a :'barcode',
			s : code,
			u : checkbox.value
		},
		function(data) {
			$(checkbox).parent().text(getJsonResponse(data));
		}
	);
}