//CURRENTLY BEING USED IN VendorsLogin
/*
include this html
<div id="ErrorHolder">
          <div id="lyrErrX" class="errXAcct bordAcct">
    			  <a class="closebutton" href="javascript:void(0);" onclick="hideMe(); return false;">Close List</a>
   				</div>
   				<div id="lyrErr" class="errAcct"></div>
 			</div><!-- error holder -->

Here is usage JS Code in form page
function SubmitForm(){
   if (callValidate()){
	 Do Stuff
	 }
}		

function callValidate(){
    
 vhPage1.Validate();
 //alert(vhPage1.Passed);
    if (vhPage1.Passed != true){
		    clearErr();
        addErr('<b><u>The following fields are required<\/u><\/b>');
        addErr(vhPage1.StatusError);
        showErr();
        return false;
 
    }else{
        hideMe();
        clearErr();
       return true;   
    }
      
}
var vhPage1 = new ValidateHandler(document);
vhPage1.Fields    = ["s_un","s_pw","s_pw2","comp_name","con_name","s_email","s_email2","address","city","st","zip","phone","agree"];
vhPage1.FieldType = ["Username","Password","Confirm Password","Company Name","Contact Person","Email","Confirm Email","Address","City","State","Zip Code","Phone","Agree To Terms and Conditions"];
vhPage1.Matching = [new Array("s_email","s_email2"),new Array("s_pw","s_pw2")];
	
*/
function isdef(obj) { return (String(obj) != "undefined") && (String(obj) != "null") && (String(obj) != ""); };

//validation routines
    ValidateHandler = function(a){
	  this.aFields      = new Array();
	  this.aFieldType   = new Array();
    this.aMatching    = new Array();
	  this.passed = false;
	  this.doc = document;
    this.stat_err = "";
    this.aMatchCount=0;
	
	  ValidateHandler.prototype.Fields = this.aFields;
	  ValidateHandler.prototype.FieldType = this.aFieldType;
	  ValidateHandler.prototype.Matching = this.aMatching;
	  ValidateHandler.prototype.Passed = this.passed;
	  ValidateHandler.prototype.Doc = this.doc;
    ValidateHandler.prototype.MatchCount = this.aMatchCount;
	  ValidateHandler.prototype.StatusError = this.stat_err;
	  ValidateHandler.prototype.Clone = function (obj){
	     this.Fields    = obj.Fields;
	     this.FieldType = obj.FieldType;
	     this.Matching  = obj.Matching;
   	}
      
    ValidateHandler.prototype.findIndex = function(valueToMatch, arrayToMatch){
	  ix = -1;
		for (i=0;i<arrayToMatch.length;i++){
		  if (arrayToMatch[i]==valueToMatch){
		    ix=i;
		    break;  
		  }
    }  
    return ix;
   }

   ValidateHandler.prototype.DoesMatch = function(){
     this.MatchCount=0;
		 //alert("Matching_length = "+this.Matching.length);
		  for (j=0;j<this.Matching.length;j++){
			  var obj1 = this.doc.getElementById(this.Matching[j][0]);
		    var obj2 = this.doc.getElementById(this.Matching[j][1]);
				//alert("obj1 and obj2 = "+obj1.value+","+obj2.value);
				//alert("INDEX 1 Values = "+this.doc.getElementById(this.Matching[1][0]).value+","+this.doc.getElementById(this.Matching[1][1]).value);
		    ind1 = this.Matching[j][0]; //this.Fields.indexOf(this.Matching[i][0]);
		    ind2 = this.Matching[j][1];
        var obMatch1 = this.FieldType[this.findIndex(ind1, this.Fields)];
		    var obMatch2 = this.FieldType[this.findIndex(ind2, this.Fields)];
		    if (obj1.value != obj2.value){
		      this.MatchCount++;
		      this.StatusError=this.StatusError + '<br/><b>MisMatch:</b> \''+obMatch1+'\' and \''+obMatch2+'\' must match';
		    }
		    
			
			}
  	}

	  ValidateHandler.prototype.Validate = function(){
	    stat = 0;
	    bri = '';
	    this.StatusError = "";
		for (k=0;k<this.Fields.length;k++){if (this.StatusError==''){bri='';}else{bri='<br/>';}
		  var obj = this.doc.getElementById(this.Fields[k]);
      if (isdef(obj)){
			//alert(obj.type);
  		  switch (obj.type){
  		    case "text": if (obj.value == ""){stat++;this.StatusError=this.StatusError +bri+this.FieldType[k];} ; break;
  		    case "password": if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
  				case "select": if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
  				case "select-one": if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
					case "file": if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
  	   		case "textarea": if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
  		    case "checkbox": if (obj.checked != true){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
					case "select-multiple":if (obj.value == ""){stat++;this.StatusError=this.StatusError + bri+this.FieldType[k];} ; break;
  		    case "radio": break;
              default:;
  		  }
      }
		} 
        this.DoesMatch();
		   this.Passed = ((stat==0) && (this.MatchCount==0)); 
       }	
	}

  //page handler
  PageHandler=function(){
    this._PageID = 0;
    this._Pages = new Array();
    this._StartButton=null;
    this._EndButton=null;
    this._FinalizeButton=null;
    this.doc = document;
    this._useFinButton=false;

	//Page Navigation
    PageHandler.prototype.StartButton = this._StartButton;
    PageHandler.prototype.EndButton = this._EndButton;
    PageHandler.prototype.FinalizeButton = this._FinalizeButton;
    PageHandler.prototype.UseFinalizeButton = this._useFinButton;

    //Page markers
    PageHandler.prototype.Pages = this._Pages;
    PageHandler.prototype.PageCount = function(){return (this.Pages.length);}
    PageHandler.prototype.PageID = this._PageID;
    //Page functions
	PageHandler.prototype.BOL = function(){return (this.PageID == 0);}
	PageHandler.prototype.EOL = function(){a=this.PageCount(); a--; return (this.PageID >= a);}
    //pageSetter   
    PageHandler.prototype.SetPage = function(pid){
	                                              if ((pid>=0)&&(pid<=this.PageCount())){
	                                              var objNow = document.getElementById(this.Pages[this.PageID]);
	                                                  objNow.style.display = "none";
	                                                  this.PageID=pid;
	                                                  obj = this.doc.getElementById(this.Pages[this.PageID]);
	                                                  obj.style.display = "block";
    				                                  if (isdef(this.StartButton)){
													     this.StartButton.style.display=(this.BOL())?"none":"block";
													   }
    				                                  if (isdef(this.EndButton)){
													     this.EndButton.style.display=(this.EOL())?"none":"block";
													  }
													  if (isdef(this.FinalizeButton)){this.FinalizeButton.style.display=((this.UseFinalizeButton==true)&&(this.EOL()))?"block":"none";}
                                                   }
	}
    PageHandler.prototype.Forward = function(){cnt=this.PageID;cnt++; this.SetPage(cnt);}
    PageHandler.prototype.Backward = function(){cnt=this.PageID;cnt--; this.SetPage(cnt);}
    
  }
