(function() { 
    
    var paymentBox = new IATSPaymentBox();
    paymentBox.installJavaScript('https://www.iatspayments.com/PaymentBox/js/iats_Calendar_us.js?v=170614');
    paymentBox.installStyleSheet('https://www.iatspayments.com/PaymentBox/css/tcal.css?v=170614&cb=12132');
    
    paymentBox.installJavaScriptAuraBox(decodeURIComponent('https://www.iatspayments.com/PaymentBox/IATSPaymentBoxCore.aspx%3fPID%3dPAB79B1E33E348A46C&Version=NA&cb=12132') + GetClientParameters());                   
    paymentBox.installJavaScript('https://www.google.com/recaptcha/api.js?onload=recaptchaCallback&render=explicit&cb=12132');   
})();
function IATSPaymentBox() {
  this.installJavaScript = InstallJavaScript;
  this.installStyleSheet = InstallStyleSheet; 
  this.installJavaScriptAuraBox = InstallJavaScriptAuraBox;
  this.startScript = StartScript;
  this.startRecaptcha = StartRecaptcha;  
}
function InstallJavaScript(scriptURL) {
    var head= document.getElementsByTagName('head')[0];
    var script= document.createElement('script');
    var caller = this;
    script.type= 'text/javascript';
    script.onreadystatechange= function () {
        if (this.readyState == 'complete' || this.readyState == 'loaded') caller.startScript();
    }
    script.onload= this.startScript;
    script.src= scriptURL;
    head.appendChild(script);
}
function InstallJavaScriptAuraBox(scriptURL) {
    var head= document.getElementsByTagName('head')[0];
    var script= document.createElement('script');
    var caller = this;
    script.type= 'text/javascript';
    script.src= scriptURL;
    head.appendChild(script);
}
function InstallStyleSheet(styleSheetLink) {
    var theStyleSheet;
    var head= document.getElementsByTagName('head')[0];
	var linksarray = document.getElementsByTagName("link");
	for ( var i in linksarray) 
	{
		if      (linksarray[i].href === styleSheetLink) 
		{
			return;
		} 
	}
    theStyleSheet = document.createElement('link');    
	theStyleSheet.setAttribute('type', 'text/css');
	theStyleSheet.setAttribute('href', styleSheetLink);
	theStyleSheet.setAttribute('rel', 'stylesheet');
	head.appendChild(theStyleSheet);
	theStyleSheet = null;
};
function StartScript() {
}
function recaptchaCallback() {
    var t;
    
     var verifyCallback = function(response) {
     	
     };
	
    if (document.getElementById("IATS_CAPTCHADiv") == undefined || document.getElementById("IATS_CAPTCHADiv") == null) {
	    
	    t = setTimeout("recaptchaCallback()", 1000);
    }
    else {
	    if (theIATSPaymentBoxCore.enableCAPTCHA == "1") {
		    
		    var load = setTimeout(function() {
			    
			    widgetId1 = grecaptcha.render("IATS_CAPTCHADiv", {
        			    sitekey: theIATSPaymentBoxCore.RecaptchaSiteKey,
				        callback: verifyCallback,
				        theme: theIATSPaymentBoxCore.captchatheme
        		    });
	
		    }, 1000);
	    }
    }
	
}
function StartRecaptcha() { 
    
    var t; 
    try {     
        
        if (theIATSPaymentBoxCore.enableCAPTCHA=="1") {
            if (document.getElementById("IATS_CAPTCHADiv")==undefined || document.getElementById("IATS_CAPTCHADiv")==null) {
                t = setTimeout("StartRecaptcha()",100);   
	        }
            else {
                
                Recaptcha.create("6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI", "IATS_CAPTCHADiv",{theme: theIATSPaymentBoxCore.captchatheme});   
		        
	        }
        }
    } 
    catch(err) {
        
    }  
}
function GetClientParameters()
{
    var ClientParameters = "";
    var dest = window.location.href;
    if (dest.indexOf('?')>=0) {
        dest = dest.substring(dest.indexOf('?')+1);
        ClientParameters = "&ClientParameters=" + encodeURIComponent(dest);
    }
    return ClientParameters;
}
function IsScriptLoaded(scr) {
    var scripts = document.getElementsByTagName('script');
    for (var i = scripts.length; i--;) {
        if (scripts[i].src.indexOf(scr) !== -1) return true;
    }
    return false;
}