 var globalErrorCount ;
var globalBlurBuster=false;
var purchaseDateCalenderIconClicked=false;
var globalEmptyDivBuster=false;
var hasSoloMaestroDependentBlurFired=false;
var hasSoloMaestroDependentMonthBlurFired=false;
var hasSoloMaestroBlurFired=false;
var isPostCodeError=false;
var isServerError=false;
var ErrorDescPaymentCardTermAndCondition="Agreement to the Vehicle Check Terms and Conditions is required";
var ErrorDescPaymentInsuranceTermAndContion="Agreement to the Terms and Conditions of the Vehicle Check Data Insurance is required";
var ErrHeadingPaymentCardTermAndCondition="Terms and Conditions";
var ErrHeadingPaymentInsuranceTermAndCondition="Indemnity Terms and Conditions";
var hasComefromIssueMonth=false;
var isOutofIssueYear=false;
var isOutofVRM=false;
var isOutofEmail=false;
var errorHoldTC=false;
var errorHoldInsurance=false;
function Validation(index) { this.ElementID=fields[index][0]; this.Description=fields[index][1]; this.Required=fields[index][2]; this.Pattern=fields[index][3]; this.ValidationDescription=fields[index][4]; this.Confirmation=fields[index][5]; this.Changed=false; if (this.Confirmation) { var confirmationField=document.getElementById('Confirm' + this.ElementID); if (confirmationField) { if (confirmationField.addEventListener) { confirmationField.addEventListener("blur", ConfirmOnChange, false); confirmationField.addEventListener("change", ConfirmOnChange, false); } else if (confirmationField.attachEvent) { confirmationField.attachEvent("onblur", ConfirmOnChange); confirmationField.attachEvent("onchange", ConfirmOnChange); } confirmationField.ValidateFieldId=this.ElementID; confirmationField.Changed=false; } } }
Validation.prototype.getField=function() { if (document.getElementById) { return document.getElementById(this.ElementID); } return null; }
function trimmedValue(field) { if (field && field.value && field.value.length > 0) { return field.value.replace(/^\s+/g, '').replace(/\s+$/g, '') } return ''; }
function ConfirmOnChange(e) { if (!e) { e=window.event; }
var confirmationField; if (this !=window) { confirmationField=this; } else if (e && e.srcElement) { confirmationField=e.srcElement; } if (confirmationField && confirmationField.ValidateFieldId) { confirmationField.Changed=true;
var input=document.getElementById(confirmationField.ValidateFieldId); if (input && input.validation && input.parentNode) { var ErrorMessage=ValidateParameters(input.parentNode, false); if (ErrorMessage.length>2) { SetValidationError(GetParameterContainer(input), ErrorMessage); } else { ClearValidation(GetParameterContainer(input)); } } } }
function ValidateOnChange(e) { if (!e) { e=window.event; }
var input; if (this !=window) input=this; else if (e && e.srcElement) input=e.srcElement; else if(e && e.originalTarget) input=e.originalTarget; if (input && input.validation && input.parentNode) { input.validation.Changed=true;
var ErrorMessage=ValidateParameters(input.parentNode, true); if (ErrorMessage.length > 0) { SetValidationError(GetParameterContainer(input), ErrorMessage); } else { ClearValidation(GetParameterContainer(input)); } } }
function ValidateParameters(parameterDiv, onChange) { var ErrorMessage=''; if (parameterDiv.firstChild && parameterDiv.firstChild.nextSibling) { var child=parameterDiv.firstChild;
var forceRequired=false; while (child) { var paramValue=trimmedValue(child); if (child.validation && (onChange==false || child.validation.Changed) && (child.type !='checkbox' && paramValue.length > 0)) { forceRequired=true; } child=child.nextSibling; } child=parameterDiv.firstChild; while (child) { if (child.validation && (onChange==false || child.validation.Changed)) { ErrorMessage=ValidateInput(child, forceRequired, onChange); if (ErrorMessage.length > 0) { break; } } child=child.nextSibling; } } return ErrorMessage; }
function ValidateInput(input, forceRequired, onChange) { var paramValue=trimmedValue(input); if (input.validation.Confirmation) { var confirmationField=document.getElementById('Confirm' + input.name); if (confirmationField && (confirmationField.Changed || onChange==false) && trimmedValue(confirmationField) !=paramValue) { return 'The supplied ' + input.validation.Description + ' and confirmation do not match.'; } } if (input.validation.Required || forceRequired) { if ((input.type=='checkbox' && !input.checked)) { return input.validation.Description + " is required"; } if ((input.type !='checkbox' && paramValue.length==0)) { if (input.validation.Description=="Email Address" || input.validation.Description=="Current Password" ) { return "Please enter an " + input.validation.Description; } else if (input.validation.Description=="Address Line 1") { return "Please enter the first line of your Address"; } else if (input.validation.Description=="Registration Plate") { return "Please enter a Vehicle " + input.validation.Description.replace("Plate","Number"); } else { var checkVowel=input.validation.Description.substring(0,1).toLowerCase(); if (checkVowel=="a" || checkVowel=="e" || checkVowel=="i" || checkVowel=="o" || checkVowel=="u") { return "Please enter an " + input.validation.Description; } else { return "Please enter a " + input.validation.Description; } } } } if (paramValue.length > 0 && input.validation.Pattern.test(paramValue)==false) { if (input.validation.ValidationDescription && input.validation.ValidationDescription.length > 0) { return input.validation.ValidationDescription.replace('vehicle registration mark is invalid.','Vehicle Registration Number was invalid'); } return 'Please enter a valid ' + input.validation.Description; } return ''; }
function SetValidationError(parameterDiv, message) { if (parameterDiv.className.indexOf(' Error')==-1) { parameterDiv.className +=' Error'; }
var child=GetErrorDiv(parameterDiv); SafeSetInnerHTML(child, message); }
function ClearValidation(parameterDiv) { parameterDiv.className=parameterDiv.className.replace(' Error', '');
var child=GetErrorDiv(parameterDiv); SafeSetInnerHTML(child,''); }
function SafeSetInnerHTML(element, msg) { if (element) { if (element.innerHTML !=msg) { element.innerHTML=msg; } } }
function GetParameterContainer(input) { for (var element=input.parentNode; element; element=element.parentNode) { if (element.className && element.className.toLowerCase().substring(0, 9)=='container') { break; } } return element; }
function GetErrorDiv(parent) { if (parent.firstChild && parent.firstChild.nextSibling) { var child=parent.firstChild; while (child) { if (child.tagName && child.tagName.toLowerCase()=='div' && child.className=='Error') { return child; } child=child.nextSibling; } } return null; }
function SubmitForm(e) { if (!e) { e=window.event; } if (!e) { return; } if (ValidateForm(true)) { EncryptPasswords(); } else { if (e.preventDefault) { e.preventDefault(); } e.returnValue=false; } }
function ValidateForm(showAlert) { var valid=true; if (document.getElementById) { for (var i in fields) { var id=fields[i][0];
var field=document.getElementById(id); if (field && field.parentNode) { var ErrorMessage=ValidateParameters(field.parentNode, false); if (ErrorMessage.length > 0) { valid=false; SetValidationError(GetParameterContainer(field), ErrorMessage); if (showAlert) { field.focus(); showAlert=false; } } } } } return valid; }
function EncryptPasswords() { if (document.getElementById && self.hex_md5) { EncryptField("Password", "EncryptedPassword"); EncryptField("ConfirmPassword", "ConfirmEncryptedPassword"); EncryptField("OldPassword", "OldEncryptedPassword"); } }
function EncryptField(FieldID, ConfirmFieldName) { var Field=document.getElementById(FieldID);
var fieldValue=trimmedValue(Field); if (fieldValue && Field.name) { Field.value=hex_md5(fieldValue); Field.name=ConfirmFieldName; } }
function InitialiseValidation() { var formElement; for (var i in fields) { if (fields[i] && fields[i].length==6) { var validation=new Validation(i); if (validation) { var field=validation.getField(); if (field) { field.validation=validation; if (field.type && field.type !='checkbox') { if (field.addEventListener) { field.addEventListener("blur", ValidateOnChange, false); field.addEventListener("change", ValidateOnChange, false); } else if (field.attachEvent) { field.attachEvent("onblur", ValidateOnChange); field.attachEvent("onchange", ValidateOnChange); } } else if (field.type && field.type=='checkbox') { if (field.addEventListener) { field.addEventListener("blur", ValidateOnChange, false); field.addEventListener("click", ValidateOnChange, false); } else if (field.attachEvent) { field.attachEvent("onblur", ValidateOnChange); field.attachEvent("onclick", ValidateOnChange); } } if (field.form) { formElement=field.form; } } } } } if (formElement && formElement.childNodes) { AttachSubmitHandler(formElement.childNodes); } }
function ClickNextSubmitButtonIfReturnPressed(e) { if (!e) { e=window.event; } if (e.keyCode && e.keyCode==13) { var srcElement; if (e.currentTarget) { srcElement=e.currentTarget; } else if (e.srcElement) { srcElement=e.srcElement; } if (srcElement && document.getElementsByTagName) { var bFoundSource=false;
var els=document.getElementsByTagName('INPUT'); for (var i in els) { var el=els[i]; if (el.id==srcElement.id) { bFoundSource=true; } if (bFoundSource && el.type && (el.type.toLowerCase()=='submit' || el.type.toLowerCase()=='image')) { el.focus(); el.click(); e.cancelBubble=true; if (e.stopPropagation) { e.stopPropagation(); } if (e.preventDefault) { e.preventDefault(); } return false; } } } } return true; }
function AttachSubmitHandler(nodes) { for (var i in nodes) { var el=nodes[i]; if (el && el.type && el.tagName && el.tagName.toLowerCase()=='input') { if (el.type.toLowerCase()=='submit' || el.type.toLowerCase()=='image') { if (!(el.id && nonValidatingSubmits && ArrayContainsValue(nonValidatingSubmits, el.id))) { AddSubmitButtonClickEventHandler(el); } } else if (el.type.toLowerCase() !='reset' && el.type.toLowerCase() !='hidden') { if (el.addEventListener) { el.addEventListener("keypress",ClickNextSubmitButtonIfReturnPressed, false); } else if (el.attachEvent) { el.attachEvent("onkeypress", ClickNextSubmitButtonIfReturnPressed); } } } else if (el.childNodes) { AttachSubmitHandler(el.childNodes); } } }
function AddSubmitButtonClickEventHandler(button) { if (button) { if (button.addEventListener) { button.addEventListener("click", SubmitForm, false); } else if (button.attachEvent) { button.attachEvent("onclick", SubmitForm); } } }
function ArrayContainsValue(array, val) { for (var currentKey in array) { if (array[currentKey]==val) { return true; } } return false; }
function validatePromotionCode() { var promCodeBtn=document.getElementById('ValidatePromotionCode'); AddPromotionCodeClickEventHandler(promCodeBtn); }
function AddPromotionCodeClickEventHandler(button) { if (button) { if (button.addEventListener) { button.addEventListener("click", validatePromCode, false); } else if (button.attachEvent) { button.attachEvent("onclick", validatePromCode); } } }
function validatePromCode(e) { var promCodeText=trimmedValue(document.getElementById('PromotionCode')); if (promCodeText=="") { document.getElementById('PromotionCodeError').innerHTML='Please enter a valid promotion code'; if (e.preventDefault) { e.preventDefault(); } e.returnValue=false; } }
var lZ=[0,6];
var HX="#e0e0e0";
var pH="Tahoma";
var AV=2;
var HM=new Date();
var zT=HM.getDate();
var ZM=HM.getMonth();
var om=HM.getFullYear();
var gik; FO=(navigator.appName.indexOf("Netscape")!=-1)?true:false; JX=(navigator.appName.indexOf("Microsoft")!=-1)?true:false; DP.SS=["January","February","March","April","May","June","July","August","September","October","November","December"]; DP.cj=[31,28,31,30,31,30,31,31,30,31,30,31]; DP.lcj=[31,29,31,30,31,30,31,31,30,31,30,31];
function DP(b7,K6,qG,k8,TY,tb) { if((qG==null)&&(k8==null)) return; if(K6==null) this.ik=gik; else this.ik=K6; if(qG==null) { this.miName=null; this.mi=null; this.Nf=true; } else { this.miName=DP.fG(qG); this.mi=new Number(qG); this.Nf=false; } this.Lp=k8; this.rM=TY; this.Il="white"; this.Ol="black"; this.RN="black"; this.D1="black"; this.tb=tb; if(eval(tb)) this.H1=b7; else { this.H1=b7; } } DP.fG=DPgm; DP.uS=DPgdom; DP.zH=DP_zH;
function DPgm(monthNo) { return DP.SS[monthNo]; }
function DPgdom(monthNo,k8) { if((k8%4)==0) { if((k8%100)==0&&(k8%400)!=0) return DP.cj[monthNo]; return DP.lcj[monthNo]; } else return DP.cj[monthNo]; }
function DP_zH(qG,k8,incr) { var eG=new Array(); if(incr==-1) { if(qG==0) { eG[0]=11; eG[1]=parseInt(k8)-1; } else { eG[0]=parseInt(qG)-1; eG[1]=parseInt(k8); } } else if(incr==1) { if(qG==11) { eG[0]=0;eG[1]=parseInt(k8)+1; } else { eG[0]=parseInt(qG)+1; eG[1]=parseInt(k8); } } return eG; } new DP();
DP.prototype.NZ=function() { var KT="";
var p0="";
var Hq=""; KT=KT+"<TABLE BORDER=1 BGCOLOR=\""+this.Il+"\">"; p0=this.Xv(); Hq=this.r7(); KT=KT+p0+Hq; KT=KT+"</TABLE>"; return KT; }
DP.prototype.show=function() { var KT=""; this.ik.document.open(); this.mU("<html>"); this.mU("<head><title>Calendar</title>"); this.mU("</head>"); this.mU("<body onblur=\"self.focus();\" "+"link=\""+this.uH+"\" "+"vlink=\""+this.uH+"\" "+"alink=\""+this.uH+"\" "+"text=\""+this.RN+"\">"); this.UZ("<FONT FACE='"+pH+"' SIZE=2><B>"); this.UZ(this.miName+" "+this.Lp); this.UZ("</B><BR>");
var e_=DP.zH(this.mi,this.Lp,-1);
var NN=e_[0];
var wE=e_[1];
var d_=DP.zH(this.mi,this.Lp,1);
var zm=d_[0];
var Tx=d_[1]; this.mU("<TABLE WIDTH='100%' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>"); if(eval(this.tb)) { this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+this.mi+"', '"+(parseInt(this.Lp)-1)+"', '"+this.rM+"', '"+this.tb+ "');"+"\"><<<\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+NN+"', '"+wE+"', '"+this.rM+"', '"+this.tb+ "');"+"\"><<\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+zm+"', '"+Tx+"', '"+this.rM+"', '"+this.tb+ "');"+"\">><\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+this.mi+"', '"+(parseInt(this.Lp)+1)+"', '"+this.rM+"', '"+this.tb+ "');"+"\">>><\/A>]</TD></TR></TABLE><BR>"); } else { this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+this.mi+"', '"+(parseInt(this.Lp)-1)+"', '"+this.rM+"'"+");"+"\"><<<\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+NN+"', '"+wE+"', '"+this.rM+"'"+");"+"\"><<\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+zm+"', '"+Tx+"', '"+this.rM+"'"+");"+"\">><\/A>]</TD><TD ALIGN=center>"); this.mU("[<A HREF=\""+"javascript:window.opener.Bd("+"'"+this.H1+"', '"+this.mi+"', '"+(parseInt(this.Lp)+1)+"', '"+this.rM+"'"+");"+"\">>><\/A>]</TD></TR></TABLE><BR>"); } KT=this.NZ(); this.mU(KT); this.mU("</font></body></html>"); this.ik.document.close(); }
DP.prototype.mU=function(wtext) { this.ik.document.writeln(wtext); }
DP.prototype.UZ=function(wtext) { this.ik.document.write(wtext); }
DP.prototype.Xv=function() { var KT=""; KT=KT+"<TR>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Sun</B></FONT></TD>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Mon</B></FONT></TD>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Tue</B></FONT></TD>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Wed</B></FONT></TD>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Thu</B></FONT></TD>"; KT=KT+"<TD WIDTH='14%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Fri</B></FONT></TD>"; KT=KT+"<TD WIDTH='16%'><FONT SIZE='2' FACE='"+pH+"' COLOR='"+this.D1+"'><B>Sat</B></FONT></TD>"; KT=KT+"</TR>"; return KT; }
DP.prototype.r7=function() { var Cp=new Date(); Cp.setDate(1); Cp.setMonth(this.mi); Cp.setFullYear(this.Lp);
var wb=Cp.getDay();
var pa=1;
var Ox=DP.uS(this.mi,this.Lp);
var rA=0;
var KT=""; KT=KT+"<TR>"; for(i=0;i<wb;i++) { KT=KT+"<TD WIDTH='14%'"+this.eu(i)+"><FONT SIZE='2' FACE='"+pH+"'> </FONT></TD>"; };
var iK=false; for(j=wb;j<7;j++) { KT=KT+"<TD WIDTH='14%'"+this.eu(j)+"><FONT SIZE='2' FACE='"+pH+"'>"; KT=KT+this.Ep(pa)+this.v8(pa)+"</A>";KT=KT+"</FONT></TD>"; pa++; }; KT=KT+"</TR>";
var iK=false; for(k=2;k<7;k++) { KT=KT+"<TR>"; for(j=0;j<7;j++) { KT=KT+"<TD WIDTH='14%'"+this.eu(j)+"><FONT SIZE='2' FACE='"+pH+"'>"; for(i=0;i<lZ.length;i++) { if(j==lZ[i]) { iK=true;break; } else { iK=false; } } KT=KT+this.Ep(pa)+this.v8(pa)+"</A>"; KT=KT+"</FONT></TD>"; pa++; if(pa>Ox) { rA=1;break; } } if(j==6) KT=KT+"</TR>"; if(rA==1) break; }; for(m=1;m<(7-j);m++) { KT=KT+"<TD WIDTH='14%'"+this.eu(j+m)+"><FONT SIZE='2' FACE='"+pH+"' COLOR='gray'>"+m+"</FONT></TD>"; }; return KT; }
DP.prototype.v8=function(pa) { var za=HM.getDate();
var mf=HM.getMonth();
var cA=HM.getFullYear(); if(pa==za && this.mi==mf&&this.Lp==cA) return("<FONT COLOR=\"RED\"><B>"+pa+"</B></FONT>"); else return(pa); }
DP.prototype.eu=function(pa) { var i; for(i=0;i<lZ.length;i++) { if(pa==lZ[i]) return(" BGCOLOR=\""+HX+"\""); } return""; }
DP.prototype.Ep=function(p_day) { var xT;
var s8=1+this.mi; s8=(s8.toString().length<2)?"0"+s8:s8;
var FM=DP.fG(this.mi).substr(0,3).toUpperCase();
var B2=DP.fG(this.mi).toUpperCase();
var SQ=new String(this.Lp);
var LQ=new String(this.Lp.substr(2,2));
var vQ=(p_day.toString().length<2)?"0"+p_day:p_day; SQ=SQ.substring(2,4);
var dtVal=vQ + "/" + s8 + "/" + SQ; return("<A HREF='#' onClick=\"javascript:self.opener.document.forms[0]."+this.H1+".value='"+dtVal+"';window.close();self.opener.document.forms[0].PurchaseDate.focus();\">"); }
function Bd(b7,qG,k8,TY) { var K6=gik; mb=new DP(b7,K6,qG,k8,TY); mb.Il="white"; mb.uH="black"; mb.RN="black"; mb.D1="darkgreen"; if(mb.Nf) mb.showY(); else mb.show(); }
function PurchaseDateCalendarMouseDown() { purchaseDateCalenderIconClicked=true; }
function show_DP() { b7=arguments[0]; urs=arguments[3]; if(b7=='PurchaseDate') { purchaseDateCalenderIconClicked=false; } if(eval(urs)) df="document.forms[0]."+b7+".disabled"; else if(urs !="" || urs==null) df="document.forms[0]."+b7+".disabled"; else df="document.forms[0]."+b7+".disabled"; if(eval(df)==false) { qG=new String(HM.getMonth()); k8=new String(HM.getFullYear().toString()); TY="DD/MM/YYYY"; FX=window.open("","DP","width=250,height=240,status=no,resizable=no,top=200,left=200"); FX.opener=self; gik=FX; Bd(b7,qG,k8,TY); } }
function cardaddress() { if($("#HolderName").length){$("#HolderName").focus();} document.getElementById("CardAddress").style.display=""; }
function pageLoad() { if(document.getElementById("CardAddress")) document.getElementById("CardAddress").style.display="none"; }
function my_function(controlid) { var focuid=controlid.substring(3); $("#"+focuid).focus(); }
function my_functionforVIN(controlid) { $("#"+controlid).focus(); if(controlid !="VRM") { $("#"+controlid).css("background-color","#FFFFCC"); $("#"+controlid).blur(function () {$("#"+controlid).css("background-color","white"); }) } else { $("div.Container div.Error").html(""); if ($("#errordetails")){$("#errordetails").html('');} $("div.continueButtonContainer #Errordiv").html(""); } $("#errormessage").css("display","none"); globalBlurBuster=false; }
function my_functionlogin(controlid) { $("#"+controlid).focus(); }
function pos(obj) { objTop=0; if(document.getElementById(obj) !=null) { var temp=document.getElementById(obj); while (temp.offsetParent) { objTop +=temp.offsetTop; temp=temp.offsetParent } } return objTop; }
function getWindowHeight() { var myWidth=0, myHeight=0; if( typeof( window.innerWidth )=='number' ) { myWidth=window.innerWidth; myHeight=window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { myWidth=document.documentElement.clientWidth; myHeight=document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { myWidth=document.body.clientWidth; myHeight=document.body.clientHeight; } return myHeight; }
function PersonalDetailsCreateErrorDiv() { $("#PicklistItemAddr").bgiframe(); isPostCodeError=false; if(!globalBlurBuster) { var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');} if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')) { $('input.Free').each(function() { var divid=this.id; errordivid=divid+"Error"; $("#" + errordivid).css("display","none"); if($("#" + errordivid).text().length>1) { $("#errormessage").bgiframe(); $("#errormessage").css("display","block"); errorcount=errorcount+1;
var controlid=this.id; if ($("#errordetails")) { var id="#labelIDfor_"+this.id;
var label=$(id).text().substring(0,($(id).text().length)-1).replace(':','');
var desc=$("#" + errordivid).text(); $("#errordetails").append(CreateErrorRow(errorcount,this.id,label,desc)); } } }) }; ShowErrorDiv(errorcount); } }
function scrollToPosition(formid) { if(!globalEmptyDivBuster) { if(document.getElementById("errormessage") !=null) { var errHeight=document.getElementById("errormessage").offsetHeight; if(errHeight > 0) { var emptyDiv=document.getElementById("personalDetailsEmptyDiv");
var errpos=getWindowHeight()-errHeight-20;
var elePos=pos(formid)-document.documentElement.scrollTop; if(elePos > errpos) { if(emptyDiv) { emptyDiv.style.display="block"; document.getElementById(formid).scrollIntoView(true); $("#personalDetailsEmptyDiv").height(errHeight); globalEmptyDivBuster=true; } } else if(document.documentElement.scrollTop==0) { if(document.getElementById("personalDetailsEmptyDiv") !=null) document.getElementById("personalDetailsEmptyDiv").style.display="none"; } } } } if(getWindowHeight() < document.getElementById("container").offsetHeight) $("body").css("height","auto"); else $("body").css("height","100%"); }; if ($("#secondparaeditdetails").length){$("#EMailAddress").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#secondparaeditdetails").length){$("#EMailAddress").focus(function () { globalEmptyDivBuster=false; scrollToPosition("EMailAddress"); });} if ($("#TelephoneNumber").length){$("#TelephoneNumber").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#TelephoneNumber").length){$("#TelephoneNumber").focus(function () { globalEmptyDivBuster=false; scrollToPosition("TelephoneNumber"); });} if ($("#Title").length){$("#Title").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Title").length){$("#Title").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Title"); });} if ($("#FindAddress").length) { $("#FindAddress").blur(function (e) { ValidateOnChange(e); if(globalBlurBuster) globalBlurBuster=false; }); } if ($("#FindAddress").length) { $("#FindAddress").focus(function () { globalEmptyDivBuster=false; globalBlurBuster=true; scrollToPosition("FindAddress"); }); } if($("#FindAddress").length) { $("#FindAddress").mouseenter(function (){ globalBlurBuster=true; }); } if($("#FindAddress").length) { $("#FindAddress").mouseleave(function (){ globalBlurBuster=false; }); } if ($("#Forename").length){$("#Forename").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Forename").length){$("#Forename").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Forename"); });} if ($("#Buildingnumberorname").length){$("#Buildingnumberorname").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Buildingnumberorname").length){$("#Buildingnumberorname").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Buildingnumberorname"); });} if ($("#Address1").length){$("#Address1").blur(function (e) { ValidateOnChange(e); if(globalBlurBuster) globalBlurBuster=false; PersonalDetailsCreateErrorDiv(); });} if ($("#Address1").length){$("#Address1").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Address1"); });} if ($("#Address2").length){$("#Address2").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Address2").length){$("#Address2").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Address2"); });} if ($("#Town").length){$("#Town").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Town").length){$("#Town").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Town"); });} if ($("#County").length){$("#County").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#County").length){$("#County").focus(function () { globalEmptyDivBuster=false; scrollToPosition("County"); });} if ($("#Surname").length){$("#Surname").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Surname").length){$("#Surname").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Surname"); });} if( ($("#FourthparaPersonaldetails").length || $("#secondparaeditdetails").length)) { if ($("#Postcode").length){$("#Postcode").blur(function (e) { ValidateOnChange(e); PersonalDetailsCreateErrorDiv(); });} if ($("#Postcode").length){$("#Postcode").focus(function () { globalEmptyDivBuster=false; if(globalBlurBuster) globalBlurBuster=false; scrollToPosition("Postcode"); });} } if ($("#FourthparaPersonaldetails").length){$("#continue").click(function (){ globalBlurBuster=false; ValidateForm(true); PersonalDetailsCreateErrorDiv(); if(globalErrorCount > 0) return false; });} if ($("#FourthparaPersonaldetails").length){$("#continue").focus(function () { globalEmptyDivBuster=false; scrollToPosition("continue"); });} if ($("#FourthparaPersonaldetails").length){$("#continue").mouseenter(function (){ globalBlurBuster=true; });} if ($("#FourthparaPersonaldetails").length){$("#continue").mouseleave(function () { globalBlurBuster=false; });} if ($("#secondparaeditdetails").length){$("#continue").click(function (){ globalBlurBuster=false; PersonalDetailsCreateErrorDiv(); if(globalErrorCount > 0) return false; });} if ($("#secondparaeditdetails").length){$("#continue").focus(function () { globalEmptyDivBuster=false; scrollToPosition("continue"); });} if ($("#secondparaeditdetails").length){$("#continue").mouseenter(function (){ globalBlurBuster=true; });} if ($("#secondparaeditdetails").length){$("#continue").mouseleave(function () { globalBlurBuster=false; });}
function TrimPeriodFromError(message) { var check=message.substring((message.length-1),message.length); if(check==".") { return message.substring(0,(message.length-1)); } else return message; }
function PaymentDetailsCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var errorcount=0; $("#errormessage").css("display","block"); $("#errormessage").bgiframe(); $("#ExperianTCError").css("display","none"); $("#IndemnityTCError").css("display","none"); $("#CardTypeError").css("display","none"); $("#ExpiryYearError").css("display","none"); $("#ExpiryMonthError").css("display","none"); $("#IssueYearError").css("display","none"); $("#TestFlagError").css("display","none"); $("#IssueNumberError").css("display","none"); $("#SecurityCodeError").css("display","none"); $("#CardNumberError").css("display","none"); ValidateOnChange();
var cardtypevalue=$("#CardType option:selected").text();
var validfrommonthvalue=$("#IssueMonth option:selected").text();
var validfromyearvalue=$("#IssueYear option:selected").text();
var expiryMonthValue=$("#ExpiryMonth option:selected").text();
var expiryYearValue=$("#ExpiryYear option:selected").text(); if($("#CardNumberError").text().length>1) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"CardNumber","Card Number", $("#CardNumberError").text().replace('.',''))); } if($("#CardTypeError").text().length>1) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"CardType","Card Type", $("#CardTypeError").text())); } if(cardtypevalue=="Solo" || cardtypevalue=="Maestro") { if(hasSoloMaestroDependentBlurFired && hasSoloMaestroDependentMonthBlurFired && hasSoloMaestroBlurFired) { if($("#IssueNumber").val().length==0 && validfrommonthvalue=="Month" && validfromyearvalue=="Year") { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,'IssueMonth','Valid From / Issue Number','For this Card Type, please enter a Valid From date or Issue Number')); } } } if($("#ExpiryYearError").text().length>1) { var yearerror=$("#ExpiryYearError").text(); if(yearerror.substring((yearerror.length-1),yearerror.length)=="r") { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"ExpiryYear","Expiry Year", $("#ExpiryYearError").text())); } else { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"ExpiryMonth","Expiry Month", $("#ExpiryYearError").text())); } } else if($("#ExpiryMonthError").text().length>1) { var yearerror=$("#ExpiryYearError").text(); if(yearerror.substring((yearerror.length-1),yearerror.length)=="r") { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"ExpiryYear","Expiry Year", $("#ExpiryMonthError").text())); } else { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"ExpiryMonth","Expiry Month", $("#ExpiryMonthError").text())); } } if(hasSoloMaestroDependentBlurFired && validfrommonthvalue=="Month" && validfromyearvalue!="Year" && hasComefromIssueMonth && isOutofIssueYear) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"IssueMonth","Valid From Month", "Please enter a Valid From Month")); } if(validfrommonthvalue!="Month" && validfromyearvalue=="Year" && hasComefromIssueMonth && isOutofIssueYear) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"IssueYear","Valid From Year", "Please enter a Valid From Year")); } if($("#SecurityCodeError").text().length>1) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"SecurityCode","Security Code", $("#SecurityCodeError").text().replace('.',''))); } if($("#IssueNumberError").text().length>1) { errorcount=errorcount+1;
var errorIssue=TrimPeriodFromError($("#IssueNumberError").text()); $("#errordetails").append(CreateErrorRow(errorcount,"IssueNumber","Issue Number", errorIssue)); } if($("#TestFlagError").text().length>1) { errorcount=errorcount+1; $("#errordetails").append(CreateErrorRow(errorcount,"TestFlag","Test Flag", $("#TestFlagError").text())); }
var checked=$('#ExperianTC:checked').val() !=undefined; if(checked==false && $("#ExperianTCError").text().length>1) { errorcount=parseInt(errorcount)+1; $("#errordetails").append(CreateErrorRow(errorcount,'ExperianTC',ErrHeadingPaymentCardTermAndCondition,ErrorDescPaymentCardTermAndCondition)); }
var checked=$('#IndemnityTC:checked').val() !=undefined; if(checked==false && $("#IndemnityTCError").text().length>1) { errorcount=parseInt(errorcount)+1; $("#errordetails").append(CreateErrorRow(errorcount,'IndemnityTC',ErrHeadingPaymentInsuranceTermAndCondition,ErrorDescPaymentInsuranceTermAndContion)); } ShowErrorDiv(errorcount); } } if ($("#Creditcarddetails").length) { if ($("#CardNumber").length) { $("#CardNumber").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#CardNumber").focus(function () { globalEmptyDivBuster=false; scrollToPosition("CardNumber"); }); } if ($("#SecurityCode")) { $("#SecurityCode").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#SecurityCode").focus(function () { globalEmptyDivBuster=false; scrollToPosition("SecurityCode"); }); } if ($("#ExpiryMonth").length) { $("#ExpiryMonth").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#ExpiryMonth").focus(function () { globalEmptyDivBuster=false; scrollToPosition("ExpiryMonth"); }); } if ($("#ExpiryYear").length) { $("#ExpiryYear").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#ExpiryYear").focus(function () { globalEmptyDivBuster=false; scrollToPosition("ExpiryYear"); }); } if($("#CardType").length) { $("#CardType").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#CardType").focus(function () { globalEmptyDivBuster=false; scrollToPosition("CardType"); }); } if ($("#IssueMonth").length) { $("#IssueMonth").blur(function (e) { ValidateOnChange(e); hasSoloMaestroDependentMonthBlurFired=true; hasComefromIssueMonth=true; PaymentDetailsCreateErrorDiv(); }); $("#IssueMonth").focus(function () { globalEmptyDivBuster=false; scrollToPosition("IssueMonth"); }); } if ($("#IssueYear").length) { $("#IssueYear").blur(function (e) { ValidateOnChange(e); hasSoloMaestroDependentBlurFired=true; isOutofIssueYear=true; PaymentDetailsCreateErrorDiv(); }); $("#IssueYear").focus(function () { globalEmptyDivBuster=false; scrollToPosition("IssueYear"); }); } if ($("#IssueNumber").length) { $("#IssueNumber").blur(function (e) { ValidateOnChange(e); hasSoloMaestroBlurFired=true; PaymentDetailsCreateErrorDiv(); }); $("#IssueNumber").focus(function () { globalEmptyDivBuster=false; scrollToPosition("IssueNumber"); }); $("#TestFlag").focus(function () { globalEmptyDivBuster=false; scrollToPosition("TestFlag"); }); } if($("#HolderName").length) { $("#HolderName").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#HolderName").focus(function () { globalEmptyDivBuster=false; scrollToPosition("HolderName"); }); } if($("#Street1").length) { $("#Street1").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#Street1").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Street1"); }); } if($("#Street2").length) { $("#Street2").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#Street2").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Street2"); }); } if($("#Street3").length) { $("#Street3").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#Street3").focus(function () { globalEmptyDivBuster=false; scrollToPosition("Street3"); }); } if($("#County").length) { $("#County").blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#County").focus(function () { globalEmptyDivBuster=false; scrollToPosition("County"); }); } } if ($("#termsandcondition").length) { $('#IndemnityTC').click(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#IndemnityTC").focus(function () { globalEmptyDivBuster=false; scrollToPosition("IndemnityTC"); }); $('#ExperianTC').click(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $("#ExperianTC").focus(function () { globalEmptyDivBuster=false; scrollToPosition("ExperianTC"); }); $('#IndemnityTC').blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); $('#ExperianTC').blur(function (e) { ValidateOnChange(e); PaymentDetailsCreateErrorDiv(); }); } if($("#EPDQPaymentbtn").length) { if ($("#continue").length) { $("#continue").click(function () { globalBlurBuster=false; ValidateForm(); hasSoloMaestroDependentBlurFired=true; hasSoloMaestroBlurFired=true; hasSoloMaestroDependentMonthBlurFired=true; hasComefromIssueMonth=true; isOutofIssueYear=true; PaymentDetailsCreateErrorDiv(); if(globalErrorCount > 0) return false; }); $("#continue").focus(function () { globalEmptyDivBuster=false; scrollToPosition("continue"); }); $("#continue").mouseenter(function () { globalBlurBuster=true; }); $("#continue").mouseleave(function () { globalBlurBuster=false;; }); } }
function ChangePasswordCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); $("#PasswordError").css("display","none"); $("#OldPasswordError").css("display","none"); if ($('input.Password')) { $('input.Password').each(function() { var divid=this.id; errordivid=divid+"Error"; if($("#" + errordivid).text().length>1) { erroucount=erroucount+1; if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id; if ($("#errordetails")) { var id="#labelIDfor_"+this.id;
var label=$(id).text().substring(0,($(id).text().length)-1).replace(':','');
var desc=$("#" + errordivid).text().replace("Current","Existing"); if(label=='New Password') { desc=desc.replace("Please enter a Password","Please enter a New Password") } $("#errordetails").append(CreateErrorRow(erroucount,this.id,label,desc)); } } }) } ShowErrorDiv(erroucount); return false; } } if ($("#ChangePassword").length) { if ($("#OldPassword")) { $("#OldPassword").blur(function (e) { ValidateOnChange(e); ChangePasswordCreateErrorDiv(); }); $("#OldPassword").focus(function () { $("#OldPasswordError").html(''); }); } } if ($("#ChangePassword").length) { if ($("#Password")) { $("#Password").blur(function (e) { ValidateOnChange(e); ChangePasswordCreateErrorDiv(); }); $("#Password").focus(function () { $("#PasswordError").html(''); }); } } if ($("#changpwdbtn").length){$("#continue").click(function () { globalBlurBuster=false; ValidateForm(); ChangePasswordCreateErrorDiv(); if(globalErrorCount > 0) return false; });} if ($("#changpwdbtn").length){$("#continue").mouseenter(function () { globalBlurBuster=true; });} if ($("#changpwdbtn").length){$("#continue").mouseleave(function () { globalBlurBuster=false; });}
function OnLoadHandleErrorOnChangePassword() { if ($("#ChangePassword").length && $("#OldPasswordError").text().length>3) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#OldPasswordError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'OldPassword','Existing Password',$("#OldPasswordError").text())); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnConfirmVIN() { if ($("#ConfirmVIN").length && $('div#Errordiv P').text().length > 1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $('div#Errordiv P').css("display","none"); $("#VINError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VIN','VIN',$('div#Errordiv P').text().replace("was invalid.","was invalid"))); isServerError=true; ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnLoginPage() { if($("#Login").length && $("#loginerror").text().length>0) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#loginerror").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details','The supplied login details are not valid')); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorPromotionCode() { if ($("#PromotionCode").length && $("#PromotionCodeError").text().length > 1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#PromotionCodeError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'PromotionCode','Promotion / Discount code',$("#PromotionCodeError").text())); ShowErrorDiv(erroucount); scrollToPosition("PromotionCode"); } } else { if ($("#Creditcarddetails").length ) { PaymentDetailsCreateErrorDiv(); } } }
function OnLoadHandleErrorOnHomePage() { if(!globalBlurBuster) { if ($("#panel3").length && $('div.Error P').text().length>1) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$('div.Error P').text().replace(".",". "))); ShowErrorDiv(erroucount); } else if($("#panel3").length && $('div#loginerror').text().length>3) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("#VRMError").css("display","none"); $("#loginerror").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details',$('div#loginerror').text())); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnConfirmVRMPage() { if($("#Thirdpara").length && $("#loginerror").text().length > 0) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#loginerror").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details',$("#loginerror").text())); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnViewMyCheckPage() { if ($("#UserOptions").length && $('div.Error P').text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$('div.Error P').text().replace(".",". "))); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnPersonalDetailsPage() { if ($("#PersonalDetails").length && $('P.addressmessage').text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errordetails").html(""); $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("P.addressmessage").css("display","none"); isPostCodeError=true; if ($("#PicklistItemAddr").length) { $("#errordetails").append(CreateErrorRow(erroucount,'PicklistItemAddr','Select Location',$('P.addressmessage').text().replace(".",". "))); } else { $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$('P.addressmessage').text().replace(".",". "))); } ShowErrorDiv(erroucount); } } else if ($("#PersonalDetails").length && $("#PostcodeError").text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errordetails").html(""); $("#errormessage").css("display","block"); $("#PostcodeError").css("display","none"); isPostCodeError=true; $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$("#PostcodeError").text().replace(".",". "))); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnEditDetailsPage() { if(!globalBlurBuster) { if ($("#EditDetails").length && $('P.addressmessage').text().length>3) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("P.addressmessage").css("display","none"); isPostCodeError=true; if ($("#PicklistItemAddr").length) { $("#errordetails").append(CreateErrorRow(erroucount,'PicklistItemAddr','Select Location',$('P.addressmessage').text().replace(".",". "))); } else { $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$('P.addressmessage').text().replace(".",". "))); } ShowErrorDiv(erroucount); } else if ($("#EditDetails").length && $("#PostcodeError").text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errordetails").html(""); $("#errormessage").css("display","block"); $("#PostcodeError").css("display","none"); isPostCodeError=true; $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$("#PostcodeError").text().replace(".",". "))); ShowErrorDiv(erroucount); } } } }
function OnLoadHandleErrorOnForgottenPasswordPage() { if ($("#PasswordReset").length && $('div.Error').text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $(".Error").css("display","none"); $("#Errordiv").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details',"The supplied login details are not valid")); isServerError=true; ShowErrorDiv(erroucount); } } }
function OnLoadPurchaseDateErrorMessage() { if ($("#PurchaseDate").length && $("#PurchaseDateError").text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("div.PurchaseDateError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'PurchaseDate','Purchase Date',$("#PurchaseDateError").text())); ShowErrorDiv(erroucount); } } }
function OnLoadHandleErrorOnRegisteredKeeperPage() { if(!globalBlurBuster) { if ($("#RegisteredKeeper").length && $('P.addressmessage').text().length>3) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("P.addressmessage").css("display","none"); isPostCodeError=true; if ($("#PicklistItemAddr").length) { $("#errordetails").append(CreateErrorRow(erroucount,'PicklistItemAddr','Select Location',$('P.addressmessage').text().replace(".",". "))); } else { $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$('P.addressmessage').text().replace(".",". "))); } ShowErrorDiv(erroucount); } else if ($("#RegisteredKeeper").length && $("#PostcodeError").text().length>1) { if(!globalBlurBuster) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errordetails").html(""); $("#errormessage").css("display","block"); $("#PostcodeError").css("display","none"); isPostCodeError=true; $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode',$("#PostcodeError").text().replace(".",". "))); ShowErrorDiv(erroucount); } } } }
function OnLoadHandleErrorOnPaymentDetailPage() { if(!globalBlurBuster) { if ($("#Creditcarddetails").length && $("#epdqerror").text().length>3) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#epdqerror").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,"CardNumber","Card Number",$("#epdqerror").text().replace(".",". "))); ShowErrorDiv(erroucount); } } } $(window).load(function () { if(getWindowHeight() < document.getElementById("container").offsetHeight) $("body").css("height","auto"); else $("body").css("height","100%"); OnLoadHandleErrorOnHomePage(); OnLoadHandleErrorOnLoginPage(); OnLoadHandleErrorOnConfirmVRMPage(); OnLoadHandleErrorPromotionCode(); OnLoadHandleErrorOnViewMyCheckPage(); OnLoadHandleErrorOnChangePassword(); OnLoadHandleErrorOnPersonalDetailsPage(); OnLoadHandleErrorOnEditDetailsPage(); OnLoadHandleErrorOnConfirmVIN(); OnLoadHandleErrorOnForgottenPasswordPage(); OnLoadPurchaseDateErrorMessage(); OnLoadHandleErrorOnRegisteredKeeperPage(); OnLoadHandleErrorOnPaymentDetailPage(); if($("#FOCPurchase").length) { $("#ExperianTC").focus(); } if($("#indemnityregisterinput").length){$("#PurchaseDate").focus();$("#PurchaseDateError").css("display","none");$("#PurchasePriceError").css("display","none");} if($("#secondparaeditdetails").length) { if(!isPostCodeError) { $("#EMailAddress").focus(); } else { $("#Postcode").focus(); } } if($("#notregisteredkeeper").length) { if(!isPostCodeError) { $("#RegisteredKeeperName").focus(); } else { $("#Postcode").focus(); } $("#RegisteredKeeperNameError").css("display","none"); } if($("#Logidiv").length){$("#EMailAddress").focus();$("#EMailAddressError").css("display","none");}; if ($("#PromotionCode").length && $("#PromotionCode")[0].className.toLowerCase()=='hidden') {$("#CardNumber").focus();} else if($("#PromotionCode").length) {$("#PromotionCode").focus();} if($("#pwdrest").length){$("#EMailAddress").focus();$("#EMailAddressError").css("display","none");} if ($("#personaldetailsDiv").length) { if(!isPostCodeError) { $("#Title").focus(); } else { $("#Postcode").focus(); } } if ($("#VIN").length){$("#VIN").focus();$("#VINError").css("display","none");} if ($("#VRM").length) { if(!($("#panel3").length && $('div.Error P').text().length>1)) $("#VRM").focus();$("#Errordiv").css("display","none");$("#VRMError").css("display","none"); } if($("#PromotionCode").length) $("#ExpiryYearError").css("display","none"); if ($("#ChangePassword").length) { $("#OldPassword").focus(); $("#OldPasswordError").css("display","none"); } $("#OldPasswordError").css("display","none"); $("#ExperianTCError").css("display","none"); $("#IndemnityTCError").css("display","none"); $("#CardTypeError").css("display","none"); $("#ExpiryYearError").css("display","none"); $("#ExpiryMonthError").css("display","none"); $("#IssueYearError").css("display","none"); $("#TestFlagError").css("display","none"); if($("#VINConfirmed").length || $("#IndemnityRegistered").length) { $("#continue").focus(); } if($("#AlreadyChecked").length) { $("#continueAlreadyChecked").focus(); } if($("#PasswordResetSent").length) { $(".btnFocus").focus(); } if($("#PasswordSet").length) { $(".btnFocus").focus(); } if($("#PasswordChanged").length) { $(".btnFocus").focus(); } if ($("#SetPassword").length) { $("#Password").focus(); } if (document.getElementsByTagName) { var ctr=0;
var anchors=document.getElementsByTagName("a"); if (anchors) { for (var i in anchors) { var anchor=anchors[i]; anchor.id="aTag"+ctr; ctr++; } } } if(document.getElementById("personalDetailsEmptyDiv") !=null) document.getElementById("personalDetailsEmptyDiv").style.display="none"; }); $("#cardadresslink").click(function (){ $("#CardAddress").css("display","block");if($("#HolderName")){$("#HolderName").focus();};$("#titlemessageforcreditcard").css("display","none"); $("#cardaddresslinkp").css("display","none"); $(".fulllbwrapper").css("height","auto"); if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) { $("#Creditcarddetails").css("height","389"); } if(globalErrorCount > 0) return false; });
function RegisterInsurancePageCreateErrorDiv() { if(!purchaseDateCalenderIconClicked) { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); $("#errormessage").bgiframe(); $("#PurchasePriceError").css("display","none"); $("#PurchaseDateError").css("display","none"); $("#TCAgreedError").css("display","none"); $("#TypeOfSaleError").css("display","none"); if($("#PurchaseDateError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'PurchaseDate','Purchase Date',$("#PurchaseDateError").text())); } if($("#PurchasePriceError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'PurchasePrice','Purchase Price',$("#PurchasePriceError").text())); } if($("#TypeOfSaleError").text().length>1) { var TypeofSalevalue=$("#TypeOfSale option:selected").text(); if(TypeofSalevalue=='select...') { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'TypeOfSale','Type of Sale',$("#TypeOfSaleError").text())); } } if($("#TCAgreedError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'TCAgreed','Vehicle Check Data Insurance terms and conditions',ErrorDescPaymentInsuranceTermAndContion)); } ShowErrorDiv(erroucount); } } } if ($("#indemnitybody").length) { $("#PurchasePrice").focus(function () { globalEmptyDivBuster=false; scrollToPosition("PurchasePrice"); }); $("#PurchasePrice").blur(function (e) { ValidateOnChange(e); RegisterInsurancePageCreateErrorDiv(); });} if ($("#indemnitybody").length){ $("#PurchaseDate").focus(function () { globalEmptyDivBuster=false; scrollToPosition("PurchaseDate"); }); $("#PurchaseDate").blur(function (e) { ValidateOnChange(e); RegisterInsurancePageCreateErrorDiv(); });} if ($("#indemnitybody").length) { $("#continue").focus(function () { globalEmptyDivBuster=false; scrollToPosition("continue"); }); $("#continue").click(function () { globalBlurBuster=false; ValidateForm(); RegisterInsurancePageCreateErrorDiv(); if(globalErrorCount > 0) return false; }); $("#continue").mouseenter(function () { globalBlurBuster=true; }); $("#continue").mouseleave(function () { globalBlurBuster=false; }); } if ($("#indemnitybody").length){ $("#TypeOfSale").blur(function (e) { ValidateOnChange(e); RegisterInsurancePageCreateErrorDiv(); });} if ($("#indemnitybody").length){ $("#TypeOfSale").change(function () { if(!globalBlurBuster) { RegisterInsurancePageCreateErrorDiv(); } });} if ($("#indemnitybody").length) { $('#TCAgreed').click(function (e) { ValidateOnChange(e); RegisterInsurancePageCreateErrorDiv(); }); $("#TCAgreed").blur(function (e) { ValidateOnChange(e); RegisterInsurancePageCreateErrorDiv(); }); } if ($("#enterVRMdiv").length){ if ($("#VRM").length){ $("#VRM").blur(function () { if(!globalBlurBuster) { if($('div.Error P').text().length>1){ $("#errordetails").html('');
var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $('div.Error P').css("display","none"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$('div.Error P').text())); } if($("#VRMError").text().length>1){ $("#errordetails").html('');
var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$("#VRMError").text())); } ShowErrorDiv(erroucount); } });} } if ($("#EnterVRMBTn").length){ $("#continue").click(function () { if(!globalBlurBuster) { if($('div.Error P').text().length>1){ $("#errordetails").html('');
var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $('div.Error P').css("display","none"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$('div.Error P').text())); } if($("#VRMError").text().length>1){ $("#errordetails").html('');
var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$("#VRMError").text())); } ShowErrorDiv(erroucount); if(globalErrorCount > 0) return false; } });}
function CreateErrorDivforViewMyChecks() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; if($("#VRMError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#VRMError").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$("#VRMError").text())); } ShowErrorDiv(erroucount); } } if ($("#viewMYChecks").length){ if ($("#VRM").length){ $("#VRM").blur(function (e) { ValidateOnChange(e); CreateErrorDivforViewMyChecks(); });} } if ($("#viewMYChecks").length){ $("#continue").click(function () { CreateErrorDivforViewMyChecks(); });} if($("#notregisteredkeeper").length){if ($("#RegisteredKeeperName")){$("#RegisteredKeeperName").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){ var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){$("#errormessage").bgiframe();$("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){ var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#Buildingnumberorname")){ $("#Buildingnumberorname").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');} if ($("#errorcount")){$("#errorcount").html('');}if ($('input.Free')){$('input.Free').each(function(){ var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){ $("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#Address1")){$("#Address1").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){ $("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#Address2")){$("#Address2").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){ var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){$("#errormessage").css("display","block"); errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}var controlid=this.id;if ($("#errordetails")){ var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#Town")){$("#Town").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){ var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){ $("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#County")){$("#County").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){ $("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if($("#notregisteredkeeper").length){if ($("#Postcode")){$("#Postcode").blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var errorcount=0; if ($("#errordetails")){$("#errordetails").html('');}if ($("#errorcount")){$("#errorcount").html('');} if ($('input.Free')){$('input.Free').each(function(){var divid=this.id;errordivid=divid+"Error";if($("#" + errordivid).text().length>1){ $("#errormessage").css("display","block");errorcount=errorcount+1;if ($("#" + errordivid)){$("#" + errordivid).css("display","none");}
var controlid=this.id;if ($("#errordetails")){var id="#labelIDfor_"+this.id; $("#errordetails").append(CreateErrorRow(errorcount,this.id,$(id).text().substring(0,($(id).text().length)-1).replace(':',''),$("#" + errordivid).text())); }}})}; ShowErrorDiv(errorcount); } });}} if ($("#registerkeepersubmitbutton").length){ $("#continue").mouseenter(function () { globalBlurBuster=true; }); $("#continue").mouseleave(function () { globalBlurBuster=false; }); $("#continue").click(function (){ globalBlurBuster=false; ValidateForm(true); PersonalDetailsCreateErrorDiv(); if(globalErrorCount > 0) return false; });} if ($("#closeerrordiv")) { $("#closeerrordiv").click(function() { if ($("#errormessage")) { $("#errormessage").css("display","none"); if(document.getElementById("personalDetailsEmptyDiv") !=null) document.getElementById("personalDetailsEmptyDiv").style.display="none"; if($("body") && document.getElementById("container") !=null) { if(getWindowHeight() < document.getElementById("container").offsetHeight) $("body").css("height","auto"); else $("body").css("height","100%"); } } }) } $("#EXISTINGUSER-yes").click(function(){ $('div.optoutContainer').css("display","none"); }); $("#EXISTINGUSER-").click(function(){ $('div.optoutContainer').css("display","block"); }); if ($("#focsubmitbutton").length){ $("#continue").click(function () { if(!globalBlurBuster) { var checked=$('#IndemnityTC:checked').val() !=undefined; if(checked==false) { errorHoldInsurance=true; } else { errorHoldInsurance=false; } checked=$('#ExperianTC:checked').val() !=undefined; if(checked==false) { errorHoldTC=true; } else { errorHoldTC=false; } CreatefocpurchasedetailsError(); if(globalErrorCount > 0) return false; } });}
function CreatefocpurchasedetailsError() { $("#errordetails").html(''); $("#ExperianTCError").css("display","none"); $("#IndemnityTCError").css("display","none"); $("#errormessage").css("display","block");
var erroucount=0; if(!globalBlurBuster) { if(errorHoldTC==true) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'ExperianTC',ErrHeadingPaymentCardTermAndCondition,ErrorDescPaymentCardTermAndCondition)); } if(errorHoldInsurance==true) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'IndemnityTC',ErrHeadingPaymentInsuranceTermAndCondition,ErrorDescPaymentInsuranceTermAndContion)); } ShowErrorDiv(erroucount); } } if($("#focpurchasedetails").length){ $('#IndemnityTC').blur(function (e) { if(!globalBlurBuster) { ValidateOnChange(e);
var checked=$('#IndemnityTC:checked').val() !=undefined; if(checked==false) { errorHoldInsurance=true; } else { errorHoldInsurance=false; } CreatefocpurchasedetailsError(); } }); $('#IndemnityTC').click(function (e){ ValidateOnChange(e); if(!globalBlurBuster) { var checked=$('#IndemnityTC:checked').val() !=undefined; if(checked==false) { errorHoldInsurance=true; } else { errorHoldInsurance=false; } CreatefocpurchasedetailsError(); } })} if($("#focpurchasedetails").length){ $('#ExperianTC').blur(function (e) { ValidateOnChange(e); if(!globalBlurBuster) { var checked=$('#ExperianTC:checked').val() !=undefined; if(checked==false) { errorHoldTC=true; } else { errorHoldTC=false; } CreatefocpurchasedetailsError(); } }); $('#ExperianTC').click(function (e) { ValidateOnChange(e); if(!globalBlurBuster) { var checked=$('#ExperianTC:checked').val() !=undefined; if(checked==false) { errorHoldTC=true; } else { errorHoldTC=false; } CreatefocpurchasedetailsError(); } })}
function CreateErrorRow(count,functionParam,errorLabel,errorDesc) { var rowHTML='';
var idName="errDiv" + functionParam;
functionParam="'"+functionParam+"'";
var cornerImagesHtml="<img class='topleft' src='/Vehiclecheck2/images/crn_error_tl.gif'/><img class='topright' src='/Vehiclecheck2/images/crn_error_tr.gif'/><img class='bottomleft' src='/Vehiclecheck2/images/crn_error_bl.gif'/><img class='bottomright' src='/Vehiclecheck2/images/crn_error_br.gif'/>"; $("#errordetails").append(cornerImagesHtml); rowHTML="<div id="+idName+" class='errorContainerDiv'><div class='errorImg' id='errorImg_"+ count +"'>&#160;</div><div class='eororOne'><a onclick=javascript:my_functionforVIN("+ functionParam +");><p class='ColorRed' style='display:inline;'><b>" + errorLabel +"</b></p></a><span class='ColorBlack' style='display:block;'>"+ errorDesc +"</span></div>"; rowHTML=rowHTML+"<div class='blankErrorRow'>&nbsp;</div>"; return rowHTML; }
function ShowErrorDiv(erroucount) { globalErrorCount=0; globalErrorCount=parseInt(erroucount); if(parseInt(erroucount)==0) {$("#errormessage").css("display","none");} else { $("#errorcount").html(''); $("#errortext").html(''); $("#errorheaddingh2").html(''); $("#errorcount").append(erroucount); if(parseInt(erroucount)==1) { $("#errorheaddingh2").append("error occured"); $("#errortext").append("Click on the error below to jump to the affected field/area on the page"); } else { $("#errorheaddingh2").append("errors occured"); $("#errortext").append("Click on the errors below to jump to the affected field/area on the page"); }
var strBrowser=readCookie('Browser');
var strVersion=readCookie('BrowserVersion'); if(strBrowser=='IE') { if(strVersion=='6') positionErrorDiv(); } } } $("#EMailAddress").focus(function () { $("#loginerror").html(''); }); $("#Password").focus(function () { $("#loginerror").html(''); });
function ConfirmVRMPageCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); $("#EMailAddressError").css("display","none"); $("#PasswordError").css("display","none"); $('div.ValidationErrors').css("display","none"); $("#MileageError").css("display","none"); if($("#EMailAddressError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Email Address',$("#EMailAddressError").text())); } if($("#PasswordError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Password','Password',$("#PasswordError").text())); } if($("#MileageError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Mileage','Mileage',$("#MileageError").text())); } ShowErrorDiv(erroucount); } } if($("#Thirdpara").length) { $("#EMailAddress").blur(function (e) { ValidateOnChange(e); ConfirmVRMPageCreateErrorDiv(); }); } if($("#secondpara").length){ $("#Mileage").blur(function (e) { ValidateOnChange(e); ConfirmVRMPageCreateErrorDiv(); });} if($("#Thirdpara").length){ $("#Password").blur(function (e) { ValidateOnChange(e); ConfirmVRMPageCreateErrorDiv(); });} if($("#ConfirmVRMbutton").length){ $("#continue").click(function () { globalBlurBuster=false; ConfirmVRMPageCreateErrorDiv(); if(globalErrorCount > 0) return false; }); $("#continue").mouseenter(function () { globalBlurBuster=false; }); $("#continue").mouseleave(function () { globalBlurBuster=true; }); }
function ConfirmVINPageCreateErrorDiv() { if(!globalBlurBuster) { var erroucount; if(!isServerError) { $("#errordetails").html(''); erroucount=0; } else { erroucount=1; } $("#errormessage").css("display","block"); $('div#Errordiv P').css("display","none"); $("#VINError").css("display","none"); if($("#VIN").val().length > 0) { if($("#VINError").text().length>1){ if(isServerError) { $("#errordetails").html(''); erroucount=0; isServerError=false; } erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VIN','VIN',$("#VINError").text())); } } else { if(isServerError) { $("#errordetails").html(''); erroucount=0; isServerError=false; } erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VIN','VIN','Please enter a VIN')); } ShowErrorDiv(erroucount); } } if ($("#ConfirmVINbtn").length){ $("#continue").click(function () { globalBlurBuster=false; if(isServerError) { isServerError=false; globalErrorCount=0; } ConfirmVINPageCreateErrorDiv(); if(globalErrorCount > 0) return false; }); $("#continue").mouseenter(function () { globalBlurBuster=false; }); $("#continue").mouseleave(function () { globalBlurBuster=true; }); } if ($("#ConfirmVINbtn").length) { $("#VIN").blur(function (e) { ValidateOnChange(e); ConfirmVINPageCreateErrorDiv(); }); }
function LoginPageCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; ValidateOnChange(); $("#errormessage").css("display","block"); $("#EMailAddressError").css("display","none"); if($("#loginerror").length){$("#loginerror").css("display","none");} $("#PasswordError").css("display","none"); if($("#EMailAddressError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Email Address',$("#EMailAddressError").text())); } if($("#loginerror").text().length>5){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details','The supplied login details are not valid')); } if($("#PasswordError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Password','Password',$("#PasswordError").text())); } ShowErrorDiv(erroucount); } } if($("#Logidiv").length) { $("#EMailAddress").blur(function (e) { ValidateOnChange(e); LoginPageCreateErrorDiv(); }); $("#Password").blur(function (e) { ValidateOnChange(e); LoginPageCreateErrorDiv(); }); } if($("#loginbtn").length){ $("#continue").click(function () { globalBlurBuster=false; LoginPageCreateErrorDiv(); if(globalErrorCount > 0) return false; }); $("#continue").mouseenter(function () { globalBlurBuster=false; }); $("#continue").mouseleave(function () { globalBlurBuster=true; }); }
function PasswordResetPageCreateErrorDiv() { if(!globalBlurBuster) { var erroucount; if(!isServerError) { $("#errordetails").html(''); erroucount=0; } else { erroucount=1; } $("#errormessage").css("display","block"); $("#EMailAddressError").css("display","none"); if($("#loginerror").length){$("#loginerror").css("display","none");} if($("#EMailAddressError").text().length>1) { if(isServerError) { $("#errordetails").html(''); erroucount=0; isServerError=false; } erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Email Address',$("#EMailAddressError").text())); } ShowErrorDiv(erroucount); } } if ($("#pwdrest").length) { $("#EMailAddress").blur(function (e) { ValidateOnChange(e); PasswordResetPageCreateErrorDiv(); }); } if ($("#pwdresetbtn").length){ $("#continue").click(function () { if(isServerError) { isServerError=false; globalErrorCount=0; } PasswordResetPageCreateErrorDiv(); if(globalErrorCount > 0) return false; }); }
function SetPasswordPageCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); $("#PasswordError").css("display","none"); if($("#PasswordError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Password','Password',$("#PasswordError").text())); } ShowErrorDiv(erroucount); } } if ($("#setpwd").length){ $("#Password").blur(function (e) { ValidateOnChange(e); SetPasswordPageCreateErrorDiv(); });} if ($("#setpwdbtn").length){ $("#continue").click(function () { SetPasswordPageCreateErrorDiv(); if(globalErrorCount > 0) return false; });}
function HomePageCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var erroucount=0; $("#PasswordError").css("display","none"); $("#EMailAddressError").css("display","none"); $("#VRMError").css("display","none"); $("#Errordiv").css("display","none"); $("#errormessage").css("display","block"); if($("#VRM").length) { if(jQuery.trim($("#VRM").val()).length==0) { if($("#EMailAddress") && $("#EMailAddress").val() !=null && jQuery.trim($("#EMailAddress").val()).length==0) { if(isOutofVRM && isOutofEmail) { $("#errormessage").css("display","block"); erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM','VRM or email address must be entered')); ShowErrorDiv(erroucount); return false; } } else { $("#errordetails").html(''); erroucount=0; } } } if($("#EMailAddress").length) { if(jQuery.trim($("#EMailAddress").val()).length>1 && jQuery.trim($("#VRM").val()).length==0) { if($("#EMailAddressError").text().length>1){ erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Email Address',$("#EMailAddressError").text())); } if($("#PasswordError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Password','Password',$("#PasswordError").text())); } } } if($("#VRMError").text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$("#VRMError").text())); } if($('div.Error P').text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$('div.Error P').text())); } if($("#VRMError").text().length>1) { if($('div.Error P').text().length>1) { erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'VRM','VRM',$("#VRMError").text())); } } if($("#panel3").length && $('div#loginerror').text().length>3) { var erroucount=0; erroucount=parseInt(erroucount)+1; $("#errormessage").css("display","block"); $("#Errordiv").css("display","none"); $("#VRMError").css("display","none"); $("#loginerror").css("display","none"); $("#errordetails").append(CreateErrorRow(erroucount,'EMailAddress','Login Details',$('div#loginerror').text())); } ShowErrorDiv(erroucount); } } if ($("#panel3").length){ $("#EMailAddress").blur(function (e) { isOutofEmail=true; ValidateOnChange(e); HomePageCreateErrorDiv(); }); } if ($("#panel3").length){ $("#Password").blur(function (e) { isOutofEmail=true; ValidateOnChange(e); HomePageCreateErrorDiv(); });} if ($("#panel3").length){ $("#VRM").blur(function (e) { isOutofVRM=true; ValidateOnChange(e); HomePageCreateErrorDiv(); });} if ($("#panel3").length){ $("#VRM").focus(function () { $('div.Error P').html(''); });} if ($("#panel3").length) { $("#submit").click(function (e) { ValidateOnChange(e); globalBlurBuster=false; isOutofVRM=true; isOutofEmail=true; HomePageCreateErrorDiv();
var erroucount=parseInt(globalErrorCount); if($("#EMailAddress").length) { if(jQuery.trim($("#EMailAddress").val()).length>1 && jQuery.trim($("#VRM").val()).length==0) { if($("#PasswordError").text().length>1) { } else if(jQuery.trim($("#Password").val()).length==0 ) { globalBlurBuster=true; $("#errormessage").css("display","block"); erroucount=parseInt(globalErrorCount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Password','Password','Please enter a Password')); ShowErrorDiv(erroucount); } } } if(globalErrorCount > 0) return false; } ); }
function FindAddressCreateErrorDiv() { if($("#Postcode").val().length==0) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'Postcode','Postcode','Please enter a Postcode')); ShowErrorDiv(erroucount); $("div.Container div.Error").html(""); } else globalErrorCount=0; } if ($("#personaldetailsDiv").length){ if ($("#Postcode").length){ $("#FindAddress").click(function () { globalBlurBuster=true; FindAddressCreateErrorDiv(); if(globalErrorCount > 0) return false; } );}}
function FindAddressCreatePicklistErrorDiv() { if($("#PicklistItemAddr option:selected").text().length==0) { $("#errordetails").html('');
var erroucount=0; $("#errormessage").css("display","block"); erroucount=parseInt(erroucount)+1; $("#errordetails").append(CreateErrorRow(erroucount,'PicklistItemAddr','Select Location','Please select a location')); ShowErrorDiv(erroucount); $("div.Container div.Error").html(""); } else globalErrorCount=0; } if ($("#PicklistItemAddr").length){ $("#FindAddress").click(function () { globalBlurBuster=true; FindAddressCreatePicklistErrorDiv(); if(globalErrorCount > 0) return false; } );} if ($("#secondparaeditdetails").length){ if ($("#Postcode").length){ $("#FindAddress").click(function () { globalBlurBuster=true; FindAddressCreateErrorDiv(); if(globalErrorCount > 0) return false; } );}} if ($("#notregisteredkeeper").length){ if ($("#Postcode").length){ $("#FindAddress").click(function () { globalBlurBuster=true; FindAddressCreateErrorDiv(); if(globalErrorCount > 0) return false; } );}}
function PromotionCodeCreateErrorDiv() { if(!globalBlurBuster) { $("#errordetails").html('');
var errorcount=0; $("#errormessage").css("display","block"); $("#PromotionCodeError").css("display","none"); $("#errordetails").html(''); if($("#PromotionCodeError").text().length > 1) { errorcount=parseInt(errorcount)+1; $("#errordetails").append(CreateErrorRow(errorcount,'PromotionCode','Promotion / Discount code',$("#PromotionCodeError").text())); } ShowErrorDiv(errorcount); } } if($("#ValidatePromotionCode").length) { $("#ValidatePromotionCode").click(function (e) { validatePromCode(e); PromotionCodeCreateErrorDiv(); scrollToPosition("PromotionCode"); } ); $("#PromotionCode").blur(function (e) { ValidateOnChange(e); PromotionCodeCreateErrorDiv(); });}
function displayHelpCallout(divid,isDisplay,evt) { var posx=null;
var posy=null; if(isDisplay) { var tooltip=document.getElementById(divid);
var e=(window.event) ? window.event : evt; if(window.event) { posx=e.pageX ; posy=e.pageY; } else { posx=e.pageX; posy=e.pageY; } alert("left"+posx); alert("top"+posy); tooltip.style.left=(posx-150)+"px"; tooltip.style.top=120+"px"; alert("left"+tooltip.style.left); alert("top"+tooltip.style.top); tooltip.style.display="block"; } else document.getElementById(divid).style.display="block"; } $("#passwordimage").mouseover(function(e) { $('#helpCalloutDivLeft').show(); if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) { $("#passwordImgforTollTip").mouseover(function(e){$('#helpCalloutDivLeft').show();}); $("#passwordImgforTollTip").mouseout(function(e){$('#helpCalloutDivLeft').hide();}); $(".calloutTextLeft").mouseover(function(e){$('#helpCalloutDivLeft').hide();}); } }); $("#passwordimage").mouseout(function(e) { $('#helpCalloutDivLeft').hide(); }); $("#passwordImgforTollTipCover").mouseover(function(e) { $('#helpCalloutDivLeft').show(); }); $("#passwordImgforTollTipCover").mouseout(function(e) { $('#helpCalloutDivLeft').hide(); }); $("#passwordimagePaymentSC").mouseout(function(e) { $("#helpCalloutDivLeftPaymentSC").hide(); }); $("#passwordimagePaymentSC").mouseover(function(e) { $('#helpCalloutDivLeftPaymentSC').bgiframe(); $("#helpCalloutDivLeftPaymentSC").show(); }); $("#passwordImgforTollTipSCCover").mouseout(function(e) { $("#helpCalloutDivLeftPaymentSC").hide(); }); $("#passwordImgforTollTipSCCover").mouseover(function(e) { $("#helpCalloutDivLeftPaymentSC").show(); }); $("#passwordimagePaymentIN").mouseout(function(e) { $("#helpCalloutDivLeftPaymentIN").hide(); }); $("#passwordimagePaymentIN").mouseover(function(e) { $('#helpCalloutDivLeftPaymentIN').bgiframe(); $("#helpCalloutDivLeftPaymentIN").show(); }); $("#passwordImgforTollTipINCover").mouseout(function(e) { $("#helpCalloutDivLeftPaymentIN").hide(); }); $("#passwordImgforTollTipINCover").mouseover(function(e) { $("#helpCalloutDivLeftPaymentIN").show(); }); $("#vcPromise").mouseover(function(e) { $('#helpCalloutDivLeftvcPromise').show(); }); $("#vcPromise").mouseout(function(e) { $('#helpCalloutDivLeftvcPromise').hide(); }); $("#vcPromiseCover").mouseover(function(e) { $('#helpCalloutDivLeftvcPromise').show(); }); $("#vcPromiseCover").mouseout(function(e) { $('#helpCalloutDivLeftvcPromise').hide(); }); $("#vinHelp").mouseover(function(e) { $('#helpCalloutDivLeftConfirmVIN').show(); if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) { $("#ConfirmVINImgforTollTip").mouseover(function(e){$('#helpCalloutDivLeftConfirmVIN').show();}); $("#ConfirmVINImgforTollTip").mouseout(function(e){$('#helpCalloutDivLeftConfirmVIN').hide();}); $(".calloutTextLeftConfirmVIN").mouseover(function(e){$('#helpCalloutDivLeftConfirmVIN').hide();}); } }); $("#vinHelp").mouseout(function(e) { $('#helpCalloutDivLeftConfirmVIN').hide(); }); $("#vinHelpCover").mouseover(function(e) { $('#helpCalloutDivLeftConfirmVIN').show(); }); $("#vinHelpCover").mouseout(function(e) { $('#helpCalloutDivLeftConfirmVIN').hide(); }); $("a").mouseenter(function() { globalEmptyDivBuster=true; globalBlurBuster=true; }); $("a").mouseleave(function() { globalEmptyDivBuster=false; globalBlurBuster=false; }); $("#errordetails").mouseenter(function() { globalBlurBuster=true; }); $("#errordetails").mouseleave(function() { globalBlurBuster=false; }); $("a").focus(function() { globalEmptyDivBuster=false; scrollToPosition(this.id); }); $("input").keydown(keydownEvent);
function keydownEvent(e) { var confirmationField; if (!e) e=window.event; if (this !=window) confirmationField=this; else if (e && e.srcElement) confirmationField=e.srcElement; else if(e && e.originalTarget) input=e.originalTarget; if(e.keyCode==13 && confirmationField.id=="Postcode") { globalBlurBuster=true; return true; } if(e.keyCode==9) { if(globalBlurBuster) { globalBlurBuster=false; return true; } } };
function Unloadjscssfile(filename, filetype) { document.styleSheets[0].disabled=true; }
function Loadjscssfile(filename, filetype){ if (filetype=="js") { var fileref=document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", filename); } else if (filetype=="css"){ var fileref=document.createElement("link"); fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css"); fileref.setAttribute("href", filename); } if (typeof fileref!="undefined") document.getElementsByTagName("head")[0].appendChild(fileref); }
function readCookie(name) { var nameEQ=name + '=';
var ca=document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c=ca[i]; while (c.charAt(0)==' ') c=c.substring(1,c.length); if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length); } return null; }
function positionErrorDiv() { if($('div#errormessage').length) { var winTop=$('html').scrollTop();
var winBottom=winTop + $(window).height();
var pageHeight=document.body.offsetHeight + document.body.offsetTop;
var errorDivTop=winBottom - $('div#errormessage').height()-17; if(errorDivTop<=(pageHeight-116)) { $('div#errormessage').css({top:errorDivTop}); } else { } } } (function($){ $.fn.bgIframe=$.fn.bgiframe=function(s) { if ( $.browser.msie && /6.0/.test(navigator.userAgent) ) { s=$.extend({ top : 'auto', left : 'auto', width : 'auto', height : 'auto', opacity : true, src : 'javascript:false;' }, s || {});
var prop=function(n){return n&&n.constructor==Number?n+'px':n;}, html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+ 'style="display:block;position:absolute;z-index:-1;'+ (s.opacity !==false?'filter:Alpha(Opacity=\'0\');':'')+ 'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+ 'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+ 'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+ 'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+ '"/>'; return this.each(function() { if ( $('> iframe.bgiframe', this).length==0 ) this.insertBefore( document.createElement(html), this.firstChild ); }); } return this; }; })(jQuery);
function setCSSCookie() { var strBrowser=readCookie('Browser');
var strVersion=readCookie('BrowserVersion');
var strCSS, strAdapterCSS; switch(strBrowser) { case "IE": switch(strVersion) { case "6": $(document).ready(function(){ $(window).scroll(positionErrorDiv); $(window).resize(positionErrorDiv); }); strCSS="subsite.css"; strAdapterCSS="subsiteIE6.css"; if(screen.width<1024) { $('#errordetails').css('padding-right','9px'); } break; default: strCSS="subsite.css"; strAdapterCSS=""; break; } break; default: strCSS="subsite.css"; strAdapterCSS=""; break; } document.cookie='VehicleCheckCSS=' + strCSS + '; path=/'; document.cookie='AdapterCSS=' + strAdapterCSS + '; path=/'; } setCSSCookie(); if (self.fields) { InitialiseValidation(); validatePromotionCode(); }

