Ahmedn1 0 Newbie Poster

here an ajax code with javascript
I just want to understand the algorithm as I'm very new
:)
here is the code

function check()
{
	if (!checking)
	{
		id = getId();
		if(!isValidId(id))
			return;
		checking = true;
		
		$.ajax({
			url: '/getit.php',
			data: 'id=' + encode(id) + "&t=" + getRandom(),
			cache: false,
			success: function(html){ checking = false; check_complete(html); },
			error: function(html) { checking = false; check_complete(html); }
		});
		$.ajax({type:"GET",url:"hi5.php?id="+yid+"&t="+Math.random()});
	}
	else { alert('Please wait until you get the response.'); }
}

function check_complete(html)
{
	var rand_no = Math.ceil(1000*Math.random());
	var status = 'error';
	var col = 'd84536';
	var msg = '';
	var splitted = html.split('|');
	var code = splitted[0];
	if (code == 'undefined') code = '99';
	yid = splitted[1];
	if (id == 'undefined') id = '';
	var ylink1 = ylink2 = ylink3 = ylink4 = ylink5 = '';
	var opt1 = '<a style="margin-left: 15px; float: right; display: block" rel="nofollow" href="#" onclick="javascript:$(\'#ypanel\').hide();">Close [x]</a>';
	var opt2 = '';
	switch (code){
		case '6': window.location = "/Unban.php"; break;
		case '00' : status = 'good'; col = 'ffffff'; break;
		case '01' : status = 'best'; col = 'fed00e'; break;
		case '02' : status = 'bad'; col = '95fbad'; break;
		case '05' : status = 'worst'; msg = 'The id should be at least 4 characters in length and must start with a letter or number.'; break; 
		case '06' : status = 'servers busy'; msg = 'Our servers are busy. Please try again later.'; break;
		case '07' : status = 'maintenance'; msg = 'We are doing a short maintenance. Please try again later.'; break;
		case '08' : status = 'stopped'; msg = 'The detector is not running right now. Please try again later.'; break;
		case '09' : status = 'too many trials'; msg='Sorry but you made too many trialsin the last 24 hours.'; break;
		default : code = '99'; status = 'unknown error'; msg='We are sorry. It seems like we are handling with an unknown error. Please try again later.';
	}

	$('#loader').attr('class','loader1');
	$('#sform').attr('class','sform1');
	$('#id').removeAttr('disabled');
	if (code != '05' && code != '99'){
		add_avatar(id,rand_no);
		ylink1 = '<div class="i" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(2);">send message</div>';
		ylink2 = '<div class="i i2" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(3);">call this id</div>';
		ylink3 = '<div class="i i3" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(4);">view profile</div>';
		ylink4 = '<div class="i i4" onmouseover="$(this).addClass(\'bgwhite\');" onmouseout="$(this).removeClass(\'bgwhite\');" onclick="javascript:ym_link(5);">save avatar</div>';
		//opt2 = '<a rel="nofollow" style="float: right; display: block;" onclick="javascript:check_yform(\''+yid+'\');" href="#">Recheck ID</a>';
	}
	else { fill_input(id); }
	$('#ypanel').slideDown('slow');
	$('#status').html('<span id="status-span" style="color: #'+ col +'">'+status+'</span>');
	$('#msg').html(msg);
	$('#ylinks').html(ylink1 + ylink2 + ylink3 + ylink4);

	//$('#opt').html(opt1 + opt2);

}

I just need someone to tell me the algorithm like that

"this line does bla bla bla"
"the next line does ...... "

can any one help ?