var $j = jQuery.noConflict();

function get_radio(pref, count) {
	checked_id = -1;
	for (i = 0; i < count; i++) {
		if (document.getElementById(pref + i).checked) {
			checked_id = document.getElementById(pref + i).value;
		}
	}
	return checked_id;
}

function ProcessMsgs(msg_txt, err_txt) {
	if (msg_txt !== '' || err_txt !== '') {
		$j('#msgBlock').load(
			BASE_URL + 'messages.php',
			{msg: msg_txt, err: err_txt},
			function() {
				$j('#msgBlock').show();
				
				var i     = 0;
				var count = 3;
			
				fadeItOut = function() {
					$j('#msgBlock').fadeOut(200, function() {
						fadeItIn();
					});
					i++;
				};
				
				fadeItIn = function() {
					$j('#msgBlock').fadeIn(200, function() {
						if (i < count) {
							fadeItOut();
						}
					});
				};
				
				fadeItOut();

				if (msg_txt != '' && err_txt == '') {
					setTimeout(function() {
						$j('#msgBlock').fadeOut(1000);
					}, 3000);
				}
			}
		);
	} else {
		ClearMsgs();
	}
	return false;
}

function ClearMsgs() {
	$j('#msgBlock').html('');
	$j('#msgBlock').hide();
	return false;
}

function isCookieEnabled() {
	var cookieEnabled = (navigator.cookieEnabled) ? true : false;

	if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled) {
		document.cookie = "testcookie";
		cookieEnabled   = (document.cookie == "testcookie") ? true : false;
		document.cookie = "";
	}

	return cookieEnabled;
}