function reload_captcha() {

var code = $("#sid").val(); 
//alert(code);
var timestamp = new Date(); 
$("#captcha").attr("src", "/bitrix/tools/captcha.php?captcha_code="+code+"&timestamp="+timestamp.getTime());

//img.src = '/bitrix/tools/captcha.php?captcha_code=' + CC;
//document.Write(img);
//alert(img.src);
}

function cptRefresh() { 

      var countOfexec = 0; 
      var code = $("#sid").val(); 
	  
	  

      return function() { 
        if(countOfexec < 5) { 
           var timestamp = new Date();
		   //alert(code);
           $('#code').attr("src", "/bitrix/tools/captcha.php?captcha_sid="+code+"&timestamp="+timestamp.getTime()); 
        } else { 
           $.get("/info/ds/index.php", function(data){ 
              $("#sid").val(data); 
              $('#code').attr("src", "/bitrix/tools/captcha.php?captcha_sid="+data); 
           }); 
           countOfexec = 0; 
        } 
        return ++countOfexec; 
      } 
} 
