<!--
function JSLIsAddress(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z0-9\,])+[a-zA-Z]+([ ]|[a-zA-Z])*$/;if(pattern.test(pctl.value)==false){alert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsPhone(pctl,pmsg)
{pattern=/^[0-9]{1}([0-9]|[ ])*$/;if(pctl.value.length<9||pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsWebAddress(pctl,pmsg)
{pattern=/^[AZaz]+\.{1}(AZaz\.)*$/;if(pctl.value.length<9||pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLValidDD(pctl,pmsg)
{if(pctl.value<1||pctl.value>31)
{doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLValidMM(pctl,pmsg)
{if(pctl.value<1||pctl.value>12)
{doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLValidDate(dd,mm,yy,datetype)
{var intDay=dd.value;var intMonth=mm.value;var intYear=yy.value;if((intMonth==4||intMonth==6||intMonth==9||intMonth==11)&&(intDay>30))
{doAlert("Please enter a valid "+datetype+" day number for the month (1 - 30)");dd.select();dd.focus();return false;}
if(intMonth==2)
{if(LeapYear(intYear)==true)
{if(intDay>29)
{doAlert("Leap year - please enter a valid "+datetype+" day number (1 - 29)");dd.select();dd.focus();return false;}}
else
{if(intDay>28)
{doAlert("Please enter a valid "+datetype+" day number (1 - 28)");dd.select();dd.focus();return false;}}}
return true;}
function LeapYear(intYear)
{if(intYear%100==0)
{if(intYear%400==0)
{return true;}}
else
{if((intYear%4)==0)
{return true;}}
return false;}
function JSLNotNull(pctl,pmsg)
{if(pctl.value=="")
{doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsTextOnly(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z])+[a-zA-Z]+([ ]|[a-zA-Z])*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsTextOnlyWithHyphens(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z-])+[a-zA-Z-]+([ ]|[a-zA-Z-])*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsTextOnlyWithHyphensAndSingleQuotes(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z-'])+[a-zA-Z-']+([ ]|[a-zA-Z-'])*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsTextOrAlphaOnlyWithHyphens(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z0-9-])+[a-zA-Z0-9-]+([ ]|[a-zA-Z0-9-])*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLCheckIsEMail(p_fld,pmsg){var atPos=p_fld.value.indexOf("@");if(atPos<1||atPos==(p_fld.value.length-1))
{doAlert(pmsg);p_fld.focus();return false;}
atPos=p_fld.value.indexOf(" ");if(atPos>-1)
{doAlert(pmsg);p_fld.focus();return false;}
atPos=p_fld.value.indexOf(".");if(atPos<1||atPos==(p_fld.value.length-1))
{doAlert(pmsg);p_fld.focus();return false;}
return true;}
function JSLSelected(pctl,pmsg){if(pctl.value=="none"){doAlert(pmsg);pctl.focus();return false;}
return true;}
function JSLIsInteger(pctl,pmsg)
{pattern=/^[0-9]*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function JSLIsPCode(pctl,pmsg)
{pattern=/^([ ]|[a-zA-Z0-9])+[a-zA-Z]+([ ]|[a-zA-Z0-9])*$/;if(pattern.test(pctl.value)==false){doAlert(pmsg);pctl.focus();pctl.select();return false;}
return true;}
function doAlert(sMessage){$('alertholder').innerHTML="";$('alertholder').style.display="none";$('alertholder').innerHTML=sMessage;new Effect.Appear('alertholder');}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function MM_preloadImagesTeam(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImagesTeam.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestoreTeam(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObjTeam(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImageTeam(){var i,j=0,x,a=MM_swapImageTeam.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function trim(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");}
function ltrim(stringToTrim){return stringToTrim.replace(/^\s+/,"");}
function rtrim(stringToTrim){return stringToTrim.replace(/\s+$/,"");}
function getBrowserObject(nameStr){var ie=(document.all);var ns4=document.layers?true:false;var dom=document.getElementById&&!document.all?true:false;if(dom){return document.getElementById(nameStr);}else if(ie){return document.all[nameStr];}else if(ns4){return document.layers[nameStr];}}
function checkFirst(iMode){$('alertholder').innerHTML="";$('alertholder').style.display="none";var oForm=document.forms['registration'];var bChecked=false;for(var x=0;x<oForm.elements.length;x++){if(oForm.elements[x].type=="radio"&&oForm.elements[x].checked==true){bChecked=true;}}
if(!bChecked){doAlert('Please indicate if you currently hold a Petplan Sanctuary policy');new Effect.Highlight('policy1',{startcolor:'#FAB320',endcolor:'#FFFFFF'});new Effect.Highlight('policy2',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}else{}
if(!JSLCheckIsEMail(document.registration.email,"Please enter a correctly formatted e-mail address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.passw,"Please enter a password.")){new Effect.Highlight('passw',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.confirmpassword,"Please confirm your password.")){new Effect.Highlight('confirmpassword',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(document.registration.passw.value.length<6){doAlert('Please enter a minimum of 6 characters for your password');new Effect.Highlight('passw',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(document.registration.passw.value!=document.registration.confirmpassword.value){doAlert('Your password and confirm password do not match, please re-enter your password.');document.registration.passw.value='';document.registration.confirmpassword.value='';new Effect.Highlight('passw',{startcolor:'#FAB320',endcolor:'#FFFFFF'});new Effect.Highlight('confirmpassword',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(iMode==0){oForm.submit();}else{return true;}}
function checkFinal(){if(!checkFirst(1)){return false;}else{if(!JSLNotNull(document.registration.businessname,"Please enter your business name.")){new Effect.Highlight('businessname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOrAlphaOnlyWithHyphens(document.registration.businessname,"Please enter your business name.")){new Effect.Highlight('businessname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.contactname,"Please enter your contact name.")){new Effect.Highlight('contactname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.address,"Please enter your address.")){new Effect.Highlight('address',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.town,"Please enter a town.")){new Effect.Highlight('town',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.registration.county,"Please enter a county.")){new Effect.Highlight('county',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(document.registration.county.selectedIndex==0){doAlert("Please select a county.");new Effect.Highlight('county',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPCode(document.registration.postcode,"Please enter a postcode.")){new Effect.Highlight('postcode',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPhone(document.registration.telephone,"Please enter a telephone number.")){new Effect.Highlight('telephone',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
document.forms['registration'].submit();}}
function formCheckrequestAQuote()
{if(!JSLNotNull(document.requestAQuote.firstname,"Please enter the firstname.")){new Effect.Highlight('firstname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOnly(document.requestAQuote.firstname,"Please enter text only in the firstname.")){new Effect.Highlight('firstname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.requestAQuote.surname,"Please enter the surname.")){new Effect.Highlight('surname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOnly(document.requestAQuote.surname,"Please enter text only in the surname.")){new Effect.Highlight('surname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.requestAQuote.contactnumber,"Please enter the a contact number.")){new Effect.Highlight('contactnumber',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPhone(document.requestAQuote.contactnumber,"Please enter a valid contact number - i.e. 01234 123123.")){new Effect.Highlight('contactnumber',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.requestAQuote.address,"Please enter an address.")){new Effect.Highlight('address',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.requestAQuote.postcode,"Please enter the postcode.")){new Effect.Highlight('postcode',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPCode(document.requestAQuote.postcode,"Please enter the postcode.")){new Effect.Highlight('postcode',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.requestAQuote.email,"Please enter your e-mail address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLCheckIsEMail(document.requestAQuote.email,"Please enter a correctly formatted e-mail address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLSelected(document.requestAQuote.preferredcalltime,"Please select a preferred time for us to call you.")){new Effect.Highlight('preferredcalltime',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLSelected(document.requestAQuote.petplanproductslist,"Please select a Petplan products.")){new Effect.Highlight('petplanproductslist',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLSelected(document.requestAQuote.aboutpetplanlist,"Please select where you heard about Petplan Sanctuary.")){new Effect.Highlight('aboutpetplanlist',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
document.forms['requestAQuote'].submit();}
function formCheckcontactus(){if(!JSLNotNull(document.contactus.firstname,"Please enter the firstname.")){new Effect.Highlight('firstname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOnly(document.contactus.firstname,"Please enter text only in the firstname.")){new Effect.Highlight('firstname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.contactus.surname,"Please enter the surname.")){new Effect.Highlight('surname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOnly(document.contactus.surname,"Please enter text only in the surname.")){new Effect.Highlight('surname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.contactus.contactnumber,"Please enter the a contact number.")){new Effect.Highlight('contactnumber',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPhone(document.contactus.contactnumber,"Please enter a valid contact number - i.e. 01234 123123.")){new Effect.Highlight('contactnumber',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false}
if(!JSLNotNull(document.contactus.email,"Please enter your e-mail address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false}
if(!JSLCheckIsEMail(document.contactus.email,"Please enter a correctly formatted e-mail address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.contactus.subject,"Please enter your an e-mail subject.")){new Effect.Highlight('subject',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false}
if(!JSLSelected(document.contactus.preferredcalltime,"Please select a preferred time for us to call you.")){new Effect.Highlight('preferredcalltime',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false}
if(!JSLNotNull(document.contactus.emailcontent,"Please enter e-mail contents here.")){new Effect.Highlight('emailcontent',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false}
document.forms['contactus'].submit();}
function doCancel(){$('formaction').value='cancel';document.forms['addnewadvert'].submit();}
function doSubmit(btID){$('formaction').value='update';if(checkAdvertForm(btID)){document.forms['addnewadvert'].submit();}}
function doPreview(btID){$('formaction').value='preview';$('addform').action="index.cfm";if(checkAdvertForm(btID)){document.forms['addnewadvert'].submit();}}
function checkAdvertForm(btID){$('alertholder').style.display='none';if(document.addnewadvert.alttel.value.length>0){if(!JSLIsPhone(document.addnewadvert.alttel,"Please enter a valid alternative telephone number.")){new Effect.Highlight('alttel',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}}
if(document.addnewadvert.email.value.length>0){if(!JSLCheckIsEMail(document.addnewadvert.email,"Please enter a valid email address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}}
if(document.addnewadvert.webaddress.value.length>0){if(document.addnewadvert.webaddress.value.indexOf('.')==-1){doAlert('Please enter a valid URL.');new Effect.Highlight('webaddress',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}else{pattern=/^([ ]|[a-zA-Z-0-9\&\?\/\.\=\%\;])+[a-zA-Z-0-9\&\?\/\.\=\%\;]+([ ]|[a-zA-Z-0-9\&\?\/\.\=\%\;])*$/;if(pattern.test(document.addnewadvert.webaddress.value.replace(/\./g,''))==false||(document.addnewadvert.webaddress.value.indexOf('.')==(document.addnewadvert.webaddress.value.length-1))){doAlert('Please enter a valid URL.');new Effect.Highlight('webaddress',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}}}
if(!JSLNotNull(document.addnewadvert.description,"Please enter a description of your services.")){new Effect.Highlight('description',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(document.addnewadvert.description.value.length>600){doAlert("Please enter a maximum of 600 characters for your description.")
new Effect.Highlight('description',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(btID==1&&$('smallanimals').checked==false&&$('cats').checked==false&&$('dogs').checked==false){doAlert('Please indicate which type of animals are boarded');return false;}
if($('smallanimals').checked==true&&$('txtsmallanimals').value.length==0){doAlert('Please indicate which small animals you board.');return false;}
if($('txtsmallanimals').value.length>0&&$('smallanimals').checked==false){doAlert('You have specified small animals but not indicated they are boarded.');return false;}
return true;}
function checkBusinessForm(){if(!JSLNotNull(document.mybusiness.businessname,"Please enter a business name.")){new Effect.Highlight('businessname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsTextOnlyWithHyphensAndSingleQuotes(document.mybusiness.businessname,"Please enter a business name.")){new Effect.Highlight('businessname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.mybusiness.contactname,"Please enter a contact name.")){new Effect.Highlight('contactname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.mybusiness.address1,"Please enter an address.")){new Effect.Highlight('address1',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.mybusiness.town,"Please enter a town.")){new Effect.Highlight('town',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(document.mybusiness.county.selectedIndex==0){doAlert("Please select a county.");new Effect.Highlight('county',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.mybusiness.postcode,"Please enter a postcode.")){new Effect.Highlight('postcode',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPhone(document.mybusiness.telephone,"Please enter a valid telephone number.")){new Effect.Highlight('telephone',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if($('email').value.length>0){if(!JSLCheckIsEMail(document.mybusiness.email,"Please enter a valid email address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}}
if(!JSLCheckIsEMail(document.mybusiness.loginemail,"Please enter a valid login email address.")){new Effect.Highlight('email',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
document.forms['mybusiness'].submit();}
function checkGetInTouch(){if(!JSLNotNull(document.getintouchform.contactname,"Please enter a contact name.")){new Effect.Highlight('contactname',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLIsPhone(document.getintouchform.telephone,"Please enter a valid telephone number.")){new Effect.Highlight('telephone',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.getintouchform.subject,"Please enter a subject.")){new Effect.Highlight('subject',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
if(!JSLNotNull(document.getintouchform.message,"Please enter a message.")){new Effect.Highlight('message',{startcolor:'#FAB320',endcolor:'#FFFFFF'});return false;}
document.forms['getintouchform'].submit();}
