
﻿
var originalDoPostBackWithOptions=null;function WebForm_DoPostBackWithOptionsAndPreEvents(options){var tbs=document.forms[0].elements;var txt='';for(var x=0;x<tbs.length;x++){var tb=tbs[x];txt=txt+tb.tagName+'/'+tb.name+' '+tb.onprevalidation+'\n';if(typeof(tb.onprevalidation)!='undefined'){tb.onprevalidation(tb);}}
originalDoPostBackWithOptions(options);}
function HookPostBackPreValidationEvent(){if(originalDoPostBackWithOptions!==null){return;}
originalDoPostBackWithOptions=window.WebForm_DoPostBackWithOptions;window.WebForm_DoPostBackWithOptions=WebForm_DoPostBackWithOptionsAndPreEvents;}
function TrinityDateValidatorIsValid(src,args){var p=document.getElementById(src.controltovalidate);var z=0,day,month,year;for(var i=0;i<p.childNodes.length;i=i+1){var control=p.childNodes[i];if(control.tagName=='SELECT'){if(z===0){day=control.value;}
if(z==1){month=control.value;}
if(z==2){year=control.value;}
z=z+1;}}
args.IsValid=((new Date(year,month-1,day)).getDate()==day&&month!==''&&year!=='');}
function UniqueEmailValidatorIsValid(src,args){if(src.ExcludedEmail==args.Value){return true;}
$.ajax({url:"ajax/profile.aspx?mode=existence&username="+args.Value,cache:false,dataType:'json',async:false,success:function(json){var exists=(json.res!=='');if(typeof(src.AccountTypes)!=='undefined'&&src.AccountTypes!==''){var acc=src.AccountTypes.split(',');exists=false;for(var i=0;i<acc.length;i++){if(acc[i]==json.res){exists=true;}}}
args.IsValid=(exists&&src.CheckForExistence=='true')||(!exists&&src.CheckForExistence!='true');}});}
function EmailValidatorIsValid(src,args){args.Value=args.Value.replace(/^\s*/,"").replace(/\s*$/,"");if(args.Value.indexOf(".@")!=-1||args.Value.indexOf("@.")!=-1||args.Value.indexOf(" ")!=-1){args.IsValid=false;}else if(!args.Value.match(/^[^@]+@[^.][^@]+\.[a-zA-Z]{2,10}$/ig)){args.IsValid=false;}
else{args.IsValid=true;}}
function BookingNameValidatorIsValid(src,args){args.IsValid=true;var v=args.Value;v=v.replace(/^\s*|\s*$/g,"");if(v===""){args.IsValid=false;}
if(v=="ZZ"||v=="EXST"||v=="CBBG"){args.IsValid=false;}
var chars=["*","<",">","/","\\","?","!","%","(",")","@"];for(var i=0;i<chars.length;i++){if(v.indexOf(chars[i])!==-1){args.IsValid=false;return;}}
if(v.match(/\d/ig)!==null){args.IsValid=false;}
if(v.length<2){args.IsValid=false;}}
if(typeof(Sys)!=='undefined'&&Sys.Application){Sys.Application.notifyScriptLoaded();}