function swtchPrice() {
	if ($('priceLink').innerHTML == 'International Call rates ( + )') {
		$('priceTable').show();
		$('priceLink').update('International Call rates ( - )');
	} else {
		$('priceTable').hide();
		$('priceLink').update('International Call rates ( + )');
	}
}

function swtchDidPrice() {
	if ($('didpriceLink').innerHTML == 'DID rates ( + )') {
		$('didpriceTable').show();
		$('didpriceLink').update('DID rates ( - )');
	} else {
		$('didpriceTable').hide();
		$('didpriceLink').update('DID rates ( + )');
	}
}

function swtchSmsPrice() {
	if ($('smspriceLink').innerHTML == 'SMS rates ( + )') {
		$('smspriceTable').show();
		$('smspriceLink').update('SMS rates ( - )');
	} else {
		$('smspriceTable').hide();
		$('smspriceLink').update('SMS rates ( + )');
	}
}

function swtchStat() {
	if ($('statLink').innerHTML == 'Statistic ( + )') {
		$('statTable').show();
		$('statLink').update('Statistic ( - )');
	} else {
		$('statTable').hide();
		$('statLink').update('Statistic ( + )');
	}
}

function swtchWrong() {
	if ($('wrongLink').innerHTML == 'Wrong content? ( + )') {
		$('wrongEdit').show();
		$('wrongLink').update('Wrong content? ( - )');
	} else {
		$('wrongEdit').hide();
		$('wrongLink').update('Wrong content? ( + )');
	}
}

function chkFrm() {
	var message = '';

	if (!$('reason').value && !message) {
		message = 'Enter text';
		$('reason').focus();
	}

	if (!$('ccode').value && !message) {
		message = 'Enter 6 digits';
		$('ccode').focus();
	}

	if (message) {
		alert(message);
	} else {
		new Ajax.Request('/core/', {
			method: 'post',
			parameters: {method: 'ccode', sessid: $('sessid').value, ccode: $('ccode').value},
			onSuccess: function(transport) {
				var json = transport.responseText.evalJSON(true);
				var error = json.error;
				var i;

				if (error == 0) {
					$('wrongFrm').submit();
				} else {
					message = 'Digits incorrect';
					$('ccode').focus();
					alert(message);
				}
			}
		});
	}
}
