
var Faq=function()
{
var c=function()
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/Faq",{verb:"POST",data:{surname:$("#apssurname").val(),givenname:$("#apsgivenname").val(),email:$("#apsemail").val(),projectId:"",userQuestion:$("#apsquestion").val()+"<br/>SID: "+$("#apssurveynumber").val()+$("#othersurvey").val()+"<br/>",subject:$("#apssubject").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.Json);
$.modal.close()
}
else
alert(a.ErrorMessage);
apsdaqBtnClickGo=true
},error:function()
{
apsdaqBtnClickGo=true
}})
},
b=function()
{
var a=true,
c=/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
g=$("#apssurname").val(),
d=$("#apsgivenname").val(),
b=$("#apsemail").val(),
f=$("#apssubject").val(),
e=$("#apsquestion").val();
if(g=="")
{
$("#apssurname").addClass("error");
a=false
}
if(d=="")
{
$("#apsgivenname").addClass("error");
a=false
}
if(b==""||c.test(b)==false)
{
$("#apsemail").addClass("error");
a=false
}
if(f=="")
{
$("#apssubject").addClass("error");
a=false
}
if(e=="")
{
$("#apsquestion").addClass("error");
a=false
}
return a
},
a=function()
{
$("#apssurname").removeClass("error");
$("#apsgivenname").removeClass("error");
$("#apsemail").removeClass("error");
$("#apssubject").removeClass("error");
$("#apsquestion").removeClass("error")
},
d=function()
{
$("#apssubjectoptions").val("000");
$("#apssurname").val("");
$("#apsgivenname").val("");
$("#apsemail").val("");
$("#apssubject").val(" - ");
$("#apsquestion").val("");
$("#AskSurveyNumber").css("display","none")
};
$(function()
{
$("#AskSurveyNumber").css("display","none");
$("#othersurvey").css("display","none");
$("#apssubmit").click(function(d)
{
d.preventDefault();
if(apsdaqBtnClickGo==true)
{
apsdaqBtnClickGo=false;
a();
b()==true&&
c.call()
}
apsdaqBtnClickGo=true
});
$("#apscancel").click(function(a)
{
a.preventDefault();
d()
});
$("#apssubjectoptions").change(function()
{
$(this).val()!="000"&&
$("#apssubjectoptions option:selected").each(function()
{
$("#apssubject").val($(this).text())
});
if($(this).val()==$("#surveyLabelName").val())
$("#AskSurveyNumber").show("slow");
else
{
$("#AskSurveyNumber").hide("slow");
$("#apssurveynumber").val("")
}
});
$("#survey-numer").change(function()
{
if($(this).val()!="000"||$(this).val()!="Other")
{
$("#othersurvey").hide("slow");
$("#othersurvey").val("");
$("#survey-numer option:selected").each(function()
{
$("#apssurveynumber").val($(this).text())
})
}
if($(this).val()=="other")
{
$("#othersurvey").show("slow");
$("#apssurveynumber").val("")
}
});
$(".faq-section li a").click(function()
{
window.open($(this).attr("href"),"_blank")
});
$(".faq-section li").toggle(function()
{
$(this).find("p").show(function()
{
$(this).prev(".faq-icon").attr("style","background-position: 0 -23px")
})
},function()
{
$(this).find("p").hide(function()
{
$(this).prev(".faq-icon").attr("style","background-position: 0 0")
})
});
$("#submit-a-question").click(function()
{
$("#contact-ss-container").modal({containerId:"modal-container",autoResize:true,width:500,closeClass:"modal-close",overlayClose:true,opacity:90});
return false
})
})
}(),
apsdaqBtnClickGo=true


function QueryStringRequest(a)
{
a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var c="[\\?&]"+a+"=([^&#]*)",
d=new RegExp(c),
b=d.exec(window.location.href);
return b==null?"":b[1]
}
$(function()
{
$("#paged-content li:first").show();
$(".pagination li a").click(function(a)
{
a.preventDefault();
$(this).parent().parent().parent().prev("ul").closest("ul").find("li:visible").hide();
$(this).parent().parent().parent().prev("ul").closest("ul").find("li").eq($(this).parent().index()).show()
});
$(".pagination select").change(function(a)
{
a.preventDefault();
$(this).parent().parent().parent().find("ul").find("li:visible").hide();
$(this).parent().parent().parent().find("ul").find("li").eq($(this).val()-1).show()
})
});
$(function()
{
try
{
var a=$("#nav ul li a");
for(i=0;i<a.length;i++)
if(window.location.pathname.toLowerCase().search($(a[i]).attr("id"))!=-1)
{
$(a[i]).addClass("nav-active");
break
}
}
catch(c)
{
}
try
{
var a=$("#nav-dashboard ul li a");
for(i=0;i<a.length;i++)
if(window.location.pathname.toLowerCase().search($(a[i]).attr("id"))!=-1)
{
$(a[i]).addClass("nav-active");
break
}
}
catch(c)
{
}
try
{
var b=$(".dashboard-menu-mid ul li a");
for(i=0;i<b.length;i++)
if(window.location.pathname.toLowerCase().search($(b[i]).attr("id"))!=-1)
{
$(b[i]).addClass("astrongclass");
break
}
}
catch(c)
{
}
$(".reward-box:eq(3)").find("img").addClass("spinner")
});
$(document).ready(function()
{
var b=window.location.pathname,
a="/Secured/Claim-Rewards";
b==a&&
$("#reward-status .points:eq(2)").addClass("points-fix")
})


function QueryStringRequest(a)
{
a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
var c="[\\?&]"+a+"=([^&#]*)",
d=new RegExp(c),
b=d.exec(window.location.href);
return b==null?null:b[1]
}
var Login=function()
{
var a=function()
{
var a="";
if(typeof grecaptcha==="object")
if($("#g-recaptcha-response").val())
a=grecaptcha.getResponse();
document.cookie="FB_CheckUser=true; path=/";
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/Login",{verb:"POST",data:{user:$("#apsusername").val(),password:$("#apspassword").val(),redirectUrl:QueryStringRequest("redirecturl"),guid:currentItem,recaptchaResponse:a},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
if(a.ErrorMessage!=null)
{
e(a.JavaScript,a.ErrorMessage);
return false
}
else
eval(a.JavaScript);
else
alert(a.ErrorMessage);
apsloBtnClickGo=true
},error:function()
{
apsloBtnClickGo=true
}})
},
e=function(b,c)
{
var a=0;
$.modal("<div id='login-unconfirmed-modal'><p>"+c+"</p></div>",{onClose:function()
{
if(a!=1)
{
$.modal.close();
eval(b)
}
},containerId:"login-unconfirmed-modal-container",autoResize:false,closeClass:"modal-close",overlayClose:true,opacity:90});
$("#login-confirm-email").click(function()
{
a=1;
$.modal.close();
d(b)
})
},
d=function(a)
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/RegistrationEmail",{verb:"POST",data:{user:$("#apsusername").val(),password:$("#apspassword").val(),redirectUrl:QueryStringRequest("redirecturl"),guid:currentItem},success:function(c)
{
var b=JSON.parse(c.d);
if(b.Success==true)
{
alert(b.Json);
$.modal.close();
eval(a)
}
else
{
alert(b.ErrorMessage);
$.modal.close();
eval(a)
}
},error:function()
{
}})
},
b=function()
{
var a=true,
e=/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
c=$("#apsusername").val(),
b=$("#apspassword").val();
if(c=="")
{
$("#apsusername").addClass("error");
a=false
}
if(b=="")
{
$("#apspassword").addClass("error");
a=false
}
if(typeof grecaptcha==="object")
{
var d=grecaptcha.getResponse();
if(d.length==0)
{
$("#recaptcha-wrapper").addClass("error");
a=false
}
else
$("#recaptcha-wrapper").removeClass("error")
}
return a
},
c=function()
{
$.ajaxDotNet("/app_services/aps/secured/SecuredServices.asmx/LogOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.ErrorMessage);
apsliBtnClickGo=true
},error:function()
{
apsliBtnClickGo=true;
window.location="/"
}})
};
$(function()
{
$("#apsusername").keypress(function(c)
{
var d=c.keyCode?c.keyCode:c.which;
if(d==13)
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
b()==true&&
a.call()
}
});
$("#apspassword").keypress(function(c)
{
var d=c.keyCode?c.keyCode:c.which;
if(d==13)
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
b()==true&&
a.call()
}
});
$("#apslogin").click(function(c)
{
c.preventDefault();
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
if(b()==true)
a.call();
else
apsloBtnClickGo=true
}
});
$(".inbody-aps-logout").click(function(a)
{
a.preventDefault();
if(apsliBtnClickGo==true)
{
apsliBtnClickGo=false;
c.call()
}
});
$("#forgotpasswordtextforbutton").click(function(a)
{
a.preventDefault();
window.location=$("#forgotpasswordtextforbutton").attr("href")+"?emailaddress="+$("#apsusername").val()
});
$("#apslogout").click(function(a)
{
a.preventDefault();
if(apsliBtnClickGo==true)
{
apsliBtnClickGo=false;
c.call()
}
});
$("#apsusername").focusin(function()
{
if(apsuserHolder=="")
apsuserHolder=$("#apsusername").val();
$("#apsusername").val()==apsuserHolder&&
$("#apsusername").val("")
});
$("#apsusername").focusout(function()
{
var a=$("#apsusername").val();
a==""&&
$("#apsusername").val(apsuserHolder)
});
$("#apsusernamerequest").focusin(function()
{
if(apsuserrequestHolder=="")
apsuserrequestHolder=$("#apsusernamerequest").val();
$("#apsusernamerequest").val()==apsuserrequestHolder&&
$("#apsusernamerequest").val("")
});
$("#apsusernamerequest").focusout(function()
{
var a=$("#apsusernamerequest").val();
a==""&&
$("#apsusernamerequest").val(apsuserrequestHolder)
});
$("#apspassword").focusin(function()
{
if(apspassHolder=="")
apspassHolder=$("#apspassword").val();
$("#apspassword").val()==apspassHolder&&
$("#apspassword").val("")
});
$("#apspassword").focusout(function()
{
var a=$("#apspassword").val();
a==""&&
$("#apspassword").val(apspassHolder)
})
})
}(),
apsuserHolder="",
apsuserrequestHolder="",
apspassHolder="",
apsloBtnClickGo=true,
apsliBtnClickGo=true,
ChangeLogin=function()
{
var a=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/ChangeLogin",{verb:"POST",data:{newemail:$("#apsnewemailaddress").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
$("#customMessages").html("");
$("#changeLogin").html(a.Json)
}
else
{
$("#customMessages").html(a.ErrorMessage);
$("#customMessages").removeClass("hideme");
$("#customMessages").addClass("error");
return
}
apsemailBtnClickGo=true
},error:function()
{
apsemailBtnClickGo=true
}})
},
b=function()
{
};
$(function()
{
function b(a)
{
var b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return b.test(a)
}
$("#apssavenewemailbutton").click(function()
{
if($("#apsnewemailaddress").val()=="")
alert($("#fillinemailaddress").val());
else
if($("#apsconfirmemailaddress").val()=="")
alert($("#retypeemailaddress").val());
else
if(!b($("#apsnewemailaddress").val())||!b($("#apsconfirmemailaddress").val()))
alert($("#emailValidationError").text());
else
if($("#apsnewemailaddress").val()!=$("#apsconfirmemailaddress").val())
alert($("#emailDontMatchMessage").text());
else
a()
})
})
}(),
apsemailBtnClickGo=true


var PasswordHint=function()
{
var e=function()
{
var a="";
if(typeof grecaptcha==="object")
if($("#g-recaptcha-response").val())
a=grecaptcha.getResponse();
if(typeof grecaptcha==="object")
{
var b=grecaptcha.getResponse();
if(b.length==0)
{
$("#recaptcha-wrapper").addClass("error");
return false
}
else
$("#recaptcha-wrapper").removeClass("error")
}
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/RequestPassword",{verb:"POST",data:{user:$("#apsusernamerequest").val(),guid:currentItem,recaptchaResponse:a},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage)
},error:function()
{
}})
},
f=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/ChangePassword",{verb:"POST",data:{password:$("#apscurrentpassword").val(),newpassword:$("#apsnewpassword").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apspwsBtnClickGo=true
},error:function()
{
apspwsBtnClickGo=true
}})
},
c=function()
{
var a=true,
c=/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
b=$("#apsusernamerequest").val();
if(b==""||c.test(b)==false)
{
$("#apsusernamerequest").addClass("error");
a=false
}
else
$("#apsusernamerequest").removeClass("error");
return a
},
d=function()
{
var a=true,
c=/^[\w\s\?!@#%&*\(\)\/\|+:]{5,20}$/,
e=$("#apscurrentpassword").val(),
b=$("#apsnewpassword").val(),
d=$("#apsconfirmnewpassword").val();
if(c.test(b)==false)
{
$("#apsnewpassword").addClass("error");
alert($("#passwordValidationError").html());
a=false
}
else
if(b!=d)
{
$("#apsnewpassword").addClass("error");
$("#apsconfirmnewpassword").addClass("error");
alert($("#passwordsDontMatchMessage").html());
a=false
}
return a
},
b=function()
{
var c=/^(?=.*\d)(?=.*)(?=.*[A-Z])(?!.*\s).{8,30}$/,
a=true,
b=$("#rp-newpassword").val(),
d=$("#rp-confirmnewpassword").val();
$("#resetpasswordmessage").html("");
$("#resetpasswordmessage").addClass("hideme");
if(c.test(b)==false)
{
$("#resetpasswordmessage").html($("#passwordValidationError").html());
$("#resetpasswordmessage").removeClass("hideme");
$("#resetpasswordmessage").removeClass("alert-success");
$("#resetpasswordmessage").addClass("alert-danger");
$("#rp-newpassword").addClass("error");
a=false
}
else
if(b!=d)
{
$("#resetpasswordmessage").html($("#passwordsDontMatchMessage").html());
$("#resetpasswordmessage").removeClass("hideme");
$("#resetpasswordmessage").removeClass("alert-success");
$("#resetpasswordmessage").addClass("alert-danger");
$("#rp-newpassword").addClass("error");
$("#rp-confirmnewpassword").addClass("error");
a=false
}
return a
},
a=function()
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/ResetPassword",{verb:"POST",data:{password:$("#rp-newpassword").val(),resetToken:$("#rpresettoken").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
$("#resetpasswordmessage").html($("#resetpasswordsuccess").html());
$("#resetpasswordmessage").removeClass("hideme");
$("#resetpasswordmessage").removeClass("alert-danger");
$("#resetpasswordmessage").addClass("alert-success")
}
else
{
$("#resetpasswordmessage").html(a.ErrorMessage);
$("#resetpasswordmessage").removeClass("hideme");
$("#resetpasswordmessage").removeClass("alert-success");
$("#resetpasswordmessage").addClass("alert-danger")
}
apspwsBtnClickGo=true
},error:function()
{
apspwsBtnClickGo=true
}})
};
$(function()
{
$("#apspasswordhint").click(function()
{
if(apspwhBtnClickGo==true)
{
apspwhBtnClickGo=false;
if(typeof grecaptcha==="object")
{
var a=grecaptcha.getResponse();
if(a.length==0)
$("#recaptcha-wrapper").addClass("error");
else
$("#recaptcha-wrapper").removeClass("error")
}
var b=c();
b==true&&
e.call();
if(typeof grecaptcha==="object")
{
var a=grecaptcha.getResponse();
a.length==0&&
$("#recaptcha-wrapper").addClass("error")
}
apspwhBtnClickGo=true
}
});
$("#apssavenewpwbutton").click(function()
{
d()==true&&
f.call()
});
$("#rp-savenewpwbutton").click(function()
{
b()==true&&
a.call()
})
})
}(),
apspwhBtnClickGo=true,
apspwsBtnClickGo=true


var Refer=function()
{
var b=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/ReferService",{verb:"POST",data:{mEmail:$("#refer-myemail").val(),rEmail:$("#refer-youremail").val(),mName:$("#refer-myname").val(),rName:$("#refer-yourname").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apsrefBtnClickGo=true
},error:function()
{
apsrefBtnClickGo=true
}})
},
a=function()
{
var a=true,
b=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,
c=$("#refer-myemail").val(),
d=$("#refer-youremail").val(),
e=$("#refer-myname").val(),
f=$("#refer-yourname").val();
if(b.test(c)==false)
{
$("#refer-myemail").addClass("error");
a=false
}
if(b.test(d)==false)
{
$("#refer-youremail").addClass("error");
a=false
}
if(e=="")
{
$("#refer-myname").addClass("error");
a=false
}
if(f=="")
{
$("#refer-yourname").addClass("error");
a=false
}
return a
};
$(function()
{
$("#refer-send-email").click(function(c)
{
c.preventDefault();
if(apsrefBtnClickGo==true)
{
apsrefBtnClickGo=false;
a()==true&&
b()
}
})
})
}(),
apsrefBtnClickGo=true


var Register=function()
{
var a=function()
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/Registration",{verb:"POST",data:{surname:$("#apssurname").val(),givenname:$("#apsgivenname").val(),email:$("#apsemail").val(),gendercode:$("input:radio:checked").val()?$("input:radio:checked").val():"",age:"",customDisclaimer:"",url:document.location.href,redirectUrl:QueryStringRequest("redirecturl"),guid:currentItem,miscid:$("#miscid").val()?$("#miscid").val().replace(/[^0-9]/g,""):"",stateName:$("#registrationStates").length>0?$("#registrationStates").val():"",GDPRConsentProfile:$("#checkboxConsentProfile").is(":checked")?"1":$("#checkboxConsentProfile").length>0?"0":"",GDPRConsentPP:$("#checkboxConsentTC").is(":checked")?"1":$("#checkboxConsentTC").length>0?"0":"",GDPRConsentTC:$("#checkboxConsentTC").is(":checked")?"1":$("#checkboxConsentTC").length>0?"0":""},success:function(c)
{
var a=JSON.parse(c.d);
if(a.Success==true)
eval(a.JavaScript);
else
{
$.validator.addMethod("email",function(b,a)
{
return this.optional(a)||/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/.test(b)
},a.Json[3]);
if($("#miscid").length>0)
{
$.validator.addMethod("givenname",function(b,a)
{
return this.optional(a)||/^[a-zA-Z\-s\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF']{1,40}$/.test(b)
},a.Json[1]);
$.validator.addMethod("surname",function(b,a)
{
return this.optional(a)||/^[a-zA-Z\-s\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF']{1,40}$/.test(b)
},a.Json[2])
}
else
{
$.validator.addMethod("givenname",function(b,a)
{
return this.optional(a)||/^[a-zA-Z0-9-\s\.']{1,40}$/.test(b)
},a.Json[1]);
$.validator.addMethod("surname",function(b,a)
{
return this.optional(a)||/^[a-zA-Z0-9-\s\.']{1,40}$/.test(b)
},a.Json[2])
}
$.validator.addMethod("nectarid",function(b,a)
{
return this.optional(a)||/^[0-9]{11}$/.test(b.replace(/[^0-9]/g,""))
},a.Json[4]);
var b=$("#form1").validate({rules:{apsgender:"required",givenname:$("#miscid").length>0?"required givenname":"required",surname:$("#miscid").length>0?"required surname":"required",email:"required email",miscid:"required nectarid"},messages:{apsgender:$("#miscid").length>0?" * "+a.Json[5]+" "+$("#genderlabel").html():" * "+a.Json[0],givenname:$("#miscid").length>0?{required:" * "+a.Json[5]+" "+$("#givennamelabel").html(),givenname:" * "+a.Json[1]}:" * "+a.Json[1],surname:$("#miscid").length>0?{required:" * "+a.Json[5]+" "+$("#surnamelabel").html(),surname:" * "+a.Json[2]}:" * "+a.Json[2],email:$("#miscid").length>0?{required:" * "+a.Json[5]+" "+$("#emaillabel").html(),email:" * "+a.Json[3]}:" * "+a.Json[3],miscid:$("#miscid").length>0?{required:" * "+a.Json[5]+" "+$("#miscidlabel").html(),miscid:" * "+a.Json[4]}:" * "+a.Json[4]},errorPlacement:function(b,a)
{
if(a.is(":radio"))
{
a="#gender_ms";
b.insertAfter(a)
}
else
b.insertAfter(a)
},highlight:function(a,b)
{
if($(a).attr("type")=="radio")
$(a.form).find("input[type=radio]").each(function()
{
$(a.form).find("input[for="+this.name+"]").addClass(b);
$(this).addClass(b)
});
else
{
$(a.form).find("input[name="+a.name+"]").addClass(b);
$(a).addClass(b)
}
},unhighlight:function(a,b)
{
if($(a).attr("type")=="radio")
$(a.form).find("input[type=radio]").each(function()
{
$(a.form).find("input[for="+this.name+"]").removeClass(b);
$(this).removeClass(b)
});
else
{
$(a.form).find("input[name="+a.name+"]").removeClass(b);
$(a).removeClass(b)
}
}});
if(b.form())
a.ErrorMessage&&
alert(a.ErrorMessage)
}
apsregBtnClickGo=true
},error:function()
{
apsregBtnClickGo=true
}})
},
b=function()
{
var b=/^((([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-zA-Z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
c=true,
f=$("#apssurname").val(),
e=$("#apsgivenname").val(),
a=$("#apsemail").val(),
d=$("input:radio:checked").val();
(a==""||b.test(a)==false)&&
$("#apsemail").addClass("error");
e==""&&
$("#apsgivenname").addClass("error");
f==""&&
$("#apssurname").addClass("error");
d==""&&
$("#apsgender").addClass("error");
return c
};
$(function()
{
$("#apsemail,.siq-email-class, input[type='email']").keydown(function(a)
{
if(a.keyCode==32)
return false
});
$("#apsregister").click(function(b)
{
b.preventDefault();
if(apsregBtnClickGo==true)
{
apsregBtnClickGo=false;
a()
}
})
})
}(),
apsregBtnClickGo=true


var RegisterDOI=function()
{
var b=function()
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/RegistrationDOI",{verb:"POST",data:{maritalStatusSelect:$("#maritalStatusSelect").val(),education:$("#education").val(),employment:$("#employment").val(),dateofbirth1month:$("#dateofbirth1month").val(),dateofbirth1days:$("#dateofbirth1days").val(),dateofbirth1year:$("#dateofbirth1year").val(),gender1:$("#gender1").val(),dateofbirth2month:$("#dateofbirth2month").val(),dateofbirth2days:$("#dateofbirth2days").val(),dateofbirth2year:$("#dateofbirth2year").val(),gender2:$("#gender2").val(),dateofbirth3month:$("#dateofbirth3month").val(),dateofbirth3days:$("#dateofbirth3days").val(),dateofbirth3year:$("#dateofbirth3year").val(),gender3:$("#gender3").val(),dateofbirth4month:$("#dateofbirth4month").val(),dateofbirth4days:$("#dateofbirth4days").val(),dateofbirth4year:$("#dateofbirth4year").val(),gender4:$("#gender4").val(),dateofbirth5month:$("#dateofbirth5month").val(),dateofbirth5days:$("#dateofbirth5days").val(),dateofbirth5year:$("#dateofbirth5year").val(),gender5:$("#gender5").val(),url:document.location.href,redirectUrl:"/Secured/Action/Welcome",guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.ErrorMessage);
apsregBtnClickGo=true
},error:function()
{
apsregBtnClickGo=true
}})
};
function a()
{
var a=$("#form1").valid();
if(a==true)
validForm=true
}
$(function()
{
$("#doiregister").click(function(c)
{
$("#form1").validate();
a();
c.preventDefault();
if(apsregBtnClickGo==true&&validForm==true)
{
apsregBtnClickGo=false;
b()
}
})
})
}(),
validForm=false,
apsregBtnClickGo=true


var TerminateReward=function()
{
var b=function(a)
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/DonateToCharity",{verb:"POST",data:{charityID:a,entityID:QueryStringRequest("entity_id"),pw:QueryStringRequest("pw"),termRewardID:$("#apstermrewardid").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.Json);
donateClickGo=true
},error:function(a)
{
alert(a.statusText);
donateClickGo=true
}})
},
a=function()
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/PlayInstantWin",{verb:"POST",data:{termRewardID:$("#apstermrewardid").val(),entityID:QueryStringRequest("entity_id"),pw:QueryStringRequest("pw"),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.Json);
playClickGo=true
},error:function(a)
{
alert(a.statusText);
playClickGo=true
}})
};
$(function()
{
$(".donate").click(function(a)
{
a.preventDefault();
if(donateClickGo==true)
{
donateClickGo=false;
b($(this).attr("name"))
}
});
$("#play").click(function(b)
{
b.preventDefault();
if(playClickGo==true)
{
playClickGo=false;
if($.trim($("#GiantSourceGamePage").text())!="")
eval($("#GiantSourceGamePage").text());
else
a()
}
});
$("#playSecondGame").click(function(b)
{
b.preventDefault();
if(playClickGo==true)
{
playClickGo=false;
if($.trim($("#SecondGiantSourceGamePage").text())!="")
eval($("#SecondGiantSourceGamePage").text());
else
a()
}
})
})
}(),
donateClickGo=true,
playClickGo=true


var Unsubscribe=function()
{
var a=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/Unsubscribe",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
if($("#unsubscribe-success-message").html())
{
$.modal.close();
setTimeout(function()
{
$.modal("<div id='unsubscribe-modal'>"+$("#unsubscribe-success-message").html()+"</div>",{onClose:function()
{
eval(a.JavaScript)
},containerId:"unsubscribe-modal-container",dataId:"unsubscribe-modal-data",dataCss:{},closeClass:"modal-close",overlayClose:true,autoResize:true,opacity:90})
},20)
}
else
eval(a.JavaScript);
else
alert(a.ErrorMessage);
apsUnBtnClickGo=true
},error:function()
{
apsUnBtnClickGo=true
}})
},
c=function()
{
var a=$("#entity_Id").val();
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/saveProfileSettings",{verb:"POST",data:{entity_id:a,selectedOptionsList:"RP_Avail",selectedValuesList:$("#amount").val()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
return;
else
if($("#JSProfileSettingsWasNotSaved").val()!=null)
alert($("#JSProfileSettingsWasNotSaved").val());
else
alert("Profile Setting Not Saved.");
apsUnBtnClickGo=true
},error:function()
{
apsUnBtnClickGo=true
}})
},
b=function(b)
{
var a=$("#entity_Id").val();
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/saveProfileSettings",{verb:"POST",data:{entity_id:a,selectedOptionsList:"ON_Avail",selectedValuesList:b},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
return;
else
alert(a.ErrorMessage);
apsUnBtnClickGo=true
},error:function()
{
apsUnBtnClickGo=true
}})
};
$(function()
{
if($("#slider-div").html())
{
var d=document.getElementById("slider-range-min");
if(d!="undefined"&&d!=null)
{
var e=d.options[d.selectedIndex];
$("#amount").val(e.value)
}
$("select").each(function(h,a)
{
$(a).addClass("sliderOn");
var b=$("<div class=\"sliderHolder\"><div class='horizontalSlider'></div></div>").insertAfter(a).find(".horizontalSlider").slider({min:1,max:a.options.length,range:"min",value:a.selectedIndex+1,slide:function(d,b)
{
a.selectedIndex=b.value-1;
$("#amount").val(a.options[a.selectedIndex].value);
c()
},stop:function()
{
$(a).change()
}}),
d=[];
for(var g in $(a).children())
!isNaN(parseInt(g))&&
d.push(a.options[g].text);
var e=b.width()/(d.length-1);
b.after('<div class="slider-legend"><p style="width:'+e/2+'px;text-align:left;">'+d.join('</p><p style="width:'+e+'px;">')+"</p></div>").parent().find(".slider-legend p:last-child").css("width",e/2).css("text-align","right");
var f=b.parent().find(".slider-legend p:last-child");
f[0].clientWidth<f[0].scrollWidth&&
b.parent().find(".slider-legend p").css("text-indent","200%")
})
}
$("#nlCheckbox").click(function()
{
if($("#nlCheckbox").attr("checked"))
b("0");
else
b("1")
});
$("#apsunsubscribesurveyoption").click(function(a)
{
a.preventDefault();
$("#unsubscribePage2").modal({containerId:"unsubscribe-survey-modal-container",width:600,autoResize:true,closeClass:"modal-close",overlayClose:true,opacity:90})
});
$("#apsunsubscribe").click(function(c)
{
c.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
var b=confirm($("#unsubscribe-sure-message").html());
if(b==true)
a();
else
apsUnBtnClickGo=true
}
});
$("#apsunsubscribe1").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
a()
}
});
$("#apsunsubscribe2").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
a()
}
});
$("#panelunsubscribe-noconfirm").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
a()
}
});
$("#panelunsubscribesurvey-noconfirm").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
a()
}
});
$("#panelunsubscribeaftersurvey-noconfirm").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
a()
}
})
})
}(),
apsUnBtnClickGo=true,
apsUnSvyBtnClickGo=true


var RewardClaimPhoneValidation=function()
{
var a=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/RewardClaimPhoneValidation",{verb:"POST",data:{phonenumber:$("#phonenumber").val(),guid:currentItem,entityId:$("#entityId").val(),checkGuid:$("#checkGuid").val()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
$("#phoneValidate").addClass("hideme");
$("#pinSent").removeClass("hideme");
a.Json&&
$("#checkGuid").val(a.Json)
}
else
{
alert(a.ErrorMessage);
if(a.JavaScript)
{
eval(a.JavaScript);
return false
}
}
apsloBtnClickGo=true
},error:function()
{
apsloBtnClickGo=true
}})
},
c=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/RewardClaimPinValidation",{verb:"POST",data:{pinnumber:$("#pinnumber").val(),guid:currentItem,entityId:$("#entityId").val(),checkGuid:$("#checkGuid").val()},success:function(c)
{
var a=JSON.parse(c.d);
if(a.Success==true)
eval(a.JavaScript);
else
if(a.Json)
{
var b=a.Json;
if(b[0]=="NoMatch")
{
$("#checkGuid").val(b[1]);
alert(a.ErrorMessage)
}
else
{
alert(a.ErrorMessage);
if(a.JavaScript)
eval(a.JavaScript);
return false
}
}
else
{
alert(a.ErrorMessage);
if(a.JavaScript)
eval(a.JavaScript);
return false
}
apsloBtnClickGo=true
},error:function()
{
apsloBtnClickGo=true
}})
},
d=function()
{
if($("#rcpv-radio-item2").is(":checked"))
if(!$("#rcpvIAgreeCheckbox").is(":checked"))
{
apsloBtnClickGo=true;
$("#rcpvIAgreeCheckboxError").show();
return false
}
var a=eval($("#regexValidation").html());
if(typeof a!="undefined")
{
var b=$("#form1").validate({rules:{contactmethod:"required",phonenumber:"required phone"},messages:{contactmethod:$("#requiredFieldError").html(),phonenumber:$("#invalidFormatError").html()}});
$.validator.addMethod("phone",function(c,b)
{
return this.optional(b)||a.test(c)
},"test")
}
else
var b=$("#form1").validate({rules:{contactmethod:"required",phonenumber:"required"},messages:{contactmethod:$("#requiredFieldError").html(),phonenumber:$("#requiredFieldError").html()}});
if(!b.form())
{
apsloBtnClickGo=true;
return false
}
return true
},
b=function()
{
var a=$("#form1").validate({rules:{pinnumber:"required"},messages:{pinnumber:$("#requiredFieldError").html()}});
if(!a.form())
{
apsloBtnClickGo=true;
return false
}
return true
};
$(function()
{
$("#rewardclaimvalidate").click(function(b)
{
b.preventDefault();
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
d()==true&&
a()
}
})
});
$(function()
{
$("#pinvalidate").click(function(a)
{
a.preventDefault();
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
b()==true&&
c()
}
});
$("#rcpv-radio-item1,#rcpv-radio-item2").click(function()
{
if($("#rcpv-radio-item2").is(":checked"))
$("#rcpv-disclaimer").show();
else
$("#rcpv-disclaimer").hide()
});
$("#rcpvIAgreeCheckbox").click(function()
{
$("#rcpvIAgreeCheckboxError").hide()
})
})
}(),
apsloBtnClickGo=true


var ChangeNectarID=function()
{
var b=function()
{
$.ajaxDotNet("/app_services/aps/secured/securedservices.asmx/ChangeNectarID",{verb:"POST",data:{newnectarid:$("#newnectarid").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
$("#changeNectarID").html(a.Json);
else
{
$("#customMessages").html(a.ErrorMessage);
$("#customMessages").removeClass("hideme");
$("#customMessages").addClass("error");
return
}
cmidBtnClickGo=true
},error:function()
{
cmidBtnClickGo=true
}})
},
a=function()
{
var a=true,
b=true,
d=$("#newnectarid").val(),
c=$("#confirmnectarid").val();
if(d!=c)
{
$("#customMessages").text($("#cmiddonotmatch").html());
$("#customMessages").removeClass("hideme");
$("#customMessages").addClass("error");
b=false
}
else
{
$("#customMessages").removeClass("error");
$("#customMessages").addClass("hideme")
}
$.validator.addMethod("nectarid",function(b,a)
{
return this.optional(a)||/^[0-9]{11}$/.test(b)
},$("#cmidvalidationfailed").html());
var e=$("#form1").validate({rules:{newnectarid:"required nectarid",confirmnectarid:"required nectarid"},messages:{newnectarid:" * "+$("#cmidvalidationfailed").html(),confirmnectarid:" * "+$("#cmidvalidationfailed").html()}});
if(e.form())
if(b)
a=true;
else
a=false;
else
a=false;
return a
};
$(function()
{
$("#cmidsavebutton").click(function(c)
{
c.preventDefault();
if(cmidBtnClickGo==true)
{
cmidBtnClickGo=false;
a()==true&&
b();
cmidBtnClickGo=true
}
})
})
}(),
cmidBtnClickGo=true


var HerculesHelpDesk=function()
{
var o=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/EditMember",{verb:"POST",data:{firstName:$("#editMemberFirstName"+editMemberID).val(),lastName:$("#editMemberLastName"+editMemberID).val(),position:$("#editMemberPosition"+editMemberID).val(),gender:gender,birthdate:$("#editMemberBirthdate"+editMemberID).val(),email:$("#editMemberEmail"+editMemberID).val(),optInEmail:optInEmail,regularPresence:regularPresence,entityID:editMemberID,householdID:$("#householdID").html()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
hercupBtnClickGo=true
},error:function(a)
{
alert(a.toString());
hercupBtnClickGo=true
}})
},
c=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/AddStore",{verb:"POST",data:{store:storeName,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.Json);
eval(a.JavaScript)
}
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true;
storeName="";
hercupBtnClickGo=true
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true;
storeName="";
hercupBtnClickGo=true
}})
},
i=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/DeleteStore",{verb:"POST",data:{storeID:storeID,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
herculesAbsencesSubmitButtonGo=true;
storeID="";
eval(a.JavaScript);
document.body.style.cursor="default"
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true;
storeID="";
document.body.style.cursor="default"
}})
},
b=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/RequestAnOrder",{verb:"POST",data:{ancillary:$("#herculesAncillary").val(),quantity:$("#herculesRequestAnOrderQuantity").val(),comment:$("#herculesRequestAnOrderComment").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true
}})
},
j=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/RequestAnOrderUK",{verb:"POST",data:{ancillary:orderType,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
}})
},
k=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/CreateHelpDeskRequest",{verb:"POST",data:{comment:$("#herculesHelpDeskRequestComment").val(),guid:currentItem,emailTo:emailTo,subject:emailSubject,copyToPanelist:copyToPanelist},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.Json);
$("#herculesHelpDeskRequestComment").val("");
$("#contactUsSubject").val($("#contactUsSubject option:first").val());
$("#contactUsCopyToPanelist").attr("checked",false)
}
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true
}})
},
n=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/CreateStoreRequest",{verb:"POST",data:{storeName:storeName,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
}})
},
l=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/CreateStoreRequestUK",{verb:"POST",data:{storeName:storeName,storeType:storeType,storeAddressLine1:storeAddressLine1,storeAddressLine2:storeAddressLine2,storeTown:storeTown,storePostalCode:storePostalCode,addToFavoriteStores:addToFavoriteStores,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.Json);
eval(a.JavaScript)
}
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default"
}})
},
g=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/CreateVacationOrScannerBreakdownRequest",{verb:"POST",data:{vacationStartDate:$("#herculesVacationStartDate").val(),vacationEndDate:$("#herculesVacationEndDate").val(),scannerBreakdownStartDate:$("#herculesScannerBreakdownStartDate").val(),scannerBreakdownEndDate:$("#herculesScannerBreakdownEndDate").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true
}})
},
f=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/CreateVacationOrScannerBreakdownRequestUK",{verb:"POST",data:{vacationStartDate:$("#herculesVacationStartDate").val(),vacationEndDate:$("#herculesVacationEndDate").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
herculesAbsencesSubmitButtonGo=true
},error:function(a)
{
alert(a.toString());
herculesAbsencesSubmitButtonGo=true
}})
},
h=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/ContactUsRequest",{verb:"POST",data:{to:$("#mobileScanContactUsEmailTo").html(),from:$("#mobileScanContactUsEmailFrom").val(),subject:$("#mobileScanContactUsSubject").val(),body:$("#mobileScanContactUsMessage").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apspwsBtnClickGo=true
},error:function(a)
{
alert(a.toString());
apspwsBtnClickGo=true
}})
},
a=function()
{
var a=true,
c=/^\d{1,}$/,
b=$("#herculesRequestAnOrderQuantity").val();
if(b==""||c.test(b)==false)
{
$("#herculesRequestAnOrderQuantity").addClass("error");
a=false
}
return a
},
m=function()
{
var a=true,
b=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,
c=$("#mobileScanContactUsEmailFrom").val(),
d=$("#mobileScanContactUsSubject").val(),
e=$("#mobileScanContactUsMessage").val();
if(d=="")
{
alert($("#mobileScanContactUsInvalidSubjectMessage").html());
a=false
}
else
if(e=="")
{
alert($("#mobileScanContactUsInvalidBodyMessage").html());
a=false
}
else
if(b.test(c)==false)
{
alert($("#mobileScanContactUsInvalidEmailMessage").html());
a=false
}
return a
},
e=function()
{
var f=true,
a=$("#herculesVacationStartDate").val(),
b=$("#herculesVacationEndDate").val(),
c=$("#herculesScannerBreakdownStartDate").val(),
d=$("#herculesScannerBreakdownEndDate").val(),
e=/^\d{4}\/\d{2}\/\d{2}$/;
if(a!="")
if(e.test(a)==false)
{
alert($("#invalidVacationStartDate").html());
return false
}
if(b!="")
if(e.test(b)==false)
{
alert($("#invalidVacationEndDate").html());
return false
}
if(c!="")
if(e.test(c)==false)
{
alert($("#invalidScannerBreakdownStartDate").html());
return false
}
if(d!="")
if(e.test(d)==false)
{
alert($("#invalidScannerBreakdownEndDate").html());
return false
}
if(a==""&&b!="")
{
alert($("#invalidVacationStartDate").html());
return false
}
else
if(a!=""&&b=="")
{
alert($("#invalidVacationEndDate").html());
return false
}
else
if(c==""&&d!="")
{
alert($("#invalidScannerBreakdownStartDate").html());
return false
}
else
if(a==""&&b==""&&c==""&&d=="")
{
alert($("#invalidData").html());
return false
}
return true
},
d=function()
{
var d=true,
a=$("#herculesVacationStartDate").val(),
b=$("#herculesVacationEndDate").val(),
c=/^\d{4}\/\d{2}\/\d{2}$/;
if(a!="")
if(c.test(a)==false)
{
alert($("#invalidVacationStartDate").html());
return false
}
if(b!="")
if(c.test(b)==false)
{
alert($("#invalidVacationEndDate").html());
return false
}
if(a==""&&b!="")
{
alert($("#invalidVacationStartDate").html());
return false
}
else
if(a!=""&&b=="")
{
alert($("#invalidVacationEndDate").html());
return false
}
else
if(a==""&&b=="")
{
alert($("#invalidData").html());
return false
}
return true
};
$(function()
{
$("#herculesRequestAnOrder").click(function(d)
{
d.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
var c=a();
c==true&&
b();
c==false&&
alert($("#quantityInvalidMessage").html());
herculesAbsencesSubmitButtonGo=true
}
});
$("#herculesRequestAnOrderUK").click(function(b)
{
b.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
document.body.style.cursor="wait";
if($("#herculesAncillary").val()=="Other")
{
var a=$("#herculesStoreTypeSpecify").val();
if(a.length==0)
{
alert($("#SpecifyTypeRequired").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
orderType=$("#herculesAncillary").val()+":"+a
}
else
orderType=$("#herculesAncillary :selected").attr("value");
j()
}
});
$("#herculesRequestAnOrderQuantity").keypress(function(c)
{
var d=c.keyCode?c.keyCode:c.which;
if(d==13)
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
if(a()==true)
b.call();
else
alert($("#quantityInvalidMessage").html());
herculesAbsencesSubmitButtonGo=true
}
});
$("#herculesHelpDeskRequest").click(function(a)
{
a.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
copyToPanelist=$("#contactUsCopyToPanelist").is(":checked");
emailTo=$("#contactUsEmail").val();
emailSubject=$("#contactUsSubject").val();
k()
}
});
$("#herculesStoreRequest").click(function(a)
{
a.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
n()
}
herculesAbsencesSubmitButtonGo=true
});
$("#herculesAbsencesAndEquivalencesSubmit").click(function(a)
{
a.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
e()&&
g();
herculesAbsencesSubmitButtonGo=true
}
});
$("#herculesAbsencesAndEquivalencesSubmitUK").click(function(a)
{
a.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
d()&&
f();
herculesAbsencesSubmitButtonGo=true
}
});
$("#mobileScanContactUsSubmit").click(function(b)
{
b.preventDefault();
if(apspwsBtnClickGo==true)
{
apspwsBtnClickGo=false;
var a=m();
a==true&&
h();
apspwsBtnClickGo=true
}
});
$("#herculesAddFavoriteStore").click(function()
{
$("#favoriteStoreTable").addClass("hideme");
$("#favoritesHeader").addClass("hideme");
$("#herculesAddFavoriteStore").addClass("hideme");
$("#storeTable").removeClass("hideme");
$("#storeHeader").removeClass("hideme")
});
$("#searchSubmit").click(function(a)
{
a.preventDefault();
if($("#searchBox").val()!=""&&$("#searchBox").val()!=searchBoxDefaultText)
window.location="/secured/search.aspx?search="+$("#searchBox").val()
});
$("#searchBox").click(function(a)
{
a.preventDefault();
searchBoxDefaultText==$("#searchBox").val()&&
$("#searchBox").val("")
});
$("#searchBox").keydown(function(a)
{
if(a.keyCode==13)
{
a.preventDefault();
$("#searchSubmit").click()
}
});
$("#storeTable td").click(function()
{
if(hercupBtnClickGo==true)
{
hercupBtnClickGo=false;
var a=confirm($("#addStoreMessage").html());
if(a==true)
{
storeName=this.innerHTML;
c()
}
}
});
$("#favoriteStoreTable tr").hover(function()
{
var a=$(this).css("background","lightgray");
$(this).css("cursor","pointer");
$(this).find("td.favoriteStoreData").find("a").show()
},function()
{
$(this).css("background","");
$(this).css("cursor","default");
$(this).find("td.favoriteStoreData").find("a").hide()
});
$("#storeTable tr").hover(function()
{
$(this).css("background","lightgray");
$(this).css("cursor","pointer")
},function()
{
$(this).css("background","");
$(this).css("cursor","default")
});
$("#herculesStoreRequestStores td").click(function()
{
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
var a=confirm($("#addStoreMessage").html());
if(a==true)
{
storeName=$(this).attr("title");
document.body.style.cursor="wait";
c()
}
else
herculesAbsencesSubmitButtonGo=true
}
});
$("#herculesStoreRequestStores td").hover(function()
{
$(this).css("background","lightgray");
$(this).css("color","black");
$(this).css("cursor","pointer")
},function()
{
if($(this).attr("class")=="storeBlue")
$(this).css("background","#7A9FB9");
else
$(this).css("background","#DCEBF7");
$(this).css("color","");
$(this).css("cursor","default")
});
$("#editMembersTable tr").not(":first").hover(function()
{
$(this).css("background","lightgray");
$(this).css("cursor","pointer")
},function()
{
$(this).css("background","");
$(this).css("cursor","default")
});
$("#editMembersTable tr").click(function()
{
editMemberID=this.id;
$("#member_"+this.id).removeClass("hideme");
$("#editMembersContainer").addClass("hideme");
$("#editMemberSubmit").removeClass("hideme")
});
$("#editMemberSubmit").click(function()
{
if(hercupBtnClickGo==true)
{
hercupBtnClickGo=false;
if($("#editMemberMale"+editMemberID).attr("checked")==true)
gender="Male";
else
if($("#editMemberFemale"+editMemberID).attr("checked")==true)
gender="Female";
if($("#editMemberRegularPresence"+editMemberID).attr("checked")==true)
regularPresence="true";
else
regularPresence="false";
if($("#editMemberOptInEmail"+editMemberID).attr("checked")==true)
optInEmail="true";
else
optInEmail="false";
o();
hercupBtnClickGo=true
}
});
$(".favoriteStoresDelete").click(function()
{
if(herculesAbsencesSubmitButtonGo==true)
{
herculesAbsencesSubmitButtonGo=false;
var a=confirm($("#deleteStoreMessage").html());
if(a==true)
{
storeID=$(this).attr("name");
document.body.style.cursor="wait";
i()
}
else
herculesAbsencesSubmitButtonGo=true
}
});
$("#herculesPrintRewards").click(function()
{
var b="/Secured/MyRewards/Rewards-Print?month=",
a=$("#herculesRewardHistory option:selected").text();
window.open(b+a)
});
$("#herculesStoreRequestSubmit").click(function(a)
{
a.preventDefault();
window.location="/secured/Support-Center/Store-Request.aspx?search="+$("#herculesStoreRequestStoreName").val()+";"+$("#herculesStoreRequestAddress").val()+";"+$("#herculesStoreRequestCity").val()+";"+$("#herculesStoreRequestState").val()+";"+$("#herculesStoreRequestZipCode").val()
});
$("#herculesStoreRequestStoreNameUK").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().toUpperCase())
});
$("#herculesStoreRequestZipCodeUK").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().toUpperCase())
});
$("#herculesStoreRequestCityUK").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().replace(/\w\S*/g,function(a)
{
return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()
}))
});
$("#herculesStoreAddressLine1").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().replace(/\w\S*/g,function(a)
{
return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()
}))
});
$("#herculesStoreAddressLine2").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().replace(/\w\S*/g,function(a)
{
return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()
}))
});
$("#herculesStoreRequestAddressUK").keyup(function(a)
{
if(a.keyCode==9)
return;
$(this).val($(this).val().replace(/\w\S*/g,function(a)
{
return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()
}))
});
$("#herculesStoreSearchSubmitUK").click(function(a)
{
a.preventDefault();
storeName=$("#herculesStoreRequestStoreNameUK").val();
storeName=$.trim(storeName);
if(storeName.length==0&&$("#StoreNameMandatory").html()=="true")
{
alert($("#StoreNameRequired").html());
return
}
address=$("#herculesStoreRequestAddressUK").val();
address=$.trim(address);
city=$("#herculesStoreRequestCityUK").val();
city=$.trim(city);
if(city.length==0&&$("#StoreCityMandatory").html()=="true")
{
alert($("#StoreTownRequired").html());
return
}
window.location="/secured/Support-Center/Store-Request.aspx?search="+$("#herculesStoreRequestStoreNameUK").val()+";"+$("#herculesStoreRequestAddressUK").val()+";"+$("#herculesStoreRequestCityUK").val()+";;"+$("#herculesStoreRequestZipCodeUK").val()
});
$("#herculesStoreRequestAddressUK").keydown(function(a)
{
if(a.keyCode==13)
{
a.preventDefault();
$("#herculesStoreSearchSubmitUK").click()
}
});
$("#herculesStoreRequestCityUK").keydown(function(a)
{
if(a.keyCode==13)
{
a.preventDefault();
$("#herculesStoreSearchSubmitUK").click()
}
});
$("#herculesStoreRequestZipCodeUK").keydown(function(a)
{
if(a.keyCode==13)
{
a.preventDefault();
$("#herculesStoreSearchSubmitUK").click()
}
});
$("#herculesStoreRequestStoreNameUK").keydown(function(a)
{
if(a.keyCode==13)
{
a.preventDefault();
$("#herculesStoreSearchSubmitUK").click()
}
});
$("#herculesStoreRequestType").change(function()
{
var a=$("#herculesStoreRequestType").val();
if(a=="OTHER (Please specify)")
{
$("#herculesStoreTypeSpecify").show();
$("#pleaseSpecify").show()
}
else
{
$("#herculesStoreTypeSpecify").hide();
$("#pleaseSpecify").hide()
}
});
$("#contactUsSubject").change(function()
{
var a=$("#contactUsSubject :selected").attr("name"),
b=window.location.href.substring(0,window.location.href.indexOf("/Secured"));
if(a=="3"||a=="4")
window.open(b+"/Secured/faqs/scanning","_blank");
else
(a=="5"||a=="6")&&
window.open(b+"/Secured/faqs/gift-points","_blank")
});
$("#herculesAncillary").change(function()
{
var a=$("#herculesAncillary :selected").attr("name");
if(a=="Other")
{
$("#herculesStoreTypeSpecify").show();
$("#pleaseSpecify").show()
}
else
{
$("#herculesStoreTypeSpecify").hide();
$("#pleaseSpecify").hide()
}
});
$("#herculesStoreRequestSubmitUK").click(function(b)
{
b.preventDefault();
if(herculesAbsencesSubmitButtonGo==true)
{
document.body.style.cursor="wait";
herculesAbsencesSubmitButtonGo=false;
storeName=$("#herculesStoreRequestStoreNameUK").val();
if(storeName.length==0)
{
alert($("#StoreNameRequired").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
if($("#herculesStoreRequestType").length>0)
{
if($("#herculesStoreRequestType").val()=="OTHER (Please specify)")
{
var a=$("#herculesStoreTypeSpecify").val();
if(a.length==0)
{
alert($("#StoreTypeRequired").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
storeType=$("#herculesStoreRequestType").val()+":"+a
}
else
storeType=$("#herculesStoreRequestType").val();
if($("#herculesStoreRequestType").val()=="Please select...")
{
alert($("#StoreTypeRequired").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
}
else
storeType="";
storeAddressLine1=$("#herculesStoreAddressLine1").val();
if(storeAddressLine1.length==0)
{
alert($("#StoreAddressLine1Required").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
if($("#herculesStoreAddressLine2").length>0)
storeAddressLine2=$("#herculesStoreAddressLine2").val();
else
storeAddressLine2="";
storeTown=$("#herculesStoreRequestCityUK").val();
if(storeTown.length==0)
{
alert($("#StoreTownRequired").html());
herculesAbsencesSubmitButtonGo=true;
document.body.style.cursor="default";
return
}
if($("#herculesStoreRequestZipCodeUK").length>0)
storePostalCode=$("#herculesStoreRequestZipCodeUK").val();
else
storePostalCode="";
if($("#addToFavoriteStores").length>0)
addToFavoriteStores=$("#addToFavoriteStores").is(":checked");
else
addToFavoriteStores=false;
l()
}
});
$("#herculesNewStoreRequestUK").click(function(a)
{
a.preventDefault();
window.location="/secured/Support-Center/Store-Request.aspx?search="+$("#herculesStoreRequestStoreNameUK").val()+";"+$("#herculesStoreRequestAddressUK").val()+";"+$("#herculesStoreRequestCityUK").val()+";;"+$("#herculesStoreRequestZipCodeUK").val()+";true"
})
})
}(),
herculesAbsencesSubmitButtonGo=true,
storeName="",
storeType="",
storeAddressLine1="",
storeAddressLine2="",
storeTown="",
storePostalCode="",
address="",
city="",
editMemberID="",
gender="",
regularPresence="",
optInEmail="",
searchBoxDefaultText="Search",
storeID="",
orderType="",
copyToPanelist=false,
emailTo="",
emailSubject="",
addToFavoriteStores=false


var HerculesLogin=function()
{
var l=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/GetCityLevelGeoData",{verb:"POST",dataType:"json",data:{parentCode:$("#hercprovince").val()},success:function(b)
{
hercloBtnClickGo=true;
var a=JSON.parse(b.d);
$("#herccity>option").remove();
$.each(a.Json,function(b,a)
{
$cities.append('<option value="'+a.Code+'">'+a.NameLocal+"</option>")
});
$districts=$("#hercdistrict");
d()
},error:function()
{
hercloBtnClickGo=true
}})
},
d=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/GetDistrictLevelGeoData",{verb:"POST",dataType:"json",data:{parentCode:$("#herccity").val()},success:function(b)
{
hercupBtnClickGo=true;
var a=JSON.parse(b.d);
$("#hercdistrict>option").remove();
$.each(a.Json,function(b,a)
{
$districts.append('<option value="'+a.Code+'">'+a.NameLocal+"</option>")
})
},error:function()
{
hercupBtnClickGo=true
}})
},
a=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/HerculesLogin",{verb:"POST",data:{user:$("#herculesusername").val(),password:$("#herculespassword").val(),redirectUrl:QueryStringRequest("redirecturl"),guid:currentItem,timeZoneOffset:(new Date).getTimezoneOffset()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
eval(a.JavaScript);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
apsloBtnClickGo=true
},error:function()
{
apsloBtnClickGo=true;
document.body.style.cursor="default"
}})
},
q=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/UpdateProfile",{verb:"POST",data:{entityid:$("#hercentityid").val(),addressLine1:$("#hercaddressline1").val(),addressLine2:$("#hercaddressline2").val(),postcode:$("#hercpostcode").val(),province:$("#hercprovince :selected").text(),city:$("#herccity :selected").text(),district:$("#hercdistrict :selected").text(),landlinePhone:$("#herclandline").val(),alternativePhone:$("#hercalternatelandline").val(),mobilePhone:$("#hercMobilePhone").val(),guid:currentItem,email:$("#herculesProfileEmail").val(),alternateEmail:$("#herculesProfileAlternateEmail").val(),language:$("#herculesProfileLanguage").val(),notification:herculesProfileReveiveEmails},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.Json);
hercupBtnClickGo=true
},error:function(a)
{
alert(a);
hercupBtnClickGo=true
}})
},
j=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/UpdateProfileWithName",{verb:"POST",data:{entityid:$("#myProfileEntityID").val(),title:$("#myProfileTitle").val(),firstName:$("#myProfileFirstName").val(),lastName:$("#myProfileLastName").val(),addressLine1:$("#myProfileAddressline1").val(),addressLine2:$("#myProfileAddressline2").val(),addressLine3:$("#myProfileAddressLine3").val(),addressLine4:$("#myProfileAddressLine4").val(),addressLine5:$("#myProfileAddressLine5").val(),postcode:$("#myProfilePostCode").val(),landlinePhone:$("#myProfileLandline").val(),mobilePhone:$("#myProfileMobilePhone").val(),guid:currentItem,email:$("#myProfileEmail").val()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.Json);
hercupBtnClickGo=true
},error:function(a)
{
alert(a);
hercupBtnClickGo=true
}})
},
u=function()
{
$.ajaxDotNet("/app_services/aps/public/publicservices.asmx/RequestPassword",{verb:"POST",data:{user:$("#herculesusernamerequest").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apspwhBtnClickGo=true
},error:function()
{
apspwhBtnClickGo=true
}})
},
o=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/HerculesChangePassword",{verb:"POST",data:{password:$("#apscurrentpassword").val(),newpassword:$("#apsnewpassword").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
$("#apscurrentpassword").val("");
$("#apsnewpassword").val("");
$("#apsconfirmnewpassword").val("");
alert(a.Json);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
apspwsBtnClickGo=true
},error:function()
{
apspwsBtnClickGo=true;
document.body.style.cursor="default"
}})
},
r=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/WeakPassword",{verb:"POST",data:{password:$("#apscurrentpassword").val(),newpassword:$("#apsnewpassword").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
eval(a.JavaScript);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
apspwsBtnClickGo=true
},error:function()
{
apspwsBtnClickGo=true;
document.body.style.cursor="default"
}})
},
p=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/WeakPasswordUK",{verb:"POST",data:{password:password,newpassword:confirmPassword,securityQuestion:securityQuestion,securityAnswer:securityAnswer,guid:currentItem,weakPassword:weakPassword,securityQuestionRequest:securityQuestionRequest},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
eval(a.JavaScript);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
apspwsBtnClickGo=true
},error:function()
{
apspwsBtnClickGo=true;
document.body.style.cursor="default"
}})
},
m=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/HerculesNewPassword",{verb:"POST",data:{panelistID:$("#herculesPanelistID").val(),zipCode:$("#herculesZipCode").val(),password:$("#herculesPassword").val(),guid:currentItem,securityQuestion:$("#herculesSecurityQuestion").val(),securityAnswer:$("#herculesSecurityAnswer").val()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
eval(a.JavaScript);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
hercloBtnClickGo=true
},error:function(a)
{
alert(a.toString());
hercloBtnClickGo=true;
document.body.style.cursor="default"
}})
},
k=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/HerculesNewPassword",{verb:"POST",data:{panelistID:$("#herculesPanelistID").val(),zipCode:"",password:$("#herculesPassword").val(),guid:currentItem,securityQuestion:$("#herculesSecurityQuestion").val(),securityAnswer:$("#herculesSecurityAnswer").val()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.Json);
document.body.style.cursor="default"
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default"
}
hercloBtnClickGo=true
},error:function(a)
{
alert(a.toString());
hercloBtnClickGo=true;
document.body.style.cursor="default"
}})
},
t=function()
{
var a=true,
c=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
b=$("#herculesusernamerequest").val();
if(b==""||c.test(b)==false)
{
$("#herculesusernamerequest").addClass("error");
a=false
}
return a
},
b=function()
{
var a=true,
d=$("#apscurrentpassword").val(),
c=$("#apsnewpassword").val(),
b=$("#apsconfirmnewpassword").val();
if(c!=b)
{
$("#apsnewpassword").addClass("error");
$("#apsconfirmnewpassword").addClass("error");
alert($("#passwordsDontMatchMessage").html());
a=false
}
return a
},
h=function()
{
var a=true;
if($("#firstLoginCheckbox").length!=0)
if(!$("#firstLoginCheckbox").is(":checked"))
{
alert($("#checkboxNotChecked").html());
return false
}
var c=$("#herculesPassword").val(),
b=$("#herculesVerifyPassword").val(),
f=$("#herculesZipCode").val(),
d=$("#herculesPanelistID").val(),
e=$("#herculesSecurityQuestion").val(),
g=$("#herculesSecurityAnswer").val();
if(d==""||f==""||c==""||b==""||e==""||g=="")
{
alert($("#allFieldsRequired").html());
a=false
}
else
if(c!=b)
{
$("#herculesPassword").addClass("error");
$("#herculesVerifyPassword").addClass("error");
alert($("#passwordsMustMatch").html());
a=false
}
return a
},
g=function()
{
var a=true,
c=$("#herculesPassword").val(),
b=$("#herculesVerifyPassword").val(),
d=$("#herculesPanelistID").val(),
e=$("#herculesSecurityQuestion").val(),
f=$("#herculesSecurityAnswer").val();
if(d==""||c==""||b==""||e==""||f=="")
{
alert($("#allFieldsRequired").html());
a=false
}
else
if(c!=b)
{
$("#herculesPassword").addClass("error");
$("#herculesVerifyPassword").addClass("error");
alert($("#passwordsMustMatch").html());
a=false
}
return a
},
c=function()
{
var a=true,
d=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([\-\w]+\.)+[a-zA-Z]{2,5})|(([0-9]{1,3}\.){3}[0-9]{1,3}))\.?$/,
c=$("#herculesusername").val(),
b=$("#herculespassword").val();
if(c=="")
{
$("#herculesusername").addClass("error");
alert($("#herculesCheckUsernameAndPassword").html());
return false
}
if(b=="")
{
$("#herculespassword").addClass("error");
alert($("#herculesCheckUsernameAndPassword").html());
return false
}
return a
},
e=function()
{
return true
},
f=function()
{
$.ajaxDotNet("/app_services/other-websites/secured/securedservices.asmx/HerculesUnsubscribe",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.ErrorMessage);
apsUnBtnClickGo=true
},error:function()
{
apsUnBtnClickGo=true
}})
},
i=function(a)
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/PrivacyPolicyAccepted",{verb:"POST",data:{guid:currentItem,salesEffectAgree:salesEffectAgree?"true":"false",privacyPolicyAccepted:privacyPolicyAccepted?"true":"false",firstLogin:a?"true":"false",password:$("#herculesPassword").length>0?$("#herculesPassword").val():"",householdID:$("#herculesPanelistID").length>0?$("#herculesPanelistID").val():""},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
document.body.style.cursor="default";
hercloBtnClickGo=true;
eval(a.JavaScript)
}
else
{
alert(a.ErrorMessage);
document.body.style.cursor="default";
hercloBtnClickGo=true
}
},error:function()
{
document.body.style.cursor="default";
hercloBtnClickGo=true
}})
},
s=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/OptOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success)
eval(a.JavaScript);
else
alert(a.ErrorMessage)
},error:function()
{
}})
},
n=function()
{
var a=document.createElement("script");
a.setAttribute("type","text/javascript");
a.setAttribute("src","/App_Scripts/global/jquery.lightbox_me.js");
var b=document.getElementsByTagName("head")[0];
b.appendChild(a)
};
$(function()
{
n();
$("#herculesusername").keypress(function(b)
{
var d=b.keyCode?b.keyCode:b.which;
if(d==13)
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
if(c()==true)
{
document.body.style.cursor="wait";
a.call()
}
else
apsloBtnClickGo=true
}
});
$("#herculespassword").keypress(function(b)
{
var d=b.keyCode?b.keyCode:b.which;
if(d==13)
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
if(c()==true)
{
document.body.style.cursor="wait";
a.call()
}
else
apsloBtnClickGo=true
}
});
$("#herculeslogin").click(function(b)
{
b.preventDefault();
if(apsloBtnClickGo==true)
{
apsloBtnClickGo=false;
if(c()==true)
{
document.body.style.cursor="wait";
a.call()
}
else
apsloBtnClickGo=true
}
});
$("#herculesupdateprofile").click(function(a)
{
a.preventDefault();
if(hercupBtnClickGo==true)
{
hercupBtnClickGo=false;
if(e()==true)
q.call();
else
hercupBtnClickGo=true
}
});
$("#myProfileUpdateProfile").click(function(a)
{
a.preventDefault();
if(hercupBtnClickGo==true)
{
hercupBtnClickGo=false;
if(e()==true)
j.call();
else
hercupBtnClickGo=true
}
});
$("#herculesProfileNotification").click(function()
{
if(hercupBtnClickGo==true)
{
hercupBtnClickGo=false;
if(this.checked)
herculesProfileReveiveEmails="Yes";
else
herculesProfileReveiveEmails="No"
}
hercupBtnClickGo=true
});
$("#herculessavenewpwbutton").click(function(a)
{
a.preventDefault();
if(apspwsBtnClickGo==true)
{
apspwsBtnClickGo=false;
if(b()==true)
{
document.body.style.cursor="wait";
o()
}
apspwhBtnClickGo=true
}
});
$("#weakPasswordSaveButton").click(function(a)
{
a.preventDefault();
if(apspwsBtnClickGo==true)
{
apspwsBtnClickGo=false;
if(b()==true)
{
document.body.style.cursor="wait";
r()
}
apspwhBtnClickGo=true
}
});
$("#weakPasswordSaveButtonUK").click(function(a)
{
a.preventDefault();
if(apspwsBtnClickGo==true)
{
apspwsBtnClickGo=false;
if($("#weakPassword").html()=="true")
{
weakPassword="true";
if(b()==false)
return;
password=$("#apscurrentpassword").val();
confirmPassword=$("#apsnewpassword").val()
}
else
weakPassword="false";
if($("#securityQuestionRequest").html()=="true")
{
securityQuestionRequest="true";
securityQuestion=$("#herculesSecurityQuestion").val();
securityAnswer=$("#herculesSecurityAnswer").val()
}
else
securityQuestionRequest="false";
document.body.style.cursor="wait";
p();
apspwhBtnClickGo=true
}
});
$("#herculesFirstLoginSubmitButton").click(function(a)
{
a.preventDefault();
if(hercloBtnClickGo==true)
{
hercloBtnClickGo=false;
if(h())
{
document.body.style.cursor="wait";
m()
}
hercloBtnClickGo=true
}
});
$("#herculesFirstLoginSubmitButtonHK").click(function(a)
{
a.preventDefault();
if(hercloBtnClickGo==true)
{
hercloBtnClickGo=false;
if(g())
{
document.body.style.cursor="wait";
k()
}
hercloBtnClickGo=true
}
});
$("#herculesunsubscribe").click(function(b)
{
b.preventDefault();
if(apsUnBtnClickGo==true)
{
apsUnBtnClickGo=false;
var a=confirm($("#unsubscribe-sure-message").html());
a==true&&
f()
}
});
$("#hercprovince").change(function()
{
if(hercloBtnClickGo)
{
hercloBtnClickGo=false;
$cities=$("#herccity");
l()
}
});
$("#herccity").change(function()
{
if(hercupBtnClickGo)
{
hercupBtnClickGo=false;
$districts=$("#hercdistrict");
d()
}
});
$("#confirmationSubmit").click(function()
{
if(!hercloBtnClickGo)
return;
hercloBtnClickGo=false;
if($("#confirmationCheckboxLabel").is(":visible")&&!$("#confirmationCheckbox")[0].checked)
{
$("#confirmationError").show();
hercloBtnClickGo=true;
return
}
else
if($("#salesEffect").is(":visible")&&!salesEffectDecided)
{
$("#salesEffectError").show();
hercloBtnClickGo=true;
return
}
document.body.style.cursor="wait";
var a=$("#First-Login").length>0;
i(a)
});
$("#confirmationCheckbox").click(function()
{
if($("#confirmationCheckbox")[0].checked)
{
privacyPolicyAccepted=true;
$("#confirmationError").hide()
}
});
$("#salesEffectAgree").click(function()
{
salesEffectDecided=true;
salesEffectAgree=true;
$("#salesEffectError").hide()
});
$("#salesEffectDisagree").click(function()
{
salesEffectDecided=true;
salesEffectAgree=false;
$("#salesEffectError").hide()
});
$("#optOutLinkGeneral").click(function()
{
alert($("#optOutLinkMessage").html())
});
$("#optOutLinkSecured").click(function()
{
s()
})
})
}(),
hercloBtnClickGo=true,
hercupBtnClickGo=true,
apspwhBtnClickGo=true,
apspwsBtnClickGo=true,
herculesProfileReveiveEmails="Yes",
securityQuestion="",
securityAnswer="",
password="",
confirmPassword="",
weakPassword,
securityQuestionRequest,
salesEffectAgree=false,
salesEffectDecided=false,
privacyPolicyAccepted=false


var HerculesPasswordHint=function()
{
var b=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/GetSecurityQuestion",{verb:"POST",data:{panelistID:$("#herculesHomeScanUsernameRequest").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
$("#herculesRequestSecurityQuestion").val(a.Json);
$("#PanelIDTable").addClass("hideme");
$("#SecurityTable").removeClass("hideme");
apspwhBtnClickGo=true
},error:function()
{
apspwhBtnClickGo=true
}})
},
a=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/HomeScanRequestPassword",{verb:"POST",data:{user:$("#herculesHomeScanUsernameRequest").val(),securityQuestion:$("#herculesRequestSecurityQuestion").val(),securityAnswer:$("#herculesRequestSecurityAnswer").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apspwhBtnClickGo=true
},error:function()
{
apspwhBtnClickGo=true
}})
},
f=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/RequestPassword",{verb:"POST",data:{user:$("#herculesusernamerequest").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
alert(a.Json);
else
alert(a.ErrorMessage);
apspwhBtnClickGo=true
},error:function()
{
apspwhBtnClickGo=true
}})
},
d=function()
{
$.ajaxDotNet("/app_services/other-websites/public/publicservices.asmx/SetRememberMeCookie",{verb:"POST",data:{value:rememberMe},success:function()
{
apspwhBtnClickGo=true
},error:function(a)
{
alert(a.toString());
apspwhBtnClickGo=true
}})
},
e=function()
{
var a=true,
c=/^\d{10}$/,
b=$("#herculesusernamerequest").val();
if(b=="")
{
$("#herculesusernamerequest").addClass("error");
a=false
}
return a
},
c=function()
{
var a=true,
c=/^\d{10}$/,
b=$("#herculesHomeScanUsernameRequest").val();
if(b==""||c.test($.trim(b))==false)
{
$("#herculesHomeScanUsernameRequest").addClass("error");
a=false
}
return a
};
$(function()
{
$("#herculespasswordrequest").click(function(b)
{
b.preventDefault();
if(apspwhBtnClickGo==true)
{
apspwhBtnClickGo=false;
var a=e();
a==true&&
f();
a==false&&
alert($("#passwordhint-validation-message").html());
apspwhBtnClickGo=true
}
});
$("#herculesRememberMe").click(function()
{
if(apspwhBtnClickGo)
{
apspwhBtnClickGo=false;
if(this.checked)
rememberMe="true";
else
rememberMe="false";
d();
apspwhBtnClickGo=true
}
});
$("#herculesHomeScanPasswordRequest").click(function(d)
{
d.preventDefault();
if(apspwhBtnClickGo==true)
{
apspwhBtnClickGo=false;
var b=c();
b==true&&
a();
b==false&&
alert($("#passwordHintValidationMessage").html());
apspwhBtnClickGo=true
}
});
$("#herculesHomeScanNext").click(function()
{
if(apspwhBtnClickGo)
{
apspwhBtnClickGo=false;
if($("#herculesHomeScanUsernameRequest").val()!="")
b();
else
alert($("#passwordHintValidationMessage").html());
apspwhBtnClickGo=true
}
})
})
}(),
rememberMe="true"


var FacebookLogin=function()
{
var c=function(a)
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/FbLogin",{verb:"POST",data:{accessToken:a,url:document.location.href,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
document.cookie="FB_CheckUser=true; path=/";
document.cookie="FB_Status=true; path=/";
if($("#fbRedirectUrl").val()!="")
top.location.href=$("#fbRedirectUrl").val();
else
top.location.href="/"
}
else
$.modal.close()
},error:function()
{
}})
},
g=function(a)
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/FbLogin",{verb:"POST",data:{accessToken:a,url:document.location.href,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
window.location.reload();
else
alert("Error occured!")
},error:function()
{
}})
},
i=function()
{
$.ajaxDotNet("/app_services/aps/secured/SecuredServices.asmx/LogOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert(a.ErrorMessage);
FB_liBtnClickGo=true
},error:function()
{
FB_liBtnClickGo=true;
window.location="/"
}})
},
h=function()
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/FbRegistration",{verb:"POST",data:{firstName:$("#fbfirstname").val(),lastName:$("#fblastname").val(),cpid:QueryStringRequest("fbcpid"),userEmail:$("#fbUserEmail").val(),userGender:$("#fbUserGender").val(),url:document.location.href,redirectUrl:$("#fbRedirect").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
eval(a.JavaScript);
else
alert("We are sorry we were unable to complete the registration, please try again.")
},error:function()
{
alert("We are sorry we were unable to complete the registration, please try again.")
}})
},
f=function()
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/FbSyncAccount",{verb:"POST",data:{userEmail:$("#apsusername_fb").val(),userPassword:$("#apspassword_fb").val(),FbUserId:$("#fbUserId").val(),FbUserToken:$("#fbUserToken").val(),FbUserEmail:$("#fbUserEmail").val(),redirectUrl:$("#fbRedirect").val(),guid:currentItem},success:function(c)
{
var b=JSON.parse(c.d);
if(b.Success==true)
eval(b.JavaScript);
else
{
alert(b.ErrorMessage);
a.call();
eval(b.JavaScript)
}
},error:function()
{
alert("Error")
}})
},
b=function(a)
{
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/knownMemberSyncFb",{verb:"POST",data:{accessToken:a,redirectUrl:$("#fbRedirectUrl").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
if($("#fbPromptRewards").length>0)
if($("#fbRedirectUrl").val()!="")
top.location.href=$("#fbRedirectUrl").val();
else
top.location.href="/";
else
window.location.reload();
else
{
alert(a.ErrorMessage);
document.cookie="FB_Status=false; path=/";
document.cookie="FB_Alert=true; path=/";
document.cookie="FB_login=false; path=/";
$.ajaxDotNet("/app_services/aps/secured/SecuredServices.asmx/LogOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
top.location.href="/";
else
top.location.href=$("#fbRedirectUrl").val();
apsliBtnClickGo=true
},error:function()
{
apsliBtnClickGo=true
}})
}
},error:function(a)
{
alert("SysError: "+a)
}})
},
a=function()
{
document.cookie="FB_Status=false; path=/";
document.cookie="FB_login=false; path=/";
$.ajaxDotNet("/app_services/aps/secured/SecuredServices.asmx/LogOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
top.location.href="/";
else
top.location.href=$("#fbRedirectUrl").val();
apsliBtnClickGo=true
},error:function()
{
apsliBtnClickGo=true
}})
},
e=function()
{
IN.API.Profile("me").fields($("#liFields").val()).result(function(a)
{
d(a.values[0].id,a.values[0].emailAddress,a.values[0])
}).error(function()
{
alert("System Error!")
})
},
d=function(b,a,c)
{
$("#linkedin-login-button").hide();
$("#loadingmessage").show();
$.ajaxDotNet("/app_services/aps/public/PublicServices.asmx/knownMemberSyncLi",{verb:"POST",data:{memberId:b,email:a,profiles:c,redirectUrl:document.location.href,guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert(a.JavaScript);
window.location.reload()
}
else
{
alert(a.ErrorMessage);
document.cookie="LI_Alert=true; path=/";
$.ajaxDotNet("/app_services/aps/secured/SecuredServices.asmx/LogOut",{verb:"POST",data:{guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
top.location.href="/";
else
top.location.href=$("#fbRedirectUrl").val();
apsliBtnClickGo=true
},error:function()
{
apsliBtnClickGo=true
}})
}
},error:function()
{
}})
};
$(function()
{
$("#knownMemberSyncLi").click(function()
{
var a=$("#liPermissions").val();
IN.UI.Authorize().params({scope:a}).place();
IN.Event.on(IN,"auth",e)
});
var l=$("#fbRedirectUrl").val(),
j=$("#fbAppId").val(),
m=$("#fbUserId").val(),
k=$("#fbPermissions").val();
document.cookie="FB_Alert=false; path=/";
document.cookie="LI_Alert=false; path=/";
jQuery().easyTooltip&&
$("a#knownMemberSyncFb").easyTooltip({useElement:"item"});
jQuery().easyTooltip&&
$("a#knownMemberSyncLi").easyTooltip({useElement:"liitem"});
domainUrl=window.location.hostname;
if(domainUrl.match(/^www\./))
domainUrl=domainUrl.substring(4);
function d(b)
{
var c=new RegExp(b+"=([^;]+)"),
a=c.exec(document.cookie);
return a!=null?unescape(a[1]):null
}
if($("#fb-root").length>0)
{
window.fbAsyncInit=function()
{
FB.init({appId:j,version:"v2.0",channelUrl:"http://www."+domainUrl+"/App_Scripts/global/channel.html",status:true,cookie:true,xfbml:true});
FB.getLoginStatus(function(b)
{
if(b.status==="connected")
{
var c=b.authResponse.userID;
if(c!=""&&d("FB_login")=="true"&&$("#fbUserId").val()!="")
c!=$("#fbUserId").val()&&
a.call()
}
else
if(b.status==="not_authorized")
d("FB_login")=="true"&&
a.call();
else
d("FB_login")=="true"&&
a.call()
});
$("#fblogin, #fbloginBadge").click(function()
{
FB.login(function(a)
{
if(a.authResponse)
{
var b=a.authResponse.accessToken;
c(b)
}
},{scope:$("#fbPermissions").val()})
});
$("#fbloginBottom").click(function()
{
FB.login(function(a)
{
if(a.authResponse)
{
var b=a.authResponse.accessToken;
c(b)
}
},{scope:$("#fbPermissions").val()})
});
$("#nofbSession").click(function()
{
FB.login(function(a)
{
if(a.authResponse)
{
var b=a.authResponse.accessToken;
g(b)
}
},{scope:"email"})
});
$("#fbRegister").click(function()
{
h.call();
$(".facebook-login-button").html('<center>Loading<br/><img src="/App_Presentation/panel/OpinionWorld/DEFAULT/img/loading-img.gif" alt="" /></center>')
});
$("#fbSyncAccount").click(function()
{
f.call()
});
$("#knownMemberSyncFb").click(function()
{
FB.login(function(a)
{
if(a.authResponse)
{
var c=a.authResponse.accessToken;
document.cookie="FB_Status=true; path=/";
b(c)
}
else
alert("We are sorry there was a problem syncing your accounts.")
},{scope:"email"})
});
$("#knownMemberSyncFbPrompt, #knownMemberSyncFbPromptBadge").live("click",function()
{
FB.login(function(a)
{
if(a.authResponse)
{
var c=a.authResponse.accessToken;
document.cookie="FB_Status=true; path=/";
b(c)
}
else
alert("We are sorry there was a problem syncing your accounts.")
},{scope:$("#fbPermissions").val()})
});
$("#fblogout").click(function()
{
document.cookie="FB_Status=false; path=/";
document.cookie="FB_CheckUser=false; path=/";
document.cookie="FB_login=false; path=/";
i.call()
})
};
(function(b)
{
var a,
d="facebook-jssdk",
c=b.getElementsByTagName("script")[0];
if(b.getElementById(d))
return;
a=b.createElement("script");
a.id=d;
a.async=true;
a.src="//connect.facebook.net/en_US/sdk.js";
c.parentNode.insertBefore(a,c);
if($("#liAppId").val())
{
var f="linkedin-jssdk",
e=b.getElementsByTagName("head")[0];
js2=b.createElement("script");
js2.id=f;
js2.async=true;
js2.src="//platform.linkedin.com/in.js";
js2.text="api_key: "+$("#liAppId").val()+"\n authorize: true";
e.appendChild(js2)
}
})(document)
}
})
}(),
apsFbBtnClickGo=true


function createBadgesDialog(a)
{
$("#content-wrapper").hide();
$.modal("<div id='badges-modal'>"+a+"</div>",{onClose:function()
{
$("#content-wrapper").show();
$.modal.close()
},containerId:"badges-modal-container",dataId:"badges-modal-data",dataCss:{},closeClass:"modal-close",overlayClose:true,autoResize:true,opacity:90})
}


var MessageCenter=function()
{
var a=function()
{
$.ajaxDotNet("/app_services/other-websites/public/PublicServices.asmx/WriteMessageCenterLog",{verb:"POST",data:{guid:$("#"+messageItem).html(),panelistID:$("#messageCenterPanelistID").html(),typeID:$("#messageCenterTypeID").html()},success:function()
{
messageCenterItemClicked=false
},error:function()
{
messageCenterItemClicked=false
}})
};
$(function()
{
$(".panel-group li a").click(function()
{
window.open($(this).attr("href"),"_blank")
});
$(".panel-group li").toggle(function()
{
messageItem="messageCenterItem"+$(this).attr("value");
$(this).attr("style","font-weight:normal");
$(this).find(".toggleditemhide").show(function()
{
$(this).prev(".icon").attr("style","background-position: 0 -23px");
if(!messageCenterItemClicked)
{
messageCenterItemClicked=true;
a()
}
})
},function()
{
$(this).find(".toggleditemhide").hide(function()
{
$(this).prev(".icon").attr("style","background-position: 0 0")
})
})
})
}(),
messageCenterItemClicked,
messageItem


function showFacebookPrompt(b,a)
{
$(document).ready(function()
{
$("#content-wrapper").hide();
$.modal("<div id='fbprompt-modal'>"+b+"</div>",{onClose:function()
{
$("#content-wrapper").show();
if(a)
window.location=a;
$.modal.close()
},containerId:"fbprompt-modal-container",dataId:"fbprompt-modal-data",dataCss:{},closeClass:"modal-close",overlayClose:false,autoResize:true,opacity:90})
})
}


var MiniPolls=function()
{
var b=function()
{
var b=$("#ConfigId").val(),
a=$("#QuestionId").val();
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/submitPollAnswer",{verb:"POST",data:{configid:b,questionid:a,answervalue:$("input:radio:checked").val()?$("input:radio:checked").val():"",guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
window.location.reload();
else
alert(a.ErrorMessage)
},error:function()
{
}})
},
a=function()
{
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/SendSuggestion",{verb:"POST",data:{emailFromAddress:$("#miniPolls-email").val(),emailSubject:$("#miniPolls-email-subject").val(),emailBody:$("#miniPolls-email-body").val(),guid:currentItem},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
$.modal.close();
alert(a.Json)
}
else
alert(a.ErrorMessage);
buttonClicked=false
},error:function()
{
buttonClicked=false
}})
};
$(function()
{
$(window).load(function()
{
jQuery.extend(jQuery.validator.messages,{required:$("#msgFieldIsRequired").attr("value")});
$("#accordion").length&&
$("#accordion").accordion({heightStyle:"content"});
$("#submitPollAnswer").click(function()
{
$("#form1").validate({errorPlacement:function(a)
{
a.insertBefore($("#submitPollAnswer").parent())
}});
$("#form1").valid()&&
b()
});
$(".minipolls-suggestion-label").click(function()
{
$(".miniPolls-suggestion-form").modal({containerId:"modal-container",autoResize:true,width:500,closeClass:"modal-close",overlayClose:true,opacity:90})
});
$(".miniPolls-email-submit").click(function()
{
if(buttonClicked)
return;
buttonClicked=true;
a()
})
})
})
}(),
apsregBtnClickGo=true,
buttonClicked=false


var ProfileSettings=function()
{
$(document).ready(function()
{
$("#RestingPeriodValue").val()!=""&&
$(".notifications-schedule").html($("#notifications-options [value='"+$("#RestingPeriodValue").val()+"']").text());
$("#notifications-options [value='"+$("#RestingPeriodValue").val()+"']").attr("selected",true);
if(document.getElementById("restingperiod"))
{
if($("#RestingPeriodValue").length>0&&$("#restingperiod").length>0)
document.getElementById("restingperiod").checked=$("#RestingPeriodValue").val()=="0"?false:true;
if($("#OnlineExposureValue").length>0&&$("#onlineexposure").length>0)
document.getElementById("onlineexposure").checked=$("#OnlineExposureValue").val()=="0"?true:false;
if($("#OWNewsletterValue").length>0&&$("#ownewsletter").length>0)
document.getElementById("ownewsletter").checked=$("#OWNewsletterValue").val()=="0"?true:false;
if($("#InHomeUsageValue").length>0&&$("#inhomeusage").length>0)
document.getElementById("inhomeusage").checked=$("#InHomeUsageValue").val()=="0"?true:false;
if($("#FacetoFaceResearchValue").length>0&&$("#facetofaceresearch").length>0)
document.getElementById("facetofaceresearch").checked=$("#FacetoFaceResearchValue").val()=="0"?true:false;
if($("#SurveysOnMobileValue").length>0&&$("#surveysonmobile").length>0)
document.getElementById("surveysonmobile").checked=$("#SurveysOnMobileValue").val()=="0"?true:false;
if($("#restingperiod").length>0&&$("#notifications-options").length>0)
if(document.getElementById("restingperiod").checked)
{
document.getElementById("notifications-options").disabled=false;
document.getElementById("notifications-options").disabled=false
}
else
{
document.getElementById("notifications-options").disabled=true;
$("#notifications-options2 [value='0']").attr("selected",true)
}
}
});
var d=function()
{
var a=function()
{
var a="";
if($("#restingperiod").val()!=null&&$("#restingperiod").css("display")!="none")
a+="RP_Avail";
if($("#onlineexposure").val()!=null)
{
if(a.length>0)
a+="|";
a+="OE_Avail"
}
if($("#ownewsletter").val()!=null&&$("#ownewsletter").css("display")!="none")
{
if(a.length>0)
a+="|";
a+="ON_Avail"
}
if($("#inhomeusage").val()!=null)
{
if(a.length>0)
a+="|";
a+="IH_Avail"
}
if($("#facetofaceresearch").val()!=null)
{
if(a.length>0)
a+="|";
a+="FF_Avail"
}
if($("#surveysonmobile").val()!=null)
{
if(a.length>0)
a+="|";
a+="SM_Avail"
}
return a
},
b=function()
{
var f=$("#restingperiod").is(":checked")?$("#notifications-options").val():"0",
d=$("#onlineexposure").is(":checked")?"0":"1",
e=$("#ownewsletter").is(":checked")?"0":"1",
g=$("#inhomeusage").is(":checked")?"0":"1",
b=$("#facetofaceresearch").is(":checked")?"0":"1",
c=$("#surveysonmobile").is(":checked")?"0":"1",
a="";
if($("#restingperiod").next("span").text()!="")
{
a=f;
if($("#onlineexposure").next("span").text()!=""||$("#ownewsletter").next("span").text()!=""||$("#inhomeusage").next("span").text()!=""||$("#facetofaceresearch").next("span").text()!=""||$("#surveysonmobile").next("span").text()!="")
a=a+"|"
}
if($("#onlineexposure").next("span").text()!="")
{
a=a+d;
if($("#ownewsletter").next("span").text()!=""||$("#inhomeusage").next("span").text()!=""||$("#facetofaceresearch").next("span").text()!=""||$("#surveysonmobile").next("span").text()!="")
a=a+"|"
}
if($("#ownewsletter").next("span").text()!="")
{
a=a+e;
if($("#inhomeusage").next("span").text()!=""||$("#facetofaceresearch").next("span").text()!=""||$("#surveysonmobile").next("span").text()!="")
a=a+"|"
}
if($("#inhomeusage").next("span").text()!="")
{
a=a+g;
if($("#facetofaceresearch").next("span").text()!=""||$("#surveysonmobile").next("span").text()!="")
a=a+"|"
}
if($("#facetofaceresearch").next("span").text()!="")
{
a=a+b;
if($("#surveysonmobile").next("span").text()!="")
a=a+"|"
}
if($("#surveysonmobile").next("span").text()!="")
a=a+c;
return a
};
$("#restingperiod").is(":checked")&&
$(".notifications-schedule").html($("#notifications-options option:selected").text());
var c=$("#entity_Id").val();
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/saveProfileSettings",{verb:"POST",data:{entity_id:c,selectedOptionsList:a(),selectedValuesList:b()},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert($("#JSProfileSettingsSaved").val());
$.modal.close();
window.location.href=unescape(window.location.pathname)
}
else
alert($("#JSProfileSettingsWasNotSaved").val())
},error:function()
{
alert($("#JSAddressOrPostCodeIsInvalid").val())
}})
},
a=function()
{
var a="";
if($("#restingperiod").val()!=null)
a+="RP_Avail";
var b=$("#notifications-options2").val();
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/saveProfileSettings",{verb:"POST",data:{entity_id:$("#entity_Id").val(),selectedOptionsList:a,selectedValuesList:b},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert($("#JSProfileSettingsSaved").val());
$.modal.close();
window.location.href=unescape(window.location.pathname)
}
else
alert($("#JSProfileSettingsWasNotSaved").val())
},error:function()
{
alert($("#JSProfileSettingsWasNotSaved").val())
}})
},
b=function()
{
var b="ON_Avail",
a=$("#ownewsletter2").is(":checked")?"0":"1";
$.ajaxDotNet("/app_services/panel/secured/securedservices.asmx/saveProfileSettings",{verb:"POST",data:{entity_id:$("#entity_Id").val(),selectedOptionsList:b,selectedValuesList:a},success:function(b)
{
var a=JSON.parse(b.d);
if(a.Success==true)
{
alert($("#JSProfileSettingsSaved").val());
$.modal.close();
window.location.href=unescape(window.location.pathname)
}
else
alert($("#JSProfileSettingsWasNotSaved").val())
},error:function()
{
alert($("#JSProfileSettingsWasNotSaved").val())
}})
},
c=function(e)
{
for(var d=window.location.search.substring(1),
c=d.split("&"),
a=0;a<c.length;a++)
{
var b=c[a].split("=");
if(b[0]==e)
return b[1]
}
};
$(function()
{
for(var e=false,
h=["pchonlinesurveys","blauwnl"],
i="surveyspot.com/Secured/My-Dashboard/Unsubscribe",
f=0;f<h.length;f++)
{
e=document.URL.match(h[f]);
if(e)
break
}
var g=document.URL.match(i),
j=c("unsubscribeaftersurvey");
if(j=="true")
if($("#unsubscribe-step7")&&!e&&!g)
{
$("#unsubscribe-wrapper-new").modal({appendTo:"#form1",containerId:"modal-container",width:600,autoResize:true,closeClass:"modal-close",overlayClose:true,opacity:90});
$("#unsubscribe-step1").toggle("slide",null,800).delay(700);
$("#unsubscribe-step7").toggle("slide",null,800)
}
$("#panelunsubscribe").live("click",function()
{
if(e)
{
top.location.href="/secured/my-account/my-profile/unsubscribe";
return false
}
else
if(g)
return false;
$("#unsubscribe-wrapper-new").modal({appendTo:"#form1",containerId:"modal-container",width:600,autoResize:true,closeClass:"modal-close",overlayClose:true,opacity:90});
return false
});
$("#edit-profile-settings").live("click",function()
{
$("#mailing-settings").find("li").each(function()
{
$(this).find("input[type=checkbox]").each(function()
{
$(this).attr("disabled",false)
})
});
$(this).fadeOut("slow");
$("#save-profile-settings").fadeIn("slow");
$(".notifications-schedule").fadeOut("slow");
$("#restingperiod").attr("checked",true);
$("#notifications-options").fadeIn("slow");
$("#notifications-options").attr("disabled",false);
return false
});
$("#save-profile-settings").live("click",function()
{
$("#mailing-settings").find("li").each(function()
{
$(this).find("input[type=checkbox]").each(function()
{
$(this).attr("disabled",true)
})
});
$(this).fadeOut("slow");
$("#edit-profile-settings").fadeIn("slow");
$("#restingperiod").is(":checked")&&
$(".notifications-schedule").fadeIn("slow");
$("#notifications-options").fadeOut("slow");
d();
return false
});
$("#restingperiod").live("click",function()
{
if(document.getElementById("restingperiod").checked)
{
document.getElementById("notifications-options").disabled=false;
$("#notifications-options").fadeIn("slow")
}
else
{
$("#notifications-options").fadeOut("slow");
document.getElementById("notifications-options").disabled=true
}
});
$("#close-account").live("click",function()
{
if($("#unsubSurveyButtonDesc").html())
{
$("#unsubscribe-step1").toggle("slide",null,800).delay(700);
$("#unsubscribe-step5").toggle("slide",null,800)
}
else
{
$("#unsubscribe-step1").toggle("slide",null,800).delay(700);
$("#unsubscribe-step2").toggle("slide",null,800)
}
});
$("#panel-cancel-survey-option").live("click",function()
{
$("#unsubscribe-step5").toggle("slide",null,800).delay(700);
$("#unsubscribe-step1").toggle("slide",null,800)
});
$("#take-deactivation-survey").live("click",function()
{
var a=$("#UnsubscribeURL").text();
$("#iframeunsubscribe").attr("src",a);
$.modal.close();
setTimeout(function()
{
$("#unsubscribe-wrapper-new2").modal({appendTo:"#form1",containerId:"modal-container",width:700,autoResize:true,closeClass:"modal-close",overlayClose:true,opacity:90})
},20);
return false
});
$("#panel-cancel-survey").live("click",function()
{
$.modal.close();
setTimeout(function()
{
$("#unsubscribe-wrapper-new").modal({appendTo:"#form1",containerId:"modal-container",width:600,autoResize:true,closeClass:"modal-close",overlayClose:true,opacity:90})
},20);
return false
});
$("#panel-cancel-unsub").live("click",function()
{
$("#unsubscribe-step2").toggle("slide",null,800).delay(700);
$("#unsubscribe-step1").toggle("slide",null,800)
});
$("#change-frequency").live("click",function()
{
if(document.getElementById("restingperiod").checked)
$("#RestingPeriodValue").val()!=""&&
$("#notifications-options2 [value='"+$("#RestingPeriodValue").val()+"']").attr("selected",true);
else
$("#notifications-options2 [value='999']").attr("selected",true);
$("#unsubscribe-step1").toggle("slide",null,800).delay(700);
$("#unsubscribe-step3").toggle("slide",null,800)
});
$("#panel-cancel-invitations").live("click",function()
{
$("#unsubscribe-step3").toggle("slide",null,800).delay(700);
$("#unsubscribe-step1").toggle("slide",null,800)
});
$("#change-newsletter").live("click",function()
{
document.getElementById("ownewsletter2").checked=$("#OWNewsletterValue").val()=="0"?true:false;
$("#unsubscribe-step1").toggle("slide",null,800).delay(700);
$("#unsubscribe-step4").toggle("slide",null,800)
});
$("#panel-cancel-newsletter").live("click",function()
{
$("#unsubscribe-step4").toggle("slide",null,800).delay(700);
$("#unsubscribe-step1").toggle("slide",null,800)
});
$("#panel-save-newsletter ").live("click",function()
{
b()
});
$("#panel-save-notifications").live("click",function()
{
a()
})
})
}(),
apsProfileBtnClickGo=true


var PrizeDrawWinners=function()
{
$(function()
{
var b=function()
{
var a=0;
$("#prize-draw-winners").find("li").each(function()
{
a++
});
return a
},
a=function()
{
$("#prize-draw-winners li").hide();
$("#prize-draw-winners li").eq($(arguments)[0]-1).show()
};
jQuery().pagination&&
$("#prize-draw-winners .pagination").pagination({items:b(),itemsOnPage:1,currentPage:1,cssStyle:"light-theme",onClick:a,edges:3,hrefText:"#"})
})
}()


var myPages=[],
Intake=function()
{
$(document).ready(function()
{
if(typeof ssiintake_uiElements!="undefined")
{
$.validator.addMethod("intakeregex",function(b,a,c)
{
var d=new RegExp(c);
return this.optional(a)||b==a.defaultValue||d.test(b)
});
$.validator.addMethod("intakemin",function(b,a,c)
{
return this.optional(a)||b==a.defaultValue||b>=c
});
$.validator.addMethod("intakemax",function(b,a,c)
{
return this.optional(a)||b==a.defaultValue||b<=c
});
jQuery.validator.methods.oldRequired=jQuery.validator.methods.required;
function e(e,d,c,g)
{
var a=jQuery.validator.methods.oldRequired.call(e,d,c,g);
if(a)
for(var b in ssiintake_uiElements)
{
if(ssiintake_uiElements[b]!=c.id)
continue;
var f=ssiintake_uiAttributes[b+"-label"];
if(f===d)
a=false;
break
}
return a
}
jQuery.validator.addMethod("intakerequired",function(c,a,b)
{
return e(this,c,a,b)
});
jQuery.validator.addMethod("required",function(c,a,b)
{
return e(this,c,a,b)
});
var k=function()
{
function a()
{
var b="<root>";
if(typeof ssiintake_uiElements!="undefined")
for(var a in ssiintake_uiElements)
{
var d=$("#"+ssiintake_uiElements[a]);
if(d===undefined)
continue;
if(d.attr("readonly"))
continue;
var c=d.val(),
e=ssiintake_uiAttributes[a+"-label"];
if(c!==undefined&&c!=""&&c!=e)
b+="<"+a+">"+c+"</"+a+">"
}
b+="<page-name>"+$("#siq-page-name").val()+"</page-name>";
b+="</root>";
return encodeURIComponent(b)
}
function e()
{
for(var b=$(".group-class.dob-box").get(),
i=0,
j=0,
a=0;a<b.length;a++)
{
if($(b[a]).is(":hidden"))
continue;
$(b[a]).find("input").each(function()
{
if($(this).hasClass("required")||$(this).attr("required")=="required"||$(this).attr("required")==true)
j++
});
var f=$(b[a]).find("input[id*='siq-monthdob']"),
g=$(b[a]).find("input[id*='siq-yeardob']");
if(!$.isNumeric($(b[a]).find("input[id*='siq-daydob']").val()))
{
var k=new Date(g.val(),f.val(),0);
$(b[a]).find("input[id*='siq-daydob']").val(k.getDate())
}
var h=$(b[a]).find("input[id*='siq-daydob']");
if(j==0)
continue;
if(!c(g.val(),f.val(),h.val()))
{
var e="error-label-"+$(b[a]).attr("id");
if(!$("label[name='"+e+"']").length)
{
var d=document.createElement("Label");
d.setAttribute("for",$(b[a]).attr("id"));
d.setAttribute("class","error");
d.setAttribute("name",e);
d.innerHTML=$("#msgEnterValidDate").length?$("#msgEnterValidDate").val():"Invalid Date";
$(b[a]).closest("div").append(d)
}
else
$("label[name='"+e+"']").show();
i+=1;
h.addClass("error");
f.addClass("error");
g.addClass("error")
}
}
return i>0?false:true
}
function b()
{
var a="";
if(typeof ssiintake_uiElements!="undefined")
{
for(var b in ssiintake_uiElements)
{
var c=$("#"+ssiintake_uiElements[b]);
if(c===undefined||c.attr("required")!="required"||c.css("display")=="none")
continue;
var d=ssiintake_uiAttributes[b+"-label"],
f="\n     - "+(d!==undefined&&d!=""?d:b),
e=c.val();
if(e==""||e==d)
a+=f;
else
{
var g=ssiintake_uiAttributes[b+"-regex"];
if(g!==undefined)
{
ValidationRegEx=new RegExp(g,"i");
if(!ValidationRegEx.test(e))
a+=f+" - regex"
}
}
}
if(a!="")
{
var h=$("#msgFieldIsRequired").length?$("#msgFieldIsRequired").val():"Beantwoord aub de volgende vragen.";
alert(h+": \n"+a);
return false
}
}
return true
}
function c(c,b,d)
{
var a=new Date(c,b-1,d);
return a.getFullYear()==c&&a.getMonth()+1==b&&a.getDate()==d
}
if(b()==false)
return false;
if(e()==false)
return false;
var f=a();
if(f.length>0)
{
$("#sip-confirm").disabled=true;
$("body").css({cursor:"wait"});
$.ajaxDotNet("/app_services/panel/public/publicservices.asmx/saveIntakeData",{verb:"POST",data:{uidata:a()},success:function(c)
{
$("body").css({cursor:"default"});
var a=JSON.parse(c.d);
if(a.Success==true)
if(a.Json!=null&&a.Json=="ChangePage")
{
var b=$("#siq-questions-wrapper").find(".siq-the-questions");
b.fadeOut("slow");
var e=b.remove();
myPages[b.attr("id")]=b;
if(a.JavaScript!=null&&a.JavaScript.length>0)
{
$(a.JavaScript).appendTo($("#siq-questions-wrapper"));
d()
}
}
else
{
a.Json!=null&&
alert(a.Json);
if(a.JavaScript!=null)
eval(a.JavaScript)
}
else
{
$("body").css({cursor:"default"});
a.ErrorMessage!=null&&
alert(a.ErrorMessage);
if(a.Json!=null&&a.Json=="ChangePage")
{
var b=$("#siq-questions-wrapper").find(".siq-the-questions");
b.fadeOut("slow");
b.remove();
if(a.JavaScript!=null&&a.JavaScript.length>0)
{
$(a.JavaScript).appendTo("#siq-questions-wrapper");
d()
}
}
}
},error:function()
{
$("body").css({cursor:"default"});
alert("error")
}})
}
},
m=function(e)
{
for(var d=window.location.search.substring(1),
c=d.split("&"),
a=0;a<c.length;a++)
{
var b=c[a].split("=");
if(b[0]==e)
return b[1]
}
};
function f()
{
var a=$("#sip-confirm");
a!==undefined&&
a.click(function()
{
$("input:hidden").each(function()
{
if($(this).hasClass("to-fill"))
{
var a=$(this).attr("name");
a!=null&&a!=""&&
$(this).val($.map($(":input[name="+a+"]:checked"),function(a)
{
return a.value||""
}).join(","))
}
});
if(jQuery().validate)
$("#form1").valid()&&
k("confirm");
else
alert("jquery Validate pluggin is missing!")
})
}
function g()
{
$(".peq-wrapper :input").each(function()
{
$(this).addClass("peq-input")
})
}
function j(a)
{
return!isNaN(parseFloat(a))&&isFinite(a)
}
Object.keys=Object.keys||function(c,b,a)
{
a=[];
for(b in c)
a.hasOwnProperty.call(c,b)&&a.push(b);
return a
};
function h(d,b)
{
if(typeof siq_dops=="undefined")
return;
$("#siq-"+d+"-id").change(function()
{
var h=$("#siq-"+b+"-id").find(":selected").val(),
e=$("#siq-"+b+"-id");
e.empty();
var i=siq_dops[d];
if(i===undefined)
return;
var f=i[parseInt($(this).val())];
if(f===undefined)
{
e.parent("div").hide();
e.is("input:text")&&
a("i",e);
return
}
if(f===""&&e.is("input:text"))
{
c("i",e);
e.addClass("required");
e.parent("div").show();
return
}
if(Object.keys(f).length>1)
{
e.append($("<option></option>").attr("value","").text(ssiintake_uiAttributes[b+"-label"]));
for(var g in f)
e.append($("<option></option>").attr("value",g).text(f[g]));
h!=""&&h!=undefined&&
$("#siq-"+b+"-id  option[value="+h+"]").attr("selected",true);
e.parent("div").show()
}
else
{
for(var g in f)
{
e.append($("<option></option>").attr("value",g).text(f[g]));
break
}
if(typeof siq_depq[b]=="undefined")
e.parent("div").hide();
else
{
e.parent("div").show();
$("#siq-"+b+"-id").change()
}
}
});
$("#siq-"+d+"-id").change()
}
function c(d,b)
{
if(d!="cb")
for(var a in ssiintake_uiElements)
{
if(ssiintake_uiElements[a]!=b.attr("id"))
continue;
var c=ssiintake_uiAttributes[a+"-label"];
b.val(c==null?"":c);
break
}
}
function a(b,a)
{
a.removeClass("required");
a.removeClass("error");
a.closest(".group-class").find("label.error").remove();
switch(b)
{
case"i":
a.val("");
break;
case"s":
a.attr("selectedIndex",0);
break;
case"cb":
a.checked=false
}
}
var b=-1;
function l(d,g,e)
{
var d=$("#siq-"+d+(g=="g"?"-group":"")+"-id");
d.children().each(function()
{
$(this).children(".peq-wrapper").children(".grequired").each(function()
{
$(this).find("input").each(function()
{
$(this).addClass("required")
});
$(this).find("select").each(function()
{
$(this).addClass("required")
});
$(this).find(":checkbox").each(function()
{
$(this).addClass("required")
})
})
});
if(e==0&&e!=b)
{
d.fadeOut("slow");
d.closest(".pe-wrapper").hide();
d.children().each(function()
{
$(this).hide()
});
d.find("input").each(function()
{
a("i",$(this))
});
d.find("select").each(function()
{
a("s",$(this))
});
d.find(":checkbox").each(function()
{
a("cb",$(this))
});
b=e;
return
}
if(d.closest(".pe-wrapper").css("display")=="none")
{
d.closest(".pe-wrapper").fadeIn("slow");
d.fadeIn("slow")
}
var f=0;
d.children(".pe-wrapper").each(function()
{
if(f<e)
{
if(f>=b)
if($(this).css("display")=="none")
{
$(this).show();
$(this).find("input").each(function()
{
c("i",$(this))
});
$(this).find("select").each(function()
{
c("s",$(this))
});
$(this).find(":checkbox").each(function()
{
c("cb",$(this))
})
}
}
else
if($(this).css("display")!="none")
{
$(this).hide();
$(this).find("input").each(function()
{
a("i",$(this))
});
$(this).find("select").each(function()
{
a("s",$(this))
});
$(this).find(":checkbox").each(function()
{
a("cb",$(this))
})
}
f++
});
d.find("input[id*='siq-daydob']").is(":hidden")&&
d.find("input[id*='siq-daydob']").parent("div").hide();
b=e
}
function i(e,d)
{
var a=$("#siq-"+e+"-id");
if(a.length==0)
return;
var c=-1;
function b()
{
var b=a.val();
if(b.length==0||c!=b)
{
if(!j(b))
if(a.val().length>0)
{
a.val(c);
b=c;
return
}
for(var e in d)
l(e,d[e],b);
c=b
}
}
a.mouseleave(function()
{
b()
});
a.change(function()
{
b()
});
a.keyup(function()
{
a.val().length>0&&
b()
});
b()
}
function d()
{
g();
f();
initValidation();
if(typeof siq_depq!="undefined")
for(var a in siq_depq)
h(a,siq_depq[a]);
i("nrchildren",{household:"g"});
$.validator.messages.required=$("#msgFieldIsRequired").length?$("#msgFieldIsRequired").val():"Dit veld is verplicht.";
intakePageInitialized=true;
typeof tooltip!=="undefined"&&($.isFunction($.fn.tooltip)||$.isFunction(tooltip)||!!$.prototype.tooltip)&&
$('[data-toggle="tooltip"]').tooltip()
}
if($.browser.msie&&parseInt($.browser.version)<10)
window.onload=new function()
{
d()
};
else
$(window).load(function()
{
d()
})
}
})
}(),
intakePageInitialized=false


var SocialLogin = function () {

    var SocialLoginSyncAccount = function () {
        $.ajaxDotNet('/app_services/aps/public/PublicServices.asmx/SocialLoginSyncAccount', {
            verb: 'POST',
            data: {
                'provided_email': $('#social_providedEmail').val(),
                'provided_password': $('#social_providedPass').val(),
                'social_provider': $('#socialProvider').val(),
                'social_photo': $('#socialPhoto').val(),
                'social_uniqueIdentifier': $('#socialUniqueIdentifier').val(),
                'social_displayname': $('#socialDisplayname').val(),
                'social_token': $('#socialToken').val(),
                'social_email': $('#socialEmail').val(),
                'redirectUrl':  $('#socialRedirectUrl').val(),
                'guid': currentItem
            },
            success: function (obj) {
                var returnedobj = JSON.parse(obj.d);

                if (returnedobj.Success == true) {
                    eval(returnedobj.JavaScript);
                }
                else {

                    alert(returnedobj.ErrorMessage); 
                    eval(returnedobj.JavaScript);
                }
            },
            error: function (err) {
                
            }
        });
    };

    function validateEmail(email) {
        var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        return re.test(email);
    }

    $(function () {
       
      
        $('#social_providedEmail').focusout(function () {
            if ($(this).val() != '' && validateEmail($(this).val())) { $(this).removeClass('error'); } else { $(this).addClass('error'); }
        });
        $('#social_providedPass').focusout(function () {
            if ($(this).val() != '' && $(this).val() != $(this).defaultValue) { $(this).removeClass('error'); } else { $(this).addClass('error'); }
        });

        $('#JanrainSyncAccount').click(function () {
            var providedEmail = $("#social_providedEmail");
            var providedPass  = $("#social_providedPass");
            var validForm = true;

            $.validator.addMethod('ignoreDefault', function (value, element) { return value !== element.defaultValue; }, $('#msgFieldIsRequired').val());

            if (providedEmail.val() == '' || providedEmail.val() == providedEmail.defaultValue || !validateEmail(providedEmail.val())) {
                providedEmail.addClass('error');
                validForm = false;
            }
            if (providedPass.val() == '' || providedPass.val() == providedPass.defaultValue) {
                providedPass.addClass('error');
                validForm = false;
            }
            if (validForm) { SocialLoginSyncAccount.call(); }
        });



        //Janrain API events
        function janrainWidgetOnload() {
            janrain.events.onProviderLoginStart.addHandler(function () {
                console.log("Login Start!");
            });
            janrain.events.onProviderLoginComplete.addHandler(function () {
                console.log("Login Complete!");
            });
            janrain.events.onProviderLoginError.addHandler(function (response) {
                console.log("Login Error!");
                console.log(response.err.code);
                console.log(response.err.msg);
                console.log(response.origin);
                console.log(response.stat);
            });
            janrain.events.onProviderLoginSuccess.addHandler(function (something) {
                log("Login Succcess!");
            });
            janrain.events.onReturnExperienceFound.addHandler(
            function (response) {
                console.log("Return Experience Found!");
                console.log(response.returnProvider);
                console.log(response.welcomeName);
            }); 
        }



    });

}();

