function getCaptcha(imgobj, docRoot, identifikator) {
	if(imgobj.src.indexOf('code')>=0) return;
	var client = getNewHTTPObject();
	client.open("GET", docRoot + "captcha.php?code=captcha&refresh=" + new Date().getTime(), false);
	client.send(null);
	if(client.responseText) {
		document.getElementById('captcha_' + identifikator).src = docRoot + 'captcha.php?code=' + client.responseText;
		document.getElementById('captchaCode_' + identifikator).value = client.responseText;
	}
}

function refreshCaptcha( docRoot, identifikator ) {
	imgobj = document.getElementById('captcha_' + identifikator);
	imgobj.src = docRoot + '/captcha/bg.png';
	getCaptcha( imgobj, docRoot, identifikator );
}

function getNewHTTPObject()
{
        var xmlhttp;

        /*@cc_on
          @if (@_jscript_version >= 5)
              try
              {
                  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              }
              catch (e)
              {
                  try
                  {
                      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  }
                  catch (E)
                  {
                      xmlhttp = false;
                  }
             }
          @else
             xmlhttp = false;
        @end @*/

        if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
        {
            try
            {
                xmlhttp = new XMLHttpRequest();
            }
            catch (e)
            {
                xmlhttp = false;
            }
        }

        return xmlhttp;
}
