﻿function timeStamp(){var currTime=new Date();var year=currTime.getFullYear();var month=currTime.getMonth()+1;var day=currTime.getDate();var hour=currTime.getHours();var mins=currTime.getMinutes();var secs=currTime.getSeconds();var msecs=currTime.getMilliseconds();var stamp="";if(year<2000){year+=1900}stamp+=year;stamp+=(month<10)?"0"+month:month;stamp+=(day<10)?"0"+day:day;stamp+=(hour<10)?"0"+hour:hour;stamp+=(mins<10)?"0"+mins:mins;stamp+=(secs<10)?"0"+secs:secs;if(msecs<100&&msecs>10){stamp+="0"+msecs+"0"}else if(msecs<10){stamp+="00"+msecs+"0" } else { stamp += msecs + "0" } return (stamp) } function clearObj(obj) { obj.value = "" } function clearField(input) { if (input.defaultValue == input.value) { input.value = "" } return true } function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop } while (obj = obj.offsetParent); return [curleft, curtop] } } function blankField(input) { input.value = ""; return true } var isNN = (navigator.appName.indexOf("Netscape") != -1); function autoTab(input, len, e) { var keyCode = (isNN) ? e.which : e.keyCode; var filter = (isNN) ? [0, 8, 9] : [0, 8, 9, 16, 17, 18, 37, 38, 39, 40, 46]; if (input.value.length >= len && !containsElement(filter, keyCode)) { input.value = input.value.slice(0, len); input.form[(getIndex(input) + 1) % input.form.length].focus() } function containsElement(arr, ele) { var found = false, index = 0; while (!found && index < arr.length) if (arr[index] == ele) found = true; else index++; return found } function getIndex(input) { var index = -1, i = 0, found = false; while (i < input.form.length && index == -1) if (input.form[i] == input) index = i; else i++; return index } return true } function checkCPCCookie(cltID) { var tmpSrc; var tmpKw; var tmpAd; var tmpSplit; var tmpID = cltID.split("txtSrc"); var tmpCPCCookie = readCookie("SEOCPC"); var tmpCPCParams = tmpCPCCookie.split("&"); for (i = 0; i < tmpCPCParams.length; i++) { tmpSplit = tmpCPCParams[i].split("="); if (tmpSplit[0] == "WT.sp") { tmpSrc = tmpSplit[1]; document.getElementById(tmpID[0] + 'txtSrc').value = tmpSrc } if (tmpSplit[0] == "kw") { tmpKw = tmpSplit[1]; document.getElementById(tmpID[0] + 'txtKw').value = tmpKw } if (tmpSplit[0] == "ad") { tmpAd = tmpSplit[1]; document.getElementById(tmpID[0] + 'txtAd').value = tmpAd } if (tmpSplit[0] == "mkwid") { tmpKw = tmpSplit[1]; document.getElementById(tmpID[0] + 'txtKw').value = tmpKw } if (tmpSplit[0] == "pcrid") { tmpAd = tmpSplit[1]; document.getElementById(tmpID[0] + 'txtAd').value = tmpAd } if (tmpSplit[0].toLowerCase()=="aid"){tmpAd=tmpSplit[1];document.getElementById(tmpID[0]+'txtLinkID').value=tmpAd}if(tmpSplit[0].toLowerCase()=="pid"){tmpAd=tmpSplit[1];document.getElementById(tmpID[0]+'txtPublisherID').value=tmpAd}if(tmpSplit[0].toLowerCase()=="sid"){tmpAd=tmpSplit[1];document.getElementById(tmpID[0]+'txtShopperID').value=tmpAd}if(tmpSplit[0].toLowerCase()=="psid"){tmpAd=tmpSplit[1];document.getElementById(tmpID[0]+'txtShopperID').value=tmpAd}}return tmpCPCCookie}function checkCPC(){var tmpSrc="";var tmpKw="";var tmpAd="";var tmpAID="";var tmpPID="";var tmpSID="";var tmpSplit;var tmpCPCCookie=readCookie("SEOCPC");var tmpURL=window.location.href;var tmpCPC = tmpURL.split("?"); if (tmpCPC.length == 2) { var tmpParams = tmpCPC[1].split("&"); for (i = 0; i < tmpParams.length; i++) { tmpSplit = tmpParams[i].split("="); if (tmpSplit[0] == "WT.sp") { tmpSrc = tmpSplit[1] } if (tmpSplit[0] == "kw") { tmpKw = tmpSplit[1] } if (tmpSplit[0] == "ad") { tmpAd = tmpSplit[1]}if(tmpSplit[0]=="mkwid"){tmpKw=tmpSplit[1]}if(tmpSplit[0]=="pcrid"){tmpAd=tmpSplit[1]}if(tmpSplit[0].toLowerCase()=="aid"){tmpAID=tmpSplit[1] }if(tmpSplit[0].toLowerCase()=="pid"){tmpPID=tmpSplit[1]}if(tmpSplit[0].toLowerCase()=="psid"){tmpSID=tmpSplit[1]}if(tmpSplit[0].toLowerCase()=="sid"){tmpSID=tmpSplit[1]}}}if((tmpCPCCookie.indexOf("cj935")>=0)||(tmpCPCCookie.indexOf("ls936")>=0)){if(tmpSrc.indexOf("cj")>=0){ writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("ls")>=0){writeCookie("SEOCPC",tmpCPC[1])}}else{if(tmpSrc.indexOf("google")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("GG")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("g827")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("GPEO")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("BPEO")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("BA")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("b826")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("800")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("806")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("emedia937")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("msn")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("bing")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("yahoo")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("APA")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("ask")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("bdc")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("bz")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("cj")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("godaddy")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("LK")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("ls")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("spages")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("wikipedia")>=0){writeCookie("SEOCPC",tmpCPC[1])}if(tmpSrc.indexOf("ypages")>=0){writeCookie("SEOCPC",tmpCPC[1])}}}function writeCookie(name,value){var expDays=90;var expDate=new Date();expDate.setTime(expDate.getTime()+(expDays*24*60*60*1000));var selPath="/";var argv=writeCookie.arguments;var argc=writeCookie.arguments.length;selDomain="paychex.com";var clicksrc=(argc>1)?argv[1]:null;document.cookie=name+"="+escape(value)+"; expires="+expDate.toGMTString()+"; path="+selPath+"; domain="+selDomain+((clicksrc==null)?"":("; clicksrc="+clicksrc))}function readCookie(name){var cookieValue="";var search=name+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;cookieValue=unescape(document.cookie.substring(offset,end))}}return cookieValue}
/*<!--START OF SDC Advanced Tracking Code--><!--Copyright(c)1996-2007 WebTrends Inc.All rights reserved.--><!--V8.0--><!--$DateTime:2007/02/16 11:44:56 $-->*/var gService=false;var gTimeZone=-5;function dcsCookie(){if(typeof(dcsOther)=="function"){dcsOther()}else if(typeof(dcsPlugin)=="function"){dcsPlugin()}else if(typeof(dcsFPC)=="function"){dcsFPC(gTimeZone)}}function dcsGetCookie(name){var pos=document.cookie.indexOf(name+"=");if(pos!=-1){var start=pos+name.length+1;var end=document.cookie.indexOf(";",start);if(end==-1){end=document.cookie.length}return unescape(document.cookie.substring(start,end))}return null}function dcsGetCrumb(name,crumb){var aCookie=dcsGetCookie(name).split(":");for(var i=0;i<aCookie.length;i++){var aCrumb=aCookie[i].split("=");if(crumb==aCrumb[0]){return aCrumb[1]}}return null}function dcsGetIdCrumb(name,crumb){var cookie=dcsGetCookie(name);var id=cookie.substring(0,cookie.indexOf(":lv="));var aCrumb=id.split("=");for(var i=0;i<aCrumb.length;i++){if(crumb==aCrumb[0]){return aCrumb[1]}}return null}function dcsIsFpcSet(name,id,lv,ss){if(id==dcsGetIdCrumb(name,"id")){if(lv==dcsGetCrumb(name,"lv")){if(ss=dcsGetCrumb(name,"ss")){return true}}}return false}function dcsFPC(offset){if(typeof(offset)=="undefined"){return}if(document.cookie.indexOf("WTLOPTOUT=")!=-1){return}var name=gFpc;var dCur=new Date();var adj=(dCur.getTimezoneOffset()*60000)+(offset*3600000);dCur.setTime(dCur.getTime()+adj);var dExp=new Date(dCur.getTime()+315360000000);var dSes=new Date(dCur.getTime());WT.co_f=WT.vt_sid=WT.vt_f=WT.vt_f_a=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";if(document.cookie.indexOf(name+"=")==-1){if((typeof(gWtId)!="undefined")&&(gWtId!="")){WT.co_f=gWtId}else if((typeof(gTempWtId)!="undefined")&&(gTempWtId!="")){WT.co_f=gTempWtId;WT.vt_f="1"}else{WT.co_f="2";var cur=dCur.getTime().toString();for(var i=2;i<=(32-cur.length);i++){WT.co_f+=Math.floor(Math.random()*16.0).toString(16)}WT.co_f+=cur;WT.vt_f="1"}if(typeof(gWtAccountRollup)=="undefined"){WT.vt_f_a="1"}WT.vt_f_s=WT.vt_f_d="1";WT.vt_f_tlh=WT.vt_f_tlv="0"}else{var id=dcsGetIdCrumb(name,"id");var lv=parseInt(dcsGetCrumb(name,"lv"));var ss=parseInt(dcsGetCrumb(name,"ss"));if((id==null)||(id=="null")||isNaN(lv)||isNaN(ss)){return}WT.co_f=id;var dLst=new Date(lv);WT.vt_f_tlh=Math.floor((dLst.getTime()-adj)/1000);dSes.setTime(ss);if((dCur.getTime()>(dLst.getTime()+1800000))||(dCur.getTime()>(dSes.getTime()+28800000))){WT.vt_f_tlv=Math.floor((dSes.getTime()-adj)/1000);dSes.setTime(dCur.getTime());WT.vt_f_s="1"}if((dCur.getDay()!=dLst.getDay())||(dCur.getMonth()!=dLst.getMonth())||(dCur.getYear()!=dLst.getYear())){WT.vt_f_d="1"}}WT.co_f=escape(WT.co_f);WT.vt_sid=WT.co_f+"."+(dSes.getTime()-adj);var expiry="; expires="+dExp.toGMTString();document.cookie=name+"="+"id="+WT.co_f+":lv="+dCur.getTime().toString()+":ss="+dSes.getTime().toString()+expiry+"; path=/"+(((typeof(gFpcDom)!="undefined")&&(gFpcDom!=""))?("; domain="+gFpcDom):(""));if(!dcsIsFpcSet(name,WT.co_f,dCur.getTime().toString(),dSes.getTime().toString())){WT.co_f=WT.vt_sid=WT.vt_f_s=WT.vt_f_d=WT.vt_f_tlh=WT.vt_f_tlv="";WT.vt_f=WT.vt_f_a="2"}}var gFpc="WT_FPC";var gConvert=true;function dcsAdv(){dcsFunc("dcsET");dcsFunc("dcsCookie");dcsFunc("dcsAdSearch");dcsFunc("dcsTP")}/*<!--END OF SDC Advanced Tracking Code--><!--START OF SmartSource Data Collector TAG--><!--Copyright(c)1996-2007 WebTrends Inc.All rights reserved.--><!--V8.0--><!--$DateTime:2007/03/01 14:48:29 $-->*/var tmpURL=window.location.hostname;if(tmpURL.indexOf("localhost")>=0){var gDomain="nsspn001.paychex.com"}else if(tmpURL.indexOf("imp")>=0){var gDomain="sdcimp.paychex.com"}else{var gDomain="sdc.paychex.com"}if((typeof(gConvert)!="undefined")&&gConvert&&(document.cookie.indexOf(gFpc+"=")==-1)&&(document.cookie.indexOf("WTLOPTOUT=")==-1)){document.write("<SCR"+"IPT TYPE='text/javascript' SRC='"+"http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+"/"+gDcsId+"/wtid.js"+"'><\/SCR"+"IPT>")}var gImages=new Array;var gIndex=0;var DCS=new Object();var WT=new Object();var DCSext=new Object();var gQP=new Array();var gI18n=false;if(window.RegExp){var RE=gI18n?{"%25":/\%/g}:{"%09":/\t/g,"%20":/ /g,"%23":/\#/g,"%26":/\&/g,"%2B":/\+/g,"%3F":/\?/g,"%5C":/\\/g,"%22":/\"/g,"%7F":/\x7F/g,"%A0":/\xA0/g};
if(gI18n){var EXRE=/dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)/i}}function dcsVar(){var dCurrent=new Date();WT.tz=dCurrent.getTimezoneOffset()/60*-1;if(WT.tz==0){WT.tz="0"}WT.bh=dCurrent.getHours();WT.ul=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;if(typeof(screen)=="object"){WT.cd=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth;WT.sr=screen.width+"x"+screen.height}if(typeof(navigator.javaEnabled())=="boolean"){WT.jo=navigator.javaEnabled()?"Yes":"No"}if(document.title){WT.ti=document.title}WT.js="Yes";WT.jv=dcsJV();if(document.body&&document.body.addBehavior){document.body.addBehavior("#default#clientCaps");WT.ct=document.body.connectionType||"unknown";document.body.addBehavior("#default#homePage");WT.hp=document.body.isHomePage(location.href)?"1":"0"}else{WT.ct="unknown"}if(parseInt(navigator.appVersion)>3){if((navigator.appName=="Microsoft Internet Explorer")&&document.body){WT.bs=document.body.offsetWidth+"x"+document.body.offsetHeight}else if(navigator.appName=="Netscape"){WT.bs=window.innerWidth+"x"+window.innerHeight}}WT.fi="No";if(window.ActiveXObject){for(var i=10;i>0;i--){try{var flash=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);WT.fi="Yes";WT.fv=i+".0";break}catch(e){}}}else if(navigator.plugins&&navigator.plugins.length){for(var i=0;i<navigator.plugins.length;i++){if(navigator.plugins[i].name.indexOf('Shockwave Flash')!=-1){WT.fi="Yes";WT.fv=navigator.plugins[i].description.split(" ")[2];break}}}if(gI18n){WT.em=(typeof(encodeURIComponent)=="function")?"uri":"esc";if(typeof(document.defaultCharset)=="string"){WT.le=document.defaultCharset}else if(typeof(document.characterSet)=="string"){WT.le=document.characterSet}}WT.tv="8.0.3";DCS.dcsdat=dCurrent.getTime();DCS.dcssip=window.location.hostname;DCS.dcsuri=window.location.pathname;if(window.location.search){DCS.dcsqry=window.location.search;if(gQP.length>0){for(var i=0;i<gQP.length;i++){var pos=DCS.dcsqry.indexOf(gQP[i]);if(pos!=-1){var front=DCS.dcsqry.substring(0,pos);var end=DCS.dcsqry.substring(pos+gQP[i].length,DCS.dcsqry.length);DCS.dcsqry=front+end}}}}if((window.document.referrer!="")&&(window.document.referrer!="-")){if(!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){DCS.dcsref=window.document.referrer}}}function dcsA(N,V){if(gI18n&&!EXRE.test(N)){if(N=="dcsqry"){var newV="";var params=V.substring(1).split("&");for(var i=0;i<params.length;i++){var pair=params[i];var pos=pair.indexOf("=");if(pos!=-1){var key=pair.substring(0,pos);var val=pair.substring(pos+1);if(i!=0){newV+="&"}newV+=key+"="+dcsEncode(val)}}V=V.substring(0,1)+newV}else{V=dcsEncode(V)}}return"&"+N+"="+dcsEscape(V,RE)}function dcsEscape(S,REL){if(typeof(REL)!="undefined"){var retStr=new String(S);for(var R in REL){retStr=retStr.replace(REL[R],R)}return retStr}else{return escape(S)}}function dcsEncode(S){return(typeof(encodeURIComponent)=="function")?encodeURIComponent(S):escape(S)}function dcsCreateImage(dcsSrc){if(document.images){gImages[gIndex]=new Image;gImages[gIndex].src=dcsSrc;gIndex++}else{document.write('<IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="'+dcsSrc+'">')}}function dcsMeta(){var elems;if(document.all){elems=document.all.tags("meta")}else if(document.documentElement){elems=document.getElementsByTagName("meta")}if(typeof(elems)!="undefined"){var length=elems.length;for(var i=0;i<length;i++){var name=elems.item(i).name;var content=elems.item(i).content;var equiv=elems.item(i).httpEquiv;if(name.length>0){if(name.indexOf("WT.")==0){WT[name.substring(3)]=content}else if(name.indexOf("DCSext.")==0){DCSext[name.substring(7)]=content}else if(name.indexOf("DCS.")==0){DCS[name.substring(4)]=content}}else if(gI18n&&(equiv=="Content-Type")){var pos=content.toLowerCase().indexOf("charset=");if(pos!=-1){WT.mle=content.substring(pos+8)}}}}}function dcsTag(){if(document.cookie.indexOf("WTLOPTOUT=")!=-1){return}var P="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://"+gDomain+(gDcsId==""?'':'/'+gDcsId)+"/dcs.gif?";for(var N in DCS){if(DCS[N]){P+=dcsA(N,DCS[N])}}var keys=["co_f","vt_sid","vt_f_tlv"];for(var i=0;i<keys.length;i++){var key=keys[i];if(WT[key]){P+=dcsA("WT."+key,WT[key]);delete WT[key]}}for(N in WT){if(WT[N]){P+=dcsA("WT."+N,WT[N])}}for(N in DCSext){if(DCSext[N]){P+=dcsA(N,DCSext[N])}}if(P.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){P=P.substring(0,2040)+"&WT.tu=1"}dcsCreateImage(P)}function dcsJV(){var agt=navigator.userAgent.toLowerCase();var major=parseInt(navigator.appVersion);var mac=(agt.indexOf("mac")!=-1);var ff=(agt.indexOf("firefox")!=-1);var ff0=(agt.indexOf("firefox/0.")!=-1);var ff10=(agt.indexOf("firefox/1.0")!=-1);var ff15=(agt.indexOf("firefox/1.5")!=-1);var ff2up=(ff&&!ff0&&!ff10&!ff15);var nn=(!ff&&(agt.indexOf("mozilla")!=-1)&&(agt.indexOf("compatible")==-1));var nn4=(nn&&(major==4));var nn6up=(nn&&(major>=5));var ie=((agt.indexOf("msie")!=-1)&&(agt.indexOf("opera")==-1));var ie4=(ie&&(major==4)&&(agt.indexOf("msie 4")!=-1));var ie5up=(ie&&!ie4);var op=(agt.indexOf("opera")!=-1);var op5=(agt.indexOf("opera 5")!=-1||agt.indexOf("opera/5")!=-1);var op6=(agt.indexOf("opera 6")!=-1||agt.indexOf("opera/6")!=-1);var op7up=(op&&!op5&&!op6);var jv="1.1";if(ff2up){jv="1.7"}else if(ff15){jv="1.6"}else if(ff0||ff10||nn6up||op7up){jv="1.5"}else if((mac&&ie5up)||op6){jv="1.4"}else if(ie5up||nn4||op5){jv="1.3"}else if(ie4){jv="1.2"}return jv}function dcsFunc(func){if(typeof(window[func])=="function"){window[func]()}}dcsVar();dcsMeta();dcsFunc("dcsAdv");dcsTag();
/*<!--END OF SmartSource Data Collector TAG-->*/function dcsMultiTrack(){for(var i=0;i<arguments.length;i++){if(arguments[i].indexOf('WT.')==0){WT[arguments[i].substring(3)]=arguments[i+1];i++}if(arguments[i].indexOf('DCS.')==0){DCS[arguments[i].substring(4)]=arguments[i+1];i++}if(arguments[i].indexOf('DCSext.')==0){DCSext[arguments[i].substring(7)]=arguments[i+1];i++}}var dCurrent=new Date();DCS.dcsdat=dCurrent.getTime();dcsTag()}
// LiveValidation 1.3 (standalone version) // Copyright (c) 2007-2008 Alec Hill (www.livevalidation.com) // LiveValidation is licensed under the terms of the MIT License
var LiveValidation=function(B,A){this.initialize(B,A);};LiveValidation.VERSION="1.3 standalone";LiveValidation.TEXTAREA=1;LiveValidation.TEXT=2;LiveValidation.PASSWORD=3;LiveValidation.CHECKBOX=4;LiveValidation.SELECT=5;LiveValidation.FILE=6;LiveValidation.massValidate=function(C){var D=true;for(var B=0,A=C.length;B<A;++B){var E=C[B].validate();if(D){D=E;}}return D;};LiveValidation.prototype={validClass:"LV_valid",invalidClass:"LV_invalid",messageClass:"LV_validation_message",validFieldClass:"LV_valid_field",invalidFieldClass:"LV_invalid_field",initialize:function(D,C){var A=this;if(!D){throw new Error("LiveValidation::initialize - No element reference or element id has been provided!");}this.element=D.nodeName?D:document.getElementById(D);if(!this.element){throw new Error("LiveValidation::initialize - No element with reference or id of '"+D+"' exists!");}this.validations=[];this.elementType=this.getElementType();this.form=this.element.form;var B=C||{};this.validMessage=B.validMessage||"Thankyou!";var E=B.insertAfterWhatNode||this.element;this.insertAfterWhatNode=E.nodeType?E:document.getElementById(E);this.onValid=B.onValid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass();};this.onInvalid=B.onInvalid||function(){this.insertMessage(this.createMessageSpan());this.addFieldClass();};this.onlyOnBlur=B.onlyOnBlur||false;this.wait=B.wait||0;this.onlyOnSubmit=B.onlyOnSubmit||false;if(this.form){this.formObj=LiveValidationForm.getInstance(this.form);this.formObj.addField(this);}this.oldOnFocus=this.element.onfocus||function(){};this.oldOnBlur=this.element.onblur||function(){};this.oldOnClick=this.element.onclick||function(){};this.oldOnChange=this.element.onchange||function(){};this.oldOnKeyup=this.element.onkeyup||function(){};this.element.onfocus=function(F){A.doOnFocus(F);return A.oldOnFocus.call(this,F);};if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=function(F){A.validate();return A.oldOnClick.call(this,F);};case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=function(F){A.validate();return A.oldOnChange.call(this,F);};break;default:if(!this.onlyOnBlur){this.element.onkeyup=function(F){A.deferValidation();return A.oldOnKeyup.call(this,F);};}this.element.onblur=function(F){A.doOnBlur(F);return A.oldOnBlur.call(this,F);};}}},destroy:function(){if(this.formObj){this.formObj.removeField(this);this.formObj.destroy();}this.element.onfocus=this.oldOnFocus;if(!this.onlyOnSubmit){switch(this.elementType){case LiveValidation.CHECKBOX:this.element.onclick=this.oldOnClick;case LiveValidation.SELECT:case LiveValidation.FILE:this.element.onchange=this.oldOnChange;break;default:if(!this.onlyOnBlur){this.element.onkeyup=this.oldOnKeyup;}this.element.onblur=this.oldOnBlur;}}this.validations=[];this.removeMessageAndFieldClass();},add:function(A,B){this.validations.push({type:A,params:B||{}});return this;},remove:function(B,D){var E=false;for(var C=0,A=this.validations.length;C<A;C++){if(this.validations[C].type==B){if(this.validations[C].params==D){E=true;break;}}}if(E){this.validations.splice(C,1);}return this;},deferValidation:function(B){if(this.wait>=300){this.removeMessageAndFieldClass();}var A=this;if(this.timeout){clearTimeout(A.timeout);}this.timeout=setTimeout(function(){A.validate();},A.wait);},doOnBlur:function(A){this.focused=false;this.validate(A);},doOnFocus:function(A){this.focused=true;this.removeMessageAndFieldClass();},getElementType:function(){switch(true){case (this.element.nodeName.toUpperCase()=="TEXTAREA"):return LiveValidation.TEXTAREA;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="TEXT"):return LiveValidation.TEXT;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="PASSWORD"):return LiveValidation.PASSWORD;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="CHECKBOX"):return LiveValidation.CHECKBOX;case (this.element.nodeName.toUpperCase()=="INPUT"&&this.element.type.toUpperCase()=="FILE"):return LiveValidation.FILE;case (this.element.nodeName.toUpperCase()=="SELECT"):return LiveValidation.SELECT;case (this.element.nodeName.toUpperCase()=="INPUT"):throw new Error("LiveValidation::getElementType - Cannot use LiveValidation on an "+this.element.type+" input!");default:throw new Error("LiveValidation::getElementType - Element must be an input, select, or textarea!");}},doValidations:function(){this.validationFailed=false;for(var C=0,A=this.validations.length;C<A;++C){var B=this.validations[C];switch(B.type){case Validate.Presence:case Validate.Confirmation:case Validate.Acceptance:this.displayMessageWhenEmpty=true;this.validationFailed=!this.validateElement(B.type,B.params);break;default:this.validationFailed=!this.validateElement(B.type,B.params);break;}if(this.validationFailed){return false;}}this.message=this.validMessage;return true;},validateElement:function(A,C){var D=(this.elementType==LiveValidation.SELECT)?this.element.options[this.element.selectedIndex].value:this.element.value;if(A==Validate.Acceptance){if(this.elementType!=LiveValidation.CHECKBOX){throw new Error("LiveValidation::validateElement - Element to validate acceptance must be a checkbox!");}D=this.element.checked;}var E=true;try{A(D,C);}catch(B){if(B instanceof Validate.Error){if(D!==""||(D===""&&this.displayMessageWhenEmpty)){this.validationFailed=true;this.message=B.message;E=false;}}else{throw B;}}finally{return E;}},validate:function(){if(!this.element.disabled){var A=this.doValidations();if(A){this.onValid();return true;}else{this.onInvalid();return false;}}else{return true;}},enable:function(){this.element.disabled=false;return this;},disable:function(){this.element.disabled=true;this.removeMessageAndFieldClass();return this;},createMessageSpan:function(){var A=document.createElement("span");var B=document.createTextNode(this.message);A.appendChild(B);return A;},insertMessage:function(B){this.removeMessage();if((this.displayMessageWhenEmpty&&(this.elementType==LiveValidation.CHECKBOX||this.element.value==""))||this.element.value!=""){var A=this.validationFailed?this.invalidClass:this.validClass;B.className+=" "+this.messageClass+" "+A;if(this.insertAfterWhatNode.nextSibling){this.insertAfterWhatNode.parentNode.insertBefore(B,this.insertAfterWhatNode.nextSibling);}else{this.insertAfterWhatNode.parentNode.appendChild(B);}}},addFieldClass:function(){this.removeFieldClass();if(!this.validationFailed){if(this.displayMessageWhenEmpty||this.element.value!=""){if(this.element.className.indexOf(this.validFieldClass)==-1){this.element.className+=" "+this.validFieldClass;}}}else{if(this.element.className.indexOf(this.invalidFieldClass)==-1){this.element.className+=" "+this.invalidFieldClass;}}},removeMessage:function(){var A;var B=this.insertAfterWhatNode;while(B.nextSibling){if(B.nextSibling.nodeType===1){A=B.nextSibling;break;}B=B.nextSibling;}if(A&&A.className.indexOf(this.messageClass)!=-1){this.insertAfterWhatNode.parentNode.removeChild(A);}},removeFieldClass:function(){if(this.element.className.indexOf(this.invalidFieldClass)!=-1){this.element.className=this.element.className.split(this.invalidFieldClass).join("");}if(this.element.className.indexOf(this.validFieldClass)!=-1){this.element.className=this.element.className.split(this.validFieldClass).join(" ");}},removeMessageAndFieldClass:function(){this.removeMessage();this.removeFieldClass();}};var LiveValidationForm=function(A){this.initialize(A);};LiveValidationForm.instances={};LiveValidationForm.getInstance=function(A){var B=Math.random()*Math.random();if(!A.id){A.id="formId_"+B.toString().replace(/\./,"")+new Date().valueOf();}if(!LiveValidationForm.instances[A.id]){LiveValidationForm.instances[A.id]=new LiveValidationForm(A);}return LiveValidationForm.instances[A.id];};LiveValidationForm.prototype={initialize:function(B){this.name=B.id;this.element=B;this.fields=[];this.oldOnSubmit=this.element.onsubmit||function(){};var A=this;this.element.onsubmit=function(C){return(LiveValidation.massValidate(A.fields))?A.oldOnSubmit.call(this,C||window.event)!==false:false;};},addField:function(A){this.fields.push(A);},removeField:function(C){var D=[];for(var B=0,A=this.fields.length;B<A;B++){if(this.fields[B]!==C){D.push(this.fields[B]);}}this.fields=D;},destroy:function(A){if(this.fields.length!=0&&!A){return false;}this.element.onsubmit=this.oldOnSubmit;LiveValidationForm.instances[this.name]=null;return true;}};var Validate={Presence:function(B,C){var C=C||{};var A=C.failureMessage||"Can't be empty!";if(B===""||B===null||B===undefined){Validate.fail(A);}return true;},Numericality:function(J,E){var A=J;var J=Number(J);var E=E||{};var F=((E.minimum)||(E.minimum==0))?E.minimum:null;var C=((E.maximum)||(E.maximum==0))?E.maximum:null;var D=((E.is)||(E.is==0))?E.is:null;var G=E.notANumberMessage||"Must be a number!";var H=E.notAnIntegerMessage||"Must be an integer!";var I=E.wrongNumberMessage||"Must be "+D+"!";var B=E.tooLowMessage||"Must not be less than "+F+"!";var K=E.tooHighMessage||"Must not be more than "+C+"!";if(!isFinite(J)){Validate.fail(G);}if(E.onlyInteger&&(/\.0+$|\.$/.test(String(A))||J!=parseInt(J))){Validate.fail(H);}switch(true){case (D!==null):if(J!=Number(D)){Validate.fail(I);}break;case (F!==null&&C!==null):Validate.Numericality(J,{tooLowMessage:B,minimum:F});Validate.Numericality(J,{tooHighMessage:K,maximum:C});break;case (F!==null):if(J<Number(F)){Validate.fail(B);}break;case (C!==null):if(J>Number(C)){Validate.fail(K);}break;}return true;},Format:function(C,E){var C=String(C);var E=E||{};var A=E.failureMessage||"Not valid!";var B=E.pattern||/./;var D=E.negate||false;if(!D&&!B.test(C)){Validate.fail(A);}if(D&&B.test(C)){Validate.fail(A);}return true;},Email:function(B,C){var C=C||{};var A=C.failureMessage||"Must be a valid email address!";Validate.Format(B,{failureMessage:A,pattern:/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i});return true;},Length:function(F,G){var F=String(F);var G=G||{};var E=((G.minimum)||(G.minimum==0))?G.minimum:null;var H=((G.maximum)||(G.maximum==0))?G.maximum:null;var C=((G.is)||(G.is==0))?G.is:null;var A=G.wrongLengthMessage||"Must be "+C+" characters long!";var B=G.tooShortMessage||"Must not be less than "+E+" characters long!";var D=G.tooLongMessage||"Must not be more than "+H+" characters long!";switch(true){case (C!==null):if(F.length!=Number(C)){Validate.fail(A);}break;case (E!==null&&H!==null):Validate.Length(F,{tooShortMessage:B,minimum:E});Validate.Length(F,{tooLongMessage:D,maximum:H});break;case (E!==null):if(F.length<Number(E)){Validate.fail(B);}break;case (H!==null):if(F.length>Number(H)){Validate.fail(D);}break;default:throw new Error("Validate::Length - Length(s) to validate against must be provided!");}return true;},Inclusion:function(H,F){var F=F||{};var K=F.failureMessage||"Must be included in the list!";var G=(F.caseSensitive===false)?false:true;if(F.allowNull&&H==null){return true;}if(!F.allowNull&&H==null){Validate.fail(K);}var D=F.within||[];if(!G){var A=[];for(var C=0,B=D.length;C<B;++C){var I=D[C];if(typeof I=="string"){I=I.toLowerCase();}A.push(I);}D=A;if(typeof H=="string"){H=H.toLowerCase();}}var J=false;for(var E=0,B=D.length;E<B;++E){if(D[E]==H){J=true;}if(F.partialMatch){if(H.indexOf(D[E])!=-1){J=true;}}}if((!F.negate&&!J)||(F.negate&&J)){Validate.fail(K);}return true;},Exclusion:function(A,B){var B=B||{};B.failureMessage=B.failureMessage||"Must not be included in the list!";B.negate=true;Validate.Inclusion(A,B);return true;},Confirmation:function(C,D){if(!D.match){throw new Error("Validate::Confirmation - Error validating confirmation: Id of element to match must be provided!");}var D=D||{};var B=D.failureMessage||"Does not match!";var A=D.match.nodeName?D.match:document.getElementById(D.match);if(!A){throw new Error("Validate::Confirmation - There is no reference with name of, or element with id of '"+D.match+"'!");}if(C!=A.value){Validate.fail(B);}return true;},Acceptance:function(B,C){var C=C||{};var A=C.failureMessage||"Must be accepted!";if(!B){Validate.fail(A);}return true;},Custom:function(D,E){var E=E||{};var B=E.against||function(){return true;};var A=E.args||{};var C=E.failureMessage||"Not valid!";if(!B(D,A)){Validate.fail(C);}return true;},now:function(A,D,C){if(!A){throw new Error("Validate::now - Validation function must be provided!");}var E=true;try{A(D,C||{});}catch(B){if(B instanceof Validate.Error){E=false;}else{throw B;}}finally{return E;}},fail:function(A){throw new Validate.Error(A);},Error:function(A){this.message=A;this.name="ValidationError";}};
