function ToggleEnquirySources(pSourcesID,pOtherID){var hSource=$("#"+pSourcesID).val(),hOther=$("#"+pOtherID),hLabel=$("label[for="+pOtherID+"]"),hField=hOther.parent().parent(),hValidator=Validation.Element.getFields(hOther[0])[0];if(hSource==42||hSource==45){hField.css("display")=="none"&&hField.show("blind",{},500);hValidator.enable()}else{hField.css("display")!="none"&&hField.hide("blind",{},500);hValidator.disable()}if(hSource==45)hLabel.html('Existing ESET Partner Name<sup class="Form-Required">*</sup>');else hLabel.html('Other Enquiry Source<sup class="Form-Required">*</sup>')}function SetupEnquirySources(pSourcesID,pOtherID,pValidationGroup){var hValidator=Validation.Element.getFields($("#"+pOtherID)[0])[0];hValidator.addGroup(pValidationGroup);ToggleEnquirySources(pSourcesID,pOtherID)}function AddressSearch(pForm,pPostcode){Window.dialogPanel("AddressSearch","Postcode Search","/PartialViews/Address/Search",350,250,false,true,true,{Form:pForm,Postcode:pPostcode},true,false).dialog("option","buttons",{"Address Not Listed":function(){AddressNotListed(pForm);$(this).dialog("close")}})}function AddressSelected(pForm,pAddress){$("#Window-AddressSearch").dialog("close");$("#"+pForm).updatePanel("setParameter","FormState","Selected").updatePanel("setParameter","Address",pAddress).updatePanel("overrideRefresh")}function AddressNotListed(pForm){$("#Window-AddressSearch").dialog("close");$("#"+pForm).updatePanel("setParameter","FormState","NotListed").updatePanel("overrideRefresh")}ISLOnline_JSON={hextable:["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],encode:function(obj){var i,ret,ch;if(obj.constructor==Array){ret="[";for(i=0;i<obj.length;++i){if(i>=1)ret+=",";ret+=this.encode(obj[i])}return ret+"]"}else if(obj.constructor==String){ret='"';for(i=0;i<obj.length;++i){ch=obj.charCodeAt(i);if(ch!=34&&ch!=39&&ch!=92&&ch>=32&&ch<=126)ret+=obj.charAt(i);else ret+="\\u"+this.hextable[ch>>12&15]+this.hextable[ch>>8&15]+this.hextable[ch>>4&15]+this.hextable[ch&15]}return ret+'"'}else if(obj.constructor==Number&&""+obj==""+Math.round(obj))return""+obj;else if(obj.constructor==Object){ret="{";for(i in obj){if(ret.length>1)ret+=",";ret+=this.encode(i)+":"+this.encode(obj[i])}ret+="}";return ret}else throw"unsupported type";},decode:function(str){return eval("("+str+")")}};ISLOnline={CONNECTION_FAILED:"/connection-failed",makeError:function(err,desc){return{getError:function(){return err},getDescription:function(){return desc}}},calls_:{},reply_:function(call_id,data){ISLOnline.calls_[call_id]!=null&&ISLOnline.calls_[call_id].reply(data)},call:function(name,data,fnok,fnerror){data={fn:name,args:data,lang:"en"};if(typeof window.location.hostname=="string")data.od=window.location.hostname;data=ISLOnline_JSON.encode(data);for(var encoded=[""],ch,i=0;i<data.length;++i){if(encoded[encoded.length-1].length>=300)encoded[encoded.length]="";ch=data.charCodeAt(i);encoded[encoded.length-1]+=ISLOnline_JSON.hextable[ch>>4&15];encoded[encoded.length-1]+=ISLOnline_JSON.hextable[ch&15];encoded[encoded.length-1]+=ISLOnline_JSON.hextable[ch>>12&15];encoded[encoded.length-1]+=ISLOnline_JSON.hextable[ch>>8&15]}var el=document.getElementsByTagName("head")[0],call_id=""+Math.random()+"/"+ +new Date;ISLOnline.calls_[call_id]={reply:function(recv){delete ISLOnline.calls_[call_id];for(var i=0;i<this.elements.length;++i)this.elements[i].parentNode.removeChild(this.elements[i]);if(recv==null)fnerror(ISLOnline.makeError(ISLOnline.CONNECTION_FAILED,"Connection to the server failed."));else if(recv.constructor==Object&&typeof recv.error=="string"&&typeof recv.description=="string")fnerror(ISLOnline.makeError(recv.error,recv.description));else fnok(recv)},elements:[]};setTimeout(function(){ISLOnline.reply_(call_id,null)},3e4);for(var elements=ISLOnline.calls_[call_id].elements,i=0;i<encoded.length;++i){var script=document.createElement("script");script.src="https://www.islonline.net/__webcall__?ns=ISLOnline&call_id="+call_id+"&part="+i+"&all_parts="+encoded.length+"&data="+encoded[i];elements[elements.length]=script;el.appendChild(script)}}};ISLOnline.Join={INVALID_SESSION_CODE:"/Join/invalid-session-code",SESSION_NOT_FOUND:"/Join/session-not-found",getSessionInfoByCode_:function(raw,fnok,fnerror){ISLOnline.call("Join.getSessionInfoByCode",raw,function(data){fnok({getAttribute:function(a){var ret=data[a];return ret==null?"":ret},getAttributes:function(){var ret=[];for(var p in data)if(data[p].length)ret[ret.length]=p;return ret},getInnerHTML:function(){return this.getAttribute("innerHTML")},join:function(){var js=this.getAttribute("joinJavascript");if(js.length){eval(js);return}var link=this.getAttribute("joinLink");if(link.length)window.location.href=link}})},fnerror)},getSessionInfoByCode:function(code,fnok,fnerror){ISLOnline.Join.getSessionInfoByCode_(""+code,fnok,fnerror)},getSessionInfoByCodeWithProgramQuery:function(code,pq,fnok,fnerror){ISLOnline.Join.getSessionInfoByCode_({code:""+code,programQuery:pq},fnok,fnerror)}};ISLOnline.Login={USERNAME_OR_PASSWORD_WRONG:"/Login/user-or-pwd-error",ACCOUNT_IS_DISABLED:"/Login/account-is-disabled",login:function(user,pwd,fnok,fnerror){ISLOnline.call("Login.login",{user:user,pwd:pwd},function(data){fnok({getPages:function(){var ret=[];for(var p in data.pages)ret[ret.length]=p;return ret},getPage:function(id){var page=data.pages[id];return{getLink:function(){return page.link},redirect:function(){window.location.href=this.getLink()}}},getSessionId:function(){return data.sid},getFavoritesServices:function(){var ret=[];for(var s in data.favserv)ret[ret.length]=data.favserv[s];return ret}})},fnerror)}};ISLLight={show:function(){var content='<p>Enter your session code and click Connect.</p><input type="text" id="txtISLCode" class="TextBox TextBox-Normal" /><p id="divISLOutput"></p>';Window.dialogMessage("ISLLight","Connect to a support session",content,300,250,false).dialog("option","buttons",{Cancel:function(){$(this).dialog("close")},Connect:function(){ISLLight.connect()}});return false},connect:function(){ISLOnline.Join.getSessionInfoByCode($("#txtISLCode").val(),function(info){$("#txtISLCode").removeClass("TextBox-Error").addClass("TextBox-Normal");$("#divISLOutput").html('<span class="ui-icon ui-icon-info" style="float:left; margin:0 7px 50px 0;"></span>Connecting to session: '+info.getAttribute("sessionCode"));info.join()},function(){$("#txtISLCode").removeClass("TextBox-Normal").addClass("TextBox-Error");$("#divISLOutput").html('<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>Invalid session code!')})}};var Store={page:"",products:[],getOption:function(group){return $("#divGroup-"+group).find(".store-option select").val()},getOptionIndex:function(group){return $("#divGroup-"+group).find(".store-option select").get(0).selectedIndex},addOption:function(option,updatetype){window.location=Store.page+option+"/"+updatetype},setPrice:function(group,optionIndex,updateType){$("#lblPrice-"+group+"-"+updateType+" span").html("&#163;"+Store.products[group][optionIndex][updateType].toFixed(2)).effect("highlight",{},1e3)},updatePrice:function(group){Store.setPrice(group,Store.getOptionIndex(group),1);Store.setPrice(group,Store.getOptionIndex(group),2);Store.setPrice(group,Store.getOptionIndex(group),3)},setup:function(){$(".store-container").each(function(){if($(this).find(".store-option select").length>0){var id=$(this).attr("id"),group=id.substring(9,id.length);Store.updatePrice(group);$(this).find(".store-option select").bind("change",function(){Store.updatePrice(group)});$(this).find(".button").attr("href","#").click(function(){var button=$(this).attr("id");Store.addOption(Store.getOption(group),button.substring(button.length-1,button.length))})}})}},Payment={panel:"",process:function(pUrl,pPaReq,pCrossReference,pTermUrl){$("[name=ACSForm]").attr("action",pUrl);$("[name=PaReq]").val(pPaReq);$("[name=MD]").val(pCrossReference);$("[name=TermUrl]").val(pTermUrl);document.ACSForm.submit()},reset:function(){$("#"+Payment.panel).updatePanel("setParameter","MD",null).updatePanel("setParameter","PaRES",null)}},Validation={methods:{},rules:{},messages:{},Groups:[],Fields:[],GetElement:function(pElement){var hType=Utils.Field.GetType(pElement),hElement=null;if(hType=="checkbox")hElement=$(pElement).next(".CheckBox-Label");else if(hType=="radio")hElement=$(pElement).next(".RadioButton-Label");else hElement=$(pElement);return hElement},GetClass:function(pElement){var hType=Utils.Field.GetType(pElement),hClass=null;if(hType=="checkbox")hClass="CheckBox-Error";else if(hType=="radio")hClass="RadioButton-Error";else hClass="TextBox-Error";return hClass},addMethod:function(pName,pMethod,pDefaultRule,pDefaultMessage){Validation.methods[pName]=pMethod;Validation.rules[pName]=pDefaultRule;Validation.messages[pName]=pDefaultMessage},isValid:function(pName,pElements,pOptions,pMessage){return Validation.methods[pName].call(this,pElements,pOptions,pMessage)}};Validation.Element={getFields:function(pElement){var hFields=[];$.each(Validation.Fields,function(){this.containsElement(pElement)==true&&hFields.push(this)});return hFields},getGroups:function(pElement){var hGroups=[],hFields=Validation.Element.getFields(pElement);$.each(hFields,function(){$.each(this.groups,function(){hGroups.push(this)})});return hGroups}};Validation.Field={create:function(pID,pOptions){var hField=null;$.each(Validation.Fields,function(){if(this.id==pID)hField=this});if(hField==null){hField=new ValidationField(pID,pOptions);Validation.Fields.push(hField)}else hField.extend(pOptions);return hField},remove:function(pID){var hField=null,hIndex=-1;$.each(Validation.Fields,function(lIndex){if(this.id==pID){hField=this;hIndex=lIndex}});if(hField!=null){Validation.Fields.splice(hIndex,1);hField.remove()}},"get":function(pID){var hField=null;$.each(Validation.Fields,function(){if(this.options.id==pID)hField=this});return hField}};Validation.Group={create:function(pName,pOptions){var hGroup=null;$.each(Validation.Groups,function(){if(this.name==pName)hGroup=this});if(hGroup==null){hGroup=new ValidationGroup(pName,pOptions);Validation.Groups.push(hGroup)}return hGroup},remove:function(pName){var hGroup=null,hIndex=-1;$.each(Validation.Groups,function(lIndex){if(this.Name==pName){hGroup=this;hIndex=lIndex}});if(hGroup!=null){Validation.Groups.splice(hIndex,1);hGroup.remove()}},"get":function(pName){var hGroup=null;$.each(Validation.Groups,function(){if(this.name==pName)hGroup=this});return hGroup},isValid:function(pName){var hGroup=Validation.Group.get(pName);return hGroup!=null?hGroup.isValid():true},validate:function(pName){var hGroup=Validation.Group.get(pName);return hGroup!=null?hGroup.validate():true},getFields:function(pName){var hGroups=[];$.each(Validation.Fields,function(){this.containsGroup(pName)==true&&hGroups.push(this)});return hGroups},getElements:function(pName){var hElements=[];$.each(Validation.Fields,function(){this.containsGroup(pName)==true&&$.each(this.elements,function(){hElements.push(this)})});return hElements}};Validation.Placeholder={getFields:function(pElement){var hFields=[];$.each(Validation.Fields,function(){this.containsPlaceholder(pElement)==true&&hFields.push(this)});return hFields}};function ValidationField(pID,pOptions){this.id=pID;this.options=pOptions;this.enabled=true;this.elements=[];this.placeholders=[];this.groups=[];this.errors=[];this.remove=function(){};this.extend=function(pOptions){this.options=$.extend({},this.options,pOptions)};this.enable=function(){this.enabled=true};this.disable=function(){this.enabled=false;$(this.options.errorPlacement).children(".Validation-Icon").remove()};this.addElement=function(pElement){this.containsElement(pElement)==false&&this.elements.add(pElement)};this.removeElement=function(pElement){this.elements.remove(pElement)};this.containsElement=function(pElement){return this.elements.contains(pElement)};this.addPlaceholder=function(pPlaceholder){this.containsPlaceholder(pPlaceholder)==false&&this.placeholders.add(pPlaceholder)};this.removePlaceholder=function(pPlaceholder){this.placeholders.remove(pPlaceholder)};this.containsPlaceholder=function(pPlaceholder){return this.placeholders.contains(pPlaceholder)};this.addGroup=function(pName){this.containsGroup(pName)==false&&this.groups.add(pName)};this.removeGroup=function(pName){this.groups.remove(pName)};this.containsGroup=function(pName){return this.groups.contains(pName)};this.validate=function(){if(this.enabled==true){var hErrors=this.getValidators(true,true);this.errors=hErrors;if(hErrors.length>0){$.each(this.elements,function(){var hData=$(this).data("Validation-Errors");hData.push(hErrors);$(this).data("Validation-Errors",hData)});return false}else return true}else return true};this.isValid=function(){return this.getValidators(true,false)};this.totalValidators=function(){return this.getValidators(false,false)};this.totalErrors=function(){return this.getValidators(true,true).length};this.getErrors=function(){return this.getValidators(true,true)};this.getValidators=function(pValid,pErrors){var hThis=this,hTotal=0,hValid=0,hErrors=[];if(this.enabled==true){$.each(hThis.options.rules,function(lKey,lValue){hTotal++;if(pValid==true){var hResult=Validation.isValid(lKey,hThis.elements,lValue,hThis.options.messages[lKey]);if(hResult==true)hValid++;else hErrors.push(hResult)}});if(pValid==true)this.errors=hErrors}return pErrors==false?pValid==true?hTotal==hValid:hTotal:hErrors};this.removeErrors=function(){this.errors=[];$.each(this.elements,function(){$(this).data("Validation-Errors",[])})};this.addErrors=function(){var hPlaceholders=this.placeholders;$.each(this.elements,function(){var hErrors=$(this).data("Validation-Errors"),hElement=Validation.GetElement(this),hClass=Validation.GetClass(this);if(hErrors.length>0){hElement.addClass(hClass);$.each(hPlaceholders,function(){$(this.toString()).showErrors(hErrors,300)})}else{hElement.removeClass(hClass);$.each(hPlaceholders,function(){$(this.toString()).removeErrors()})}})}}function ValidationGroup(pName){this.name=pName;this.enabled=true;this.isValid=false;this.elements=[];this.remove=function(){var hFields=Validation.Group.getFields(this.name),hGroup=this.name;$.each(this.fields,function(){this.removeGroup(hGroup)})};this.enable=function(){this.enabled=true};this.disable=function(){this.enabled=false};this.addElement=function(pElement){this.containsElement(pElement)==false&&this.elements.add(pElement)};this.removeElement=function(pElement){this.elements.remove(pElement)};this.containsElement=function(pElement){return this.elements.contains(pElement)};this.isValid=function(){if(this.enabled==true){var hFields=Validation.Group.getFields(this.name),hValid=true;$.each(hFields,function(){if(this.isValid()==false)hValid=false});return hValid}else return true};this.validate=function(){if(this.enabled==true){var hFields=Validation.Group.getFields(this.name),hValid=true;$.each(hFields,function(){this.removeErrors()});$.each(hFields,function(){if(this.validate()==false)hValid=false});$.each(hFields,function(){this.addErrors()});this.showErrors();return hValid}else return true};this.showErrors=function(){if(this.enabled==true){var hFields=Validation.Group.getFields(this.name),hHtml="<ul>";$.each(hFields,function(){$.each(this.errors,function(){hHtml=hHtml+"<li>"+this+"</li>"})});hHtml=hHtml+"</ul>";$.each(this.elements,function(){if(hHtml.length>9)$(this).css({opacity:0,display:""}).html(hHtml).fadeTo("slow",1);else{var hElement=$(this);hElement.fadeTo("slow",0,function(){hElement.css({display:"none"}).html("")})}})}}}Validation.addMethod("compareGreaterThan",function(pElements,pOptions,pMessage){var hReturn=true,hValues=$(pOptions).getValue(true);$.each($(pElements).getValue(true),function(){var hElement=this;$.each(hValues,function(){if(hReturn==true)hReturn=hElement>this})});return hReturn==true?true:$.format(pMessage,pOptions)},"Must be greater than {0}.");Validation.addMethod("compareLessThan",function(pElements,pOptions,pMessage){var hReturn=true,hValues=$(pOptions).getValue(true);$.each($(pElements).getValue(true),function(){var hElement=this;$.each(hValues,function(){if(hReturn==true)hReturn=hElement<this})});return hReturn==true?true:$.format(pMessage,pOptions)},"Must be less than {0}.");Validation.addMethod("compareEqual",function(pElements,pOptions,pMessage){var hReturn=true,hValue=$(pOptions).getValue(true);$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=this.toString()==hValue.toString()});return hReturn==true?true:$.format(pMessage,pOptions)},"Must be equal to {1}.");Validation.addMethod("compareNotEqual",function(pElements,pOptions,pMessage){var hReturn=true,hValues=$(pOptions).getValue(true);$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=this.toString()==hValue.toString()});return hReturn==true?true:$.format(pMessage,pOptions)},"Must not be equal to {1}.");Validation.addMethod("isDate",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(false),function(){if(hReturn==true)hReturn=Validation.Date.IsDate(this)});return hReturn==true?true:pMessage},"Must be a valid Date.");Validation.Date={Seperator:"/",MinYear:1800,MaxYear:2500,DaysInFebruary:function(pYear){return pYear%4==0&&(!(pYear%100==0)||pYear%400==0)?29:28},DaysArray:function(pYear){for(var hDays=[],lIndex=1;lIndex<=12;lIndex++)if(lIndex==4||lIndex==6||lIndex==9||lIndex==11)hDays[lIndex]=30;else if(lIndex==2)hDays[lIndex]=Validation.Date.DaysInFebruary(pYear);else hDays[lIndex]=31;return hDays},IsDate:function(pDate){var hPosition1=pDate.indexOf(Validation.Date.Seperator),hPosition2=pDate.indexOf(Validation.Date.Seperator,hPosition1+1);if(hPosition1==-1||hPosition2==-1)return false;var hDay=pDate.substring(0,hPosition1),hMonth=pDate.substring(hPosition1+1,hPosition2),hYear=pDate.substring(hPosition2+1);if(hDay.charAt(0)=="0"&&hDay.length>1)hDay=hDay.substring(1);if(hMonth.charAt(0)=="0"&&hMonth.length>1)hMonth=hMonth.substring(1);for(var loopIndex=1;loopIndex<=3;loopIndex++)if(hYear.charAt(0)=="0"&&hYear.length>1)hYear=hYear.substring(1);var hMonthInt=parseInt(hMonth),hDayInt=parseInt(hDay),hYearInt=parseInt(hYear),hDaysInMonth=Validation.Date.DaysArray(hYearInt);return hMonth.length<1||hMonthInt<1||hMonthInt>12?false:hDay.length<1||hDayInt<1||hDayInt>31||hMonthInt==2&&hDayInt>daysInFebruary(hYearInt)||hDayInt>hDaysInMonth[hMonthInt]?false:hYear.length!=4||hYearInt==0||hYearInt<Validation.Date.MinYear||hYearInt>Validation.Date.MaxYear?false:pDate.indexOf(Validation.Date.Seperator,hPosition2+1)!=-1||Utils.Number.IsInteger(pDate.stripChars(Validation.Date.Seperator))==false?false:true}};Validation.addMethod("isDecimal",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=Utils.Number.IsDecimal(this)});return hReturn==true?true:pMessage},"Must be a decimal value.");Validation.addMethod("isEmail",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(false),function(){if(hReturn==true)hReturn=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(this)});return hReturn==true?true:pMessage},"Must be a valid email address.");Validation.addMethod("isInteger",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=Utils.Number.IsInteger(this)});return hReturn==true?true:pMessage},"Must be a integer value.");Validation.addMethod("minLength",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=this.length>=pOptions});return hReturn==true?true:$.format(pMessage,pOptions)},"Must have at least {0} characters.");Validation.addMethod("maxLength",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=this.length<=pOptions});return hReturn==true?true:$.format(pMessage,pOptions)},"Must be no more than {0} characters.");Validation.addMethod("rangeLength",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(true),function(){if(hReturn==true)hReturn=this.length<=pOptions[0]||this.length>=pOptions[1]});return hReturn==true?true:$.format(pMessage,pOptions[0],pOptions[1])},"Must be between {0} and {1} characters long.");Validation.addMethod("required",function(pElements,pOptions,pMessage){var hType=Utils.Field.GetType($(pElements)[0]),hReturn;if(hType=="text")hReturn=$(pElements).getValue(false).length==$(pElements).length;else if(hType=="radio")hReturn=$(pElements).getValue().length>0;else if(hType=="checkbox")hReturn=$(pElements).getValue().length==$(pElements).length;else hReturn=$(pElements).getValue(false).length>0;return hReturn==true?true:$.format(pMessage,pOptions)},"Required field.");Validation.addMethod("minRequired",function(pElements,pOptions,pMessage){return $(pElements).getValue().length>=pOptions==true?true:$.format(pMessage,pOptions)},"Must have at least {0} fields.");Validation.addMethod("maxRequired",function(pElements,pOptions,pMessage){return $(pElements).getValue().length<=pOptions==true?true:$.format(pMessage,pOptions)},"Can not have more than {0} fields.");Validation.addMethod("rangeRequired",function(pElements,pOptions,pMessage){return($(pElements).getValue().length>=pOptions[0]&&$(pElements).getValue().length<=pOptions[1])==true?true:$.format(pMessage,pOptions[0],pOptions[1])},"Must have between {0} and {1} fields.");Validation.addMethod("isUrl",function(pElements,pOptions,pMessage){var hReturn=true;$.each($(pElements).getValue(false),function(){if(hReturn==true)hReturn=/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(this)});return hReturn==true?true:pMessage},"Must be a valid Url.");(function($){$.fn.validation=function(pOptions){return $(this).each(function(){if($(this).data("Validation-Enabled")==undefined)$(this).validator(pOptions);else $(this).validator("extend",pOptions)})};$.fn.showError=function(pMessage,pWidth){return this.each(function(){$("<span class='Validation-Icon'>&nbsp;</span>").appendTo(this).toolTip({content:pMessage,width:pWidth,error:true})})};$.fn.showErrors=function(pErrors,pWidth){var hHtml="<ul>";$.each(pErrors,function(){hHtml=hHtml+"<li>"+this+"</li>"});hHtml=hHtml+"</ul>";return this.each(function(){var hElement=$(this);if(hElement.children(".Validation-Icon").length==0)$("<span class='Validation-Icon'>&nbsp;</span>").appendTo(hElement).toolTip({content:hHtml,width:pWidth,error:true});else hElement.children(".Validation-Icon").toolTip({content:hHtml,width:pWidth,error:true})})};$.fn.removeErrors=function(){return this.each(function(){$(this).children(".Validation-Icon").remove()})}})(jQuery);(function($){$.widget("ui.validationPlaceholder",{options:{toolTipWidth:300,errors:null,validators:null},_create:function(){var hElement=this.element;this.options.validators!=null&&$.each(this.options.validators,function(){Validation.Field.get(this.toString());hField.addPlaceholder(hElement)});var hDisplay=false;if(this.options.errors!=null)hDisplay=this.options.errors.length>0;if(hDisplay)this.addErrors(this.options.errors);else this.removeErrors()},destroy:function(){var hElement=this.element,hFields=Validation.Placeholder.getFields(this.element);$.each(hFields,function(){hField.removePlaceholder(hElement)});$.Widget.prototype.destroy.call(this)},addErrors:function(pErrors){var hHtml="<ul>";$.each(pErrors,function(){hHtml=hHtml+"<li>"+this+"</li>"});hHtml=hHtml+"</ul>";if($(this.element).children(".Validation-Icon").length==0)$("<span class='Validation-Icon'>&nbsp;</span>").appendTo(this.element).toolTip({content:hHtml,width:this.options.toolTipWidth,error:true});else $(this.element).children(".Validation-Icon").toolTip({content:hHtml,width:this.options.toolTipWidth,error:true})},removeErrors:function(){$(this.element).children(".Validation-Icon").remove()}})})(jQuery);(function($){$.widget("ui.validationSummary",{options:{groups:null,errors:null,autoShow:false},_create:function(){var hElement=this.element;if(this.options.groups!=null){var hErrors=this.options.errors;$.each(this.options.groups,function(){var hGroup=Validation.Group.create(this.toString(),null);hGroup.addElement(hElement);if(hErrors!=null){var hHtml="<ul>";$.each(hErrors,function(){hHtml=hHtml+"<li>"+this+"</li>"});hHtml=hHtml+"</ul>";hHtml.length>9&&$(hElement).css({opacity:0,display:""}).html(hHtml).fadeTo("slow",1)}})}this.options.autoShow==true&&$(this.element).css({opacity:0,display:""}).fadeTo("slow",1)},destroy:function(){var hElement=this.element;this.options.groups!=null&&$.each(this.options.groups,function(){var hGroup=Validation.Group.get(this.toString());hGroup.removeElement(hElement)});$.Widget.prototype.destroy.call(this)}})})(jQuery);(function($){$.widget("ui.validator",{options:{id:null,groups:null,rules:{},messages:{},placeholders:null},_create:function(){this.element.data("Validation-Enabled",true);var hField=Validation.Field.create(this.options.id,this.options);hField.addElement($(this.element)[0]);this.options.groups!=null&&$.each(this.options.groups,function(){Validation.Group.create(this.toString());hField.addGroup(this.toString())});this.options.placeholders!=null&&hField.addPlaceholder(this.options.placeholders);var hElement=this;$(this.element).bind("blur",function(){hElement.validate()})},destroy:function(){var hElement=$(this.element)[0],hFields=Validation.Element.getFields(hElement),hEmptyFields=[],hGroups=Validation.Element.getGroups(hElement);$.each(hFields,function(){this.removeElement(hElement);this.elements.length==0&&hEmptyFields.push(this)});$.each(hEmptyFields,function(){Validation.Field.remove(this.id)});$.Widget.prototype.destroy.call(this)},extend:function(pOptions){this.options=$.extend({},this.options,pOptions);var hField=Validation.Field.create(pOptions.id,this.options);hField.addElement($(this.element)[0]);pOptions.groups!=null&&$.each(pOptions.groups,function(){Validation.Group.create(this.toString(),null);hField.addGroup(this.toString())})},enable:function(){var hFields=Validation.Element.getFields($(this.element)[0]);$.each(hFields,function(){this.enable()})},disable:function(){var hFields=Validation.Element.getFields($(this.element)[0]);$.each(hFields,function(){this.disable()})},totalValidators:function(pGroup){var hFields=Validation.Element.getFields($(this.element)[0]),hTotal=0;$.each(holdFields,function(){if(pGroup!=null){if(this.containsGroup(pGroup)==true)hTotal=hTotal+this.totalValidators()}else hTotal=hTotal+this.totalValidators()});return hTotal},totalErrors:function(pGroup){var hFields=Validation.Element.getFields($(this.element)[0]),hTotal=0;$.each(hFields,function(){if(pGroup!=null){if(this.containsGroup(pGroup)==true)hTotal=hTotal+this.totalErrors()}else hTotal=hTotal+this.totalErrors()});return holdTotal},isValid:function(passGroup){var holdFields=Validation.Element.getFields($(this.element)[0]),holdTotal=0,holdLength=0;$.each(holdFields,function(){if(passGroup!=null){if(this.containsGroup(passGroup)==true){holdLength++;if(this.isValid()==true)holdTotal++}}else{holdLength++;if(this.isValid()==true)holdTotal++}});return holdTotal==holdLength},validate:function(passGroup){var holdFields=Validation.Element.getFields($(this.element)[0]);$.each(holdFields,function(){if(passGroup!=null)this.containsGroup(passGroup)==true&&this.removeErrors();else this.removeErrors()});$.each(holdFields,function(){if(passGroup!=null)this.containsGroup(passGroup)==true&&this.validate();else this.validate()});$.each(holdFields,function(){if(passGroup!=null)this.containsGroup(passGroup)==true&&this.addErrors();else this.addErrors()})}})})(jQuery)
