if(typeof fvalidate=="undefined"){
var fvalidate=new Object();
}
fvalidate.addEvent=function(_1,_2,fn,_4){
if(typeof _1.attachEvent!="undefined"){
_1.attachEvent("on"+_2,fn);
}else{
if(typeof _1.attachEventListener!="undefined"){
_1.addEventListener(_2,fn,Boolean(_4));
}
}
};
fvalidate.addEvents=function(_5,_6,fn,_8){
var i=0,_a;
while(_a=_6[i++]){
this.addEvent(_5,_a,fn,Boolean(_8));
}
};
function validateForm(f,_c,_d,_e,_f,_10){
_c=Boolean(_c);
_d=Boolean(_d);
_e=Boolean(_e);
_f=Boolean(_f);
_10=(typeof _10!="undefined")?parseInt(_10,10):0;
var _11,_12,_13;
if(typeof f.fv=="undefined"){
f.fv=new fValidate(f,_10,_f);
}else{
f.fv._reset();
f.fv.errorMode=_10;
}
var _14,i=0,_16=f.fv.config.code;
while(_14=f.elements[i++]){
if(_14.nodeName=="FIELDSET"){
continue;
}
_12=(_14[_16])?_14[_16]:_14.getAttribute(_16);
if(!(typeof _12=="undefined"||_12==null||_12=="")){
_11=_12.split("|");
_13=_11[0];
_14.validated=true;
if(typeof f.fv[_13]=="undefined"){
f.fv.devError([_13,_14.name],"notFound");
return false;
}
switch(_11.last()){
case "bok":
_11=_11.reduce(1,1);
_14.bok=true;
break;
case "if":
_11=_11.reduce(1,1);
_14._if_=true;
break;
case "then":
_11=_11.reduce(1,1);
_14._then_=true;
break;
default:
_11=_11.reduce(1,0);
}
if(/radio|checkbox/.test(_14.type)){
_14.group=f.elements[_14.name];
}
if(typeof _14.fName=="undefined"){
if(typeof _14.group!="undefined"){
for(var j=0;j<_14.group.length;j++){
if(f.fv.config.clearEvent!=null){
addEvent(_14.group.item(j),f.fv.config.clearEvent,f.fv,"revertError",false);
}
}
}else{
addEvent(_14,f.fv.config.clearEvent,f.fv,"revertError",false);
}
}
_14.fName=_14.name.format();
f.fv.elem=_14;
f.fv.type=_13;
var _18=new Function("obj","method","obj[method]( "+_11.toArgString()+" );");
_18(f.fv,_13);
if(_14.validated==false&&_f==false){
return false;
}
if(_14.validated==true){
f.fv.revertError();
}
}
}
if(_f){
f.fv.showGroupError();
}
if(f.fv.errors.length>0){
return false;
}
if(_c&&!confirm(f.fv.config.confirmMsg)){
if(f.fv.config.confirmAbortMsg!=""){
alert(f.fv.config.confirmAbortMsg);
}
return false;
}
if(_d){
if(typeof f.fv.config.submitButton=="object"){
var sb,j=0;
while(sb=f.fv.config.submitButton[j++]){
if(f.fv.elementExists(sb)){
f.elements[sb].disabled=true;
}
}
}else{
if(f.fv.elementExists(f.fv.config.submitButton)){
f.elements[f.fv.config.submitButton].disabled=true;
}
}
}
if(_e&&f.fv.elementExists(f.fv.config.resetButton)){
f.elements[f.fv.config.resetButton].disabled=true;
}
return true;
function addEvent(_1a,evt,obj,_1d,_1e){
var _1f=_1a;
if(typeof _1a.attachEvent!="undefined"){
_1a.attachEvent("on"+evt,function(){
obj[_1d](_1f);
});
}else{
if(typeof _1a.addEventListener!="undefined"){
_1a.addEventListener(evt,function(){
obj[_1d](_1f);
},_1e);
}else{
if(f.fv.config.eventOverride){
eleme["on"+evt]=function(){
obj[_1d](_1f);
};
}
}
}
}
}
function fValidate(f,_21,_22){
var _23=this;
this.form=f;
this.errorMode=_21;
this.groupError=_22;
this.errors=new Array();
this.validated=true;
this.config=new fValConfig();
this.i18n=fvalidate.i18n;
f.onreset=function(){
var _24,i=0;
while(_24=this.elements[i++]){
_23.revertError(_24);
}
};
addLabelProperties();
function addLabelProperties(){
if(typeof f.getElementsByTagName=="undefined"){
return;
}
var _26=f.getElementsByTagName("label");
var _27,i=j=0;
var _29;
while(_27=_26[i++]){
if(typeof _27.htmlFor=="undefined"){
return;
}
_29=f.elements[_27.htmlFor];
if(typeof _29=="undefined"){
_23.devError([_27.htmlFor],"noLabel");
}else{
if(typeof _29.label!="undefined"){
continue;
}else{
if(typeof _29.length!="undefined"&&_29.length>1&&_29.nodeName!="SELECT"){
for(j=0;j<_29.length;j++){
_29.item(j).label=_27;
}
}
}
}
_29.label=_27;
}
}
}
fValidate.prototype._reset=function(){
this.errors=new Array();
this.showErrors=new Array();
};
fValidate.prototype.elementExists=function(_2a){
return Boolean(typeof this.form.elements[_2a]!="undefined");
};
fValidate.prototype.throwError=function(_2b,_2c){
var _2d=this.elem;
if(typeof _2d.name=="undefined"){
_2d=_2d[0];
}
if(_2d.bok&&this.isBlank()){
_2d.validated=true;
return;
}
if(_2d.cv){
return;
}
_2d.validated=false;
_2c=this.setArg(_2c,0);
_2b=this.setArg(_2b,[]);
emsgElem=(typeof this.elem.getAttribute=="undefined")?this.elem[0]:this.elem;
if(emsgElem.getAttribute(this.config.emsg)){
var _2e=emsgElem.getAttribute(this.config.emsg);
}
var _2e=this.translateMessage(_2b,this.i18n.errors[this.type][_2c]);
if(this.groupError){
this.errors.push({"elem":_2d,"msg":_2e});
}else{
this.showError(_2e,false,emsgElem);
var _2f=(typeof _2d.fields!="undefined")?_2d.fields[0]:_2d;
this.selectFocus(_2f);
}
};
fValidate.prototype.showError=function(_30,_31,_32){
var _33=this,_32=this.setArg(_32,this.elem),_34=Boolean(_32.type=="hidden"),_35=(_34)?null:_32.label||null,_30=(_32.getAttribute(this.config.emsg))?_32.getAttribute(this.config.emsg).replace(/\\n/g,"\n"):_30,_36=this.config.errorClass,_37=this.config.useSingleClassNames;
if(typeof this.showErrors=="undefined"){
this.showErrors=new Array();
}
switch(this.errorMode){
case 0:
alertError();
break;
case 1:
inputError();
break;
case 2:
labelError();
break;
case 3:
appendError();
break;
case 4:
boxError();
break;
case 5:
inputError();
labelError();
break;
case 6:
inputError();
appendError();
break;
case 7:
inputError();
boxError();
break;
case 8:
inputError();
alertError();
break;
case 9:
labelError();
appendError();
break;
case 10:
labelError();
boxError();
break;
case 11:
labelError();
alertError();
break;
case 12:
appendError();
boxError();
break;
case 13:
appendError();
alertError();
break;
case 14:
boxError();
alertError();
break;
case 15:
inputError();
labelError();
appendError();
break;
case 16:
inputError();
labelError();
boxError();
break;
case 17:
inputError();
labelError();
alertError();
break;
case 18:
inputError();
appendError();
boxError();
break;
case 19:
inputError();
appendError();
alertError();
break;
case 20:
inputError();
boxError();
alertError();
break;
case 21:
labelError();
appendError();
boxError();
break;
case 22:
labelError();
appendError();
alertError();
break;
case 23:
appendError();
boxError();
alertError();
break;
case 24:
inputError();
labelError();
appendError();
boxError();
break;
case 25:
inputError();
labelError();
appendError();
alertError();
break;
case 26:
inputError();
appendError();
boxError();
alertError();
break;
case 27:
labelError();
appendError();
boxError();
alertError();
break;
case 28:
inputError();
labelError();
appendError();
boxError();
alertError();
break;
}
function alertError(){
if(_33.groupError){
_33.showErrors.push(_30);
}else{
alert(_30);
}
if(_31){
alert(_33.i18n.groupAlert+_33.showErrors.join("\n\n- "));
}
}
function inputError(){
if((typeof _32.length!="undefined"&&_32.length>1&&_32.nodeName!="SELECT")||_34){
var _38,i=0;
while(_38=(_34)?_32.fields[i++]:_32.item(i++)){
if(_38.className!=""&&_37){
_38.revertClass=_38.className;
_38.className=_36;
}else{
_33.addCSSClass(_38,_36);
}
}
}else{
if(_37){
_32.revertClass=_32.className;
_32.className=_36;
}else{
_33.addCSSClass(_32,_36);
}
}
}
function labelError(){
if(_35==null){
return;
}
if(_33.config.useSingleClassNames){
_35.className=_36;
}else{
_33.addCSSClass(_35,_36);
}
}
function appendError(){
if(_35==null||typeof _35.innerHTML=="undefined"){
return;
}
if(typeof _35.original=="undefined"){
_35.original=_35.innerHTML;
}
_35.innerHTML=_35.original+" - "+_30.toHTML();
}
function boxError(){
if(typeof _33.boxError=="undefined"){
_33.boxError=document.getElementById(_33.config.boxError);
}
if(_33.boxError==null){
_33.devError([_33.config.boxError],"noBox");
return;
}
if(typeof _33.elem.name=="undefined"||_33.elem.name==""){
_33.devError([_33.elem[_33.config.code]],"missingName");
return;
}
var _3a=_33.config.boxErrorPrefix+_33.elem.name,_3b;
if(_3b=document.getElementById(_3a)){
_3b.firstChild.nodeValue=_30.toHTML();
}else{
_3b=document.createHTMLElement("li",{id:_3a,"innerHTML":_30.toHTML(),title:_33.i18n.boxToolTip});
_33.boxError.appendChild(_3b);
_3b.onclick=function(){
var _3c=_33.form.elements[this.id.replace(_33.config.boxErrorPrefix,"")];
if(typeof _3c.fields!="undefined"){
_3c=_3c.fields[0];
}
if(typeof _3c.select!="undefined"){
_3c.select();
}
if(typeof _3c.focus!="undefined"){
_3c.focus();
}
};
}
_33.boxError.style.display="block";
}
};
fValidate.prototype.removeCSSClass=function(_3d,_3e){
_3d.className=_3d.className.replace(_3e,"").trim();
};
fValidate.prototype.addCSSClass=function(_3f,_40){
this.removeCSSClass(_3f,_40);
_3f.className=(_3f.className+" "+_40).trim();
};
fValidate.prototype.showGroupError=function(){
for(var _41,_42,i=0;(_41=this.errors[i]);i++){
if(i==0){
_42=_41.elem;
}
this.elem=_41.elem;
this.showError(_41.msg,Boolean(i==(this.errors.length-1)));
}
var _44=(typeof _42.fields!="undefined")?_42.fields[0]:_42;
this.selectFocus(_44);
};
fValidate.prototype.revertError=function(_45){
_45=this.setArg(_45,this.elem);
var _46=Boolean(_45.type=="hidden"),_47=this.config.errorClass,i=0,_49,_4a;
if((typeof _45.length!="undefined"&&_45.length>1&&_45.nodeName!="SELECT")||_46){
if(_46&&typeof _45.fields!="undefined"){
while(_4a=(_46)?_45.fields[i++]:_45.item(i++)){
if(typeof _4a.revertClass!="undefined"){
_4a.className=_4a.revertClass;
}
}
}
}else{
if(this.config.useSingleClassNames){
if(typeof subElement.revertClass!="undefined"){
_45.className=_45.revertClass;
}
}else{
this.removeCSSClass(_45,_47);
}
}
if(typeof _45.label!="undefined"){
if(this.config.useSingleClassNames){
_45.label.className="";
}else{
this.removeCSSClass(_45.label,_47);
}
_45.label.innerHTML=(_45.label.original||_45.label.innerHTML);
}
if(typeof this.boxError!="undefined"){
if(typeof this.boxError.normalize!="undefined"){
this.boxError.normalize();
}
if(_49=document.getElementById(this.config.boxErrorPrefix+_45.name)){
this.boxError.removeChild(_49);
}
if(this.boxError.childNodes.length==0){
this.boxError.style.display="none";
}
}
};
fValidate.prototype.selectFocus=function(_4b){
if(typeof _4b.select!="undefined"){
_4b.select();
}
if(typeof _4b.focus!="undefined"){
_4b.focus();
}
};
fValidate.prototype.typeMismatch=function(){
var _4c={"text":"text|password|textarea","ta":"textarea","hidden":"hidden","s1":"select-one","sm":"select-multiple","select":"select-one|select-multiple","rg":"radio","radio":"radio","cb":"checkbox","file":"file"};
var _4d=false,_4e=new Array(),_4f=key=type=regex="";
for(var i=0;i<arguments.length;i++){
type=_4c[arguments[i]];
regex=new RegExp(type);
_4f+=(regex.test(this.elem.type))?"1":"0";
key+="0";
_4e.push(type);
}
if(key^_4f==0){
this.devError([this.elem.fName,this.elem.type,_4e.join("|").replace(/\|/g,this.i18n.or)],"mismatch");
this.elem.validated=false;
return true;
}
return false;
};
fValidate.prototype.getValue=function(_51){
switch(_51.type){
case "text":
case "password":
case "textarea":
case "hidden":
case "file":
return _51.value;
case "radio":
case "select-single":
if(typeof _51.length=="undefined"){
return _51.value;
}else{
for(var i=0;i<_51.length;i++){
choice=(_51.type=="radio")?"checked":"selected";
if(_51[i][choice]){
return _51[i].value;
}
}
}
case "select-multiple":
case "checkbox":
if(typeof _51.length=="undefined"){
return _51.value;
}else{
var _53=new Array();
for(var i=0;i<_51.length;i++){
choice=(_51.type=="checkbox")?"checked":"selected";
if(_51[i][choice]){
_53.push(_51[i].value);
}
}
return _53;
}
default:
return null;
}
};
fValidate.prototype.setArg=function(arg,def){
return (typeof arg=="undefined"||arg==""||arg==null)?def:arg;
};
fValidate.prototype.isBlank=function(el){
var _57=this.form.elements[el]||this.elem;
return Boolean(/^\s*$/.test(_57.value));
};
fValidate.prototype.translateMessage=function(_58,_59){
var msg="";
for(var i=0;i<_59.length;i++){
msg+=(typeof _59[i]=="number")?_58[_59[i]]:_59[i];
}
return msg;
};
fValidate.prototype.devError=function(_5c,_5d){
if(typeof _5c=="string"){
_5d=_5c;
_5c=[];
}
_5d=this.setArg(_5d,this.type);
var _5e=this.i18n.devErrors[_5d];
var a=[this.i18n.devErrors.lines[0],"----------------------------------------------------------------------------------------------",this.translateMessage(_5c,_5e),"----------------------------------------------------------------------------------------------",this.i18n.devErrors.lines[1]];
alert(a.join("\n"));
};
fValidate.prototype.paramError=function(_60,_61){
_61=this.setArg(_61,this.elem.name);
this.devError([_60,this.type,_61],"paramError");
};
document.createHTMLElement=function(_62,_63){
if(typeof document.createElement=="undefined"){
return;
}
var _64=document.createElement(_62);
if(typeof _63!="undefined"){
for(var i in _63){
switch(true){
case (i=="text"):
_64.appendChild(document.createTextNode(_63[i]));
break;
case (i=="class"):
_64.className=_63[i];
break;
default:
_64.setAttribute(i,"");
_64[i]=_63[i];
}
}
}
return _64;
};
Array.prototype.reduce=function(b,e){
var a=new Array();
var _69=0;
for(var i=b;i<this.length-e;i++){
a[_69++]=this[i];
}
return a;
};
Array.prototype.toArgString=function(){
var a=new Array();
for(var i=0;i<this.length;i++){
a.push("'"+this[i]+"'");
}
return a.toString();
};
if(typeof Array.push=="undefined"){
Array.prototype.push=function(){
var arg,i=0;
while(arg=arguments[i++]){
this[this.length]=arg;
}
return this.length;
};
}
Array.prototype.last=function(){
return this[this.length-1];
};
String.prototype.format=function(){
return this.replace(/\_/g," ").replace(/\[|\]/g,"");
};
String.prototype.toHTML=function(){
return this.replace(/\n/g,"<br />").replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;");
};
String.prototype.trim=function(){
return this.replace(/^\s+|\s+$/,"");
};
String.prototype.toPattern=function(){
return this.replace(/([\.\*\+\{\}\(\)\<\>\^\$\\])/g,"\\$1");
};

