var oldOnload=window.onload;var WF={
baseUrl: 'http://my.freedomsoft.com',
token: '1a49aa3cc4f2c50f60701cb5d2ad9d02bbde1391',
ipAddress: null,
viewIntervalCount: 0,
appendIPAddressField: function(){
var input=document.createElement('input');input.type='hidden'; input.name='ip_address';input.value=WF.ipAddress;WF.form.appendChild(input);},
createIframe: function(){
var iframe=document.createElement('iframe');iframe.style.display='none';document.body.appendChild(iframe);WF.iframe=iframe;},
determineIpAddress: function(){
window.assignWFIPAddress=function(json) {
WF.ipAddress=json.ip;WF.appendIPAddressField();}
var ipScript=document.createElement('script');ipScript.type='text/javascript';ipScript.src='http://jsonip.appspot.com/?callback=assignWFIPAddress';document.body.appendChild(ipScript);},
recordView: function(){
if (WF.viewIntervalCount >= 10 || WF.ipAddress != null) {
clearInterval(WF.viewInterval)
var addition='webforms/'+WF.token+'/viewed';if (WF.ipAddress) addition += '?ip_address='+WF.ipAddress;WF.iframe.src=WF.url(addition);}
WF.viewIntervalCount++;},
url: function(addition) {
return WF.baseUrl+'/'+addition;}
}
window.onload=function(){
setTimeout(function(){
WF.form=document.getElementById('webform_'+WF.token);if (!WF.form) WF.form=document.getElementsByClassName('webform_'+WF.token)[0];WF.determineIpAddress();WF.createIframe();if (oldOnload) oldOnload();WF.viewInterval=setInterval(WF.recordView, 100);}, 0);}

