
var captchaValidationName='';
function byid(id)
{
	var elem;
	if(document.all)
	{
		elem = eval('document.all.'+id);
	}
	else
	{
		elem = document.getElementById(id);
	}
	return elem;
}

function getBase()
{
	return location.protocol + '//'+location.host;
}

function getBasePath()
{
	return getBase() + '/dr';
}

function ajaxCaptcha(captchaName)
{	
	var textBox = byid('captcha_text_'+captchaName);	
	var url = getBasePath() + '/AJAXUltraServlet?type=captcha&action=' + escape(textBox.value) + '&uid=' + Math.random();
	http.open('get', url);
	captchaValidationName=captchaName;
	http.onreadystatechange = ajaxCaptcha_Response;
	http.send(null);
}

function ajaxCaptcha_Response()
{
	if(http.readyState == 4)
    {
		var response = http.responseText;
		if(response == '')
		{
			return;
		}
	
		if(captchaValidationName) 
		{
			var img = byid('captcha_status_' + captchaValidationName);
			if(img)
			{
				img.src = response;
			}			
		}
		
		captchaValidationName = null;
	}
}





