﻿function Humanity(imgName,callBack){
    var guid ;   
    var ServiceUrl='http://captcha.tourkuazelite.com/'
    this.imgCaptcha = imgName
    this.callBack = callBack
    var _Xme=this
    this.Generate=function (){
        var jsonp = true;
        var service = new WS("http://captcha.tourkuazelite.com/Services" + (jsonp ? "/JSONP" : "") + "/MyService.asmx", jsonp ? WSDataType.jsonp : WSDataType.json);
        service.call("Surface", { radius: 1 }, function(surface) {
          guid=surface;
          $("#" + imgName).attr("src", ServiceUrl + "Captcha.aspx?Guid=" + guid);
       });
   }
    
    this.Check=function (entry){
        var jsonp = true;
        var service2 = new WS("http://captcha.tourkuazelite.com/Services" + (jsonp ? "/JSONP" : "") + "/MyService.asmx", jsonp ? WSDataType.jsonp : WSDataType.json);
        service2.call("Verify", { argText: entry, argGuid: guid }, function(Verify) {
            _Xme.callBack(Verify)
        });
    }
    
    return this 
}
