s.affiliate check is not a function
I have the below code implemented in the custom code section for "Core - Library Loaded (Page Top)" of the rule . I have already implemented the helper function below in the code block. But, it shows in the console that "s.rdcAffiliateCheck is not a function" . See screenshot. Can u point as to what I am doing wrong?

s.useURL='';
s__tempUseURL = document.location.href.toLowerCase();
var s__qpLink = s.Util.getQueryParam("link",s__tempUseURL) || s.Util.getQueryParam("ip_link",s__tempUseURL);
if(s__qpLink||s.Util.getQueryParam("u",s__tempUseURL)||s.Util.getQueryParam("prti",s__tempUseURL)||s.Util.getQueryParam("ext",s__tempUseURL)||((document.referrer||"").indexOf(document.location.hostname)==-1)){
s.useURL=document.location.href;
}else{
s.useURL=document.referrer||"";
}
s.useURL=s.useURL.toLowerCase();
if(s.Util.getQueryParam("prti",s.useURL)&&!s.Util.getQueryParam("ext",s.useURL)){
s.tempPRTI=s.Util.getQueryParam("prti",s.useURL);
s.tempAff=s.rdcAffiliateCheck(s.tempPRTI,s.cjAffiliateLookup);
if(s.tempAff==="1"){
s.tempPID=s.Util.getQueryParam("pid",s.useURL)?s.Util.getQueryParam("pid",s.useURL):"pid missing";
s.tempAID=s.Util.getQueryParam("aid",s.useURL)?s.Util.getQueryParam("aid",s.useURL):"aid missing";
s.eVar75="af_cj_"+s.tempPID+"_"+s.tempAID;
}
else{
s.tempAff=s.rdcAffiliateCheck(s.tempPRTI,s.directAffiliateLookup);
if(s.tempAff==="1"){
s.tempRAID=s.Util.getQueryParam("raid",s.useURL);
if(s.tempRAID){s.eVar75="af_direct_"+s.tempPRTI+"_"+s.tempRAID;}
else{s.eVar75="af_direct_"+s.tempPRTI;}
}
}
}
s__qpLink = s.Util.getQueryParam("Link",s.useURL) || s.Util.getQueryParam("link",s.useURL) || s.Util.getQueryParam("ip_link", s.useURL);
if(!s.eVar75) {
if(s__qpLink){s.eVar75="em_"+s__qpLink;}
else if(s.Util.getQueryParam("u",s.useURL)){s.eVar75="em_"+s.Util.getQueryParam("u",s.useURL);}
}
s.cjAffiliateLookup=window.gblCJList;
s.directAffiliateLookup=window.gblDirectList;
/*
* Helper Function: rdcAffiliateCheck v1.0
*/
s.rdcAffiliateCheck=function(a,b){
if(a&&b){
var i,p=parseInt(a),v;
for(i=0;i<b.length;i++){
if(b[i]===p){v=true;break;}
}
if(v===true){return '1';}
else{return '0';}
}
else{return '';}
}