var errorLabelList = '';
var errorIDList = '';
var errorDisplayList = '';
// Initial Values for Add Buttons on Order Form
var modCount = 3;
var seroCount = 3;
var requestCount = 3;

function isBlank(inputObj) { 
 for(var x = 0; x < inputObj.value.length; x++) {
  if(inputObj.value.charCodeAt(x) != 32) {
   return false;
  }  
 }
 return true;
}

function isValidEmail(inputObj) {
 if(inputObj.value.indexOf('@') == -1 || inputObj.value.indexOf('.') == -1) {
  return false;
 }
 else {
  var tmp1 = inputObj.value.split("@");
  var tmp2 = tmp1[1].split(".");
  if(tmp1[0].length < 1 || tmp2[0].length < 2 || tmp2[1].length < 2) {
   return false;
  }   
 }
 return true;
}

function isNumeric(sText)
{	
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
}

function isRadioSelected(inputObj) { 
 for(x = 0; x < inputObj.length; x++) {
  if(inputObj[x].checked) {	    
   return inputObj[x].value;
  }
 }	  
 return false;
}

function isValidZip(inputObj) {
 if(isNumeric(inputObj.value) && inputObj.value.length == 5) { 
  return true;
 }
 else {
  return false;
 }
}

function isValidFullZip(inputObj) {}

function isValidPhone(inputObj) {

 if (inputObj.value.indexOf('x') == -1 && inputObj.value.indexOf('X') == -1) {
	  if (inputObj.value.length >= 10 && inputObj.value.length <=14) {
		  return true;
	  }
 }
 else {
	 if (inputObj.value.length >= 12 && inputObj.value.length <=19) {
		  return true;
	 }
 }
 return false;

 
}
function validatelogin() {
	if (isBlank(document.loginform.username)) {
		alert('Please supply a username');
		document.loginform.username.focus();
		return false;
  }
	if (isBlank(document.loginform.password)) {
		alert('Please supply a password');
		document.loginform.password.focus();
		return false;
  }  
}	

function showDesc(descNum) {
	for (i=1; i<=4; i++) {
		if (descNum != i) {
			document.getElementById('mouseover'+i).style.display="none";
		}
	  else {
	  	document.getElementById('mouseover'+i).style.display="inline";
	  }
	}
}

function validateRequest() {
	 var errArray;
	 
	 // Clear Errors
   if (errorLabelList != '') {
   	 errArray = errorLabelList.split(',');
   	 for (i=0; i < errArray.length; i++) {
   	 	 document.getElementById(errArray[i]).style.border = '0px none';
   	 }   	
   	 document.getElementById('errorMessages').innerHTML = '';
   	 document.getElementById('errorMessages').style.display = 'none';
   	 
   	 errorIDList = '';
   	 errorLabelList = '';
   	 errorDisplayList = '';
   }	
   
   if (isBlank(document.getElementById('title'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'title';
   	   errorLabelList = errorLabelList + 'titleLabel';
   	   errorDisplayList = errorDisplayList + 'Title is a required field.';   	 	
   }  
   if (isBlank(document.getElementById('fname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'fname';
   	   errorLabelList = errorLabelList + 'fnameLabel';
   	   errorDisplayList = errorDisplayList + 'First Name is a required field.';   	 	   	 	
   }  
   if (isBlank(document.getElementById('lname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'lname';
   	   errorLabelList = errorLabelList + 'lnameLabel';
   	   errorDisplayList = errorDisplayList + 'Last Name is a required field.';   	 	
   }        
   if (isBlank(document.getElementById('institution'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'institution';
   	   errorLabelList = errorLabelList + 'institutionLabel';
   	   errorDisplayList = errorDisplayList + 'Institution is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('street'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'street';
   	   errorLabelList = errorLabelList + 'streetLabel';
   	   errorDisplayList = errorDisplayList + 'Street Address is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('city'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'city';
   	   errorLabelList = errorLabelList + 'cityLabel';
   	   errorDisplayList = errorDisplayList + 'City is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('state'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'state';
   	   errorLabelList = errorLabelList + 'stateLabel';
   	   errorDisplayList = errorDisplayList + 'State is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('zip'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'zip';
   	   errorLabelList = errorLabelList + 'zipLabel';
   	   errorDisplayList = errorDisplayList + 'ZIP is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('phone'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'phone';
   	   errorLabelList = errorLabelList + 'phoneLabel';
   	   errorDisplayList = errorDisplayList + 'Phone is a required field.';   	 	
   } 
   if (!isValidEmail(document.getElementById('email'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'email';
   	   errorLabelList = errorLabelList + 'emailLabel';
   	   errorDisplayList = errorDisplayList + 'E-mail must be in the proper format.'; 
   }
      	
   if (errorIDList != '') {
   	var errDisplay = '<strong>The following errors have occurred:</strong><ul>';
   	
   	errIDArray = errorIDList.split(',');
   	errLabelArray = errorLabelList.split(',');
   	errDisplayArray = errorDisplayList.split(',');

   	for (i=0; i < errLabelArray.length; i++) {   		
   		document.getElementById(errLabelArray[i]).style.border='1px solid #FF0000';	 
   		errDisplay = errDisplay + '<li>' + errDisplayArray[i] + '</li>';
   	}   	
   	errDisplay = errDisplay + '</ul>';
   	
   	document.getElementById('errorMessages').innerHTML = errDisplay;
   	document.getElementById('errorMessages').style.display = 'block';
   	document.getElementById(errIDArray[0]).focus();
   	return;
   }
   else  {
     document.getElementById('litRequest').submit();   	    
   }
}

function validateMSContactForm() {
   	var errArray;
	 
	 // Clear Errors
	if (errorIDList != '') {
   	 errArray = errorIDList.split(',');
   	 for (i=0; i < errArray.length; i++) {
   	 	 document.getElementById(errArray[i] + 'Container').className  = 'inputContainer';
   	 }   	
   	 document.getElementById('errorContainer').innerHTML = '';
   	 document.getElementById('errorContainer').style.display = 'none';
   	 
   	 errorIDList = '';
   	 errorDisplayList = '';
   	}	


   if (isBlank(document.getElementById('title'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'title';
   	   errorDisplayList = errorDisplayList + 'Title is a required field.'; 
   }  

   if (isBlank(document.getElementById('firstName'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'firstName';
   	   errorDisplayList = errorDisplayList + 'First Name is a required field.'; 
   }  

   if (isBlank(document.getElementById('lastName'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'lastName';
   	   errorDisplayList = errorDisplayList + 'Last Name is a required field.'; 
   } 

   if (isBlank(document.getElementById('institution'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'institution';
   	   errorDisplayList = errorDisplayList + 'Institution is a required field.'; 
   } 
   
  if (isBlank(document.getElementById('yourPhone'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'yourPhone';
   	   errorDisplayList = errorDisplayList + 'Your Phone is a required field.'; 
   } 
  else if (!isValidPhone(document.getElementById('yourPhone'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'yourPhone';
   	   errorDisplayList = errorDisplayList + 'You must enter a valid phone number.'; 
  }
  
  if (isBlank(document.getElementById('yourEmail'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'yourEmail';
   	   errorDisplayList = errorDisplayList + 'E-mail is a required field.'; 
   } 

  else if (!isValidEmail(document.getElementById('yourEmail'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'yourEmail';
   	   errorDisplayList = errorDisplayList + 'E-mail must be in the proper format.'; 
   }
   
 //add jn 5-6-10  
   if (isBlank(document.getElementById('subjectInq'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'subjectInq';
   	   errorDisplayList = errorDisplayList + 'Please select a subject for your inquiry.'; 
   } 
   
 //end add  
   

   	if (errorIDList != '') {
   	 var errDisplay = '<div><h3>Oops! You missed a few input fields.</h3><ul id="errorDetail">';
   	
   	 errIDArray = errorIDList.split(',');
   	 errDisplayArray = errorDisplayList.split(',');

   	 for (i=0; i < errIDArray.length; i++) {   		
   		document.getElementById(errIDArray[i] + 'Container').className  = 'validationError';	 
   		errDisplay = errDisplay + '<li>' + errDisplayArray[i] + '</li>';
   	 }   	
   	 errDisplay = errDisplay + '</ul></div>';

	 document.getElementById('errorContainer').innerHTML = errDisplay;
   	 document.getElementById('errorContainer').style.display = 'block';
   	 document.getElementById(errIDArray[0]).focus();
   	 return false;
   	}
   	else  {
	 return true;
	}



return false;
}

function validateQuestionForm() {
	 var errArray;
	 
	 // Clear Errors
   if (errorLabelList != '') {
   	 errArray = errorLabelList.split(',');
   	 for (i=0; i < errArray.length; i++) {
   	 	 document.getElementById(errArray[i]).style.border = '0px none';
   	 }   	
   	 document.getElementById('errorMessages').innerHTML = '';
   	 document.getElementById('errorMessages').style.display = 'none';
   	 
   	 errorIDList = '';
   	 errorLabelList = '';
   	 errorDisplayList = '';
   }	
   
   if (isBlank(document.getElementById('title'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'title';
   	   errorLabelList = errorLabelList + 'titleLabel';
   	   errorDisplayList = errorDisplayList + 'Title is a required field.';   	 	
   }  
   if (isBlank(document.getElementById('fname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'fname';
   	   errorLabelList = errorLabelList + 'fnameLabel';
   	   errorDisplayList = errorDisplayList + 'First Name is a required field.';   	 	   	 	
   }  
   if (isBlank(document.getElementById('lname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'lname';
   	   errorLabelList = errorLabelList + 'lnameLabel';
   	   errorDisplayList = errorDisplayList + 'Last Name is a required field.';   	 	
   }        
   if (isBlank(document.getElementById('institution'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'institution';
   	   errorLabelList = errorLabelList + 'institutionLabel';
   	   errorDisplayList = errorDisplayList + 'Institution is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('phone'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'phone';
   	   errorLabelList = errorLabelList + 'phoneLabel';
   	   errorDisplayList = errorDisplayList + 'Phone is a required field.';   	 	
   } 
   if (!isValidEmail(document.getElementById('email'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'email';
   	   errorLabelList = errorLabelList + 'emailLabel';
   	   errorDisplayList = errorDisplayList + 'E-mail must be in the proper format.'; 
   }
   if (isBlank(document.getElementById('field'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'field';
   	   errorLabelList = errorLabelList + 'fieldLabel';
   	   errorDisplayList = errorDisplayList + 'Field of Interest is a required field.';   	 	
   }    	
   if (errorIDList != '') {
   	var errDisplay = '<strong>The following errors have occurred:</strong><ul>';
   	
   	errIDArray = errorIDList.split(',');
   	errLabelArray = errorLabelList.split(',');
   	errDisplayArray = errorDisplayList.split(',');

   	for (i=0; i < errLabelArray.length; i++) {   		
   		document.getElementById(errLabelArray[i]).style.border='1px solid #FF0000';	 
   		errDisplay = errDisplay + '<li>' + errDisplayArray[i] + '</li>';
   	}   	
   	errDisplay = errDisplay + '</ul>';
   	
   	document.getElementById('errorMessages').innerHTML = errDisplay;
   	document.getElementById('errorMessages').style.display = 'block';
   	document.getElementById(errIDArray[0]).focus();
   	return;
   }
   else  {
     document.getElementById('questionForm').submit();   	    
   }
}

function validateInquiry() {
		 var errArray;
	 
	 // Clear Errors
   if (errorLabelList != '') {
   	 errArray = errorLabelList.split(',');
   	 for (i=0; i < errArray.length; i++) {
   	 	 document.getElementById(errArray[i]).style.border = '0px none';
   	 }   	
   	 document.getElementById('errorMessages').innerHTML = '';
   	 document.getElementById('errorMessages').style.display = 'none';
   	 
   	 errorIDList = '';
   	 errorLabelList = '';
   	 errorDisplayList = '';
   }	
   
   if (isBlank(document.getElementById('title'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'title';
   	   errorLabelList = errorLabelList + 'titleLabel';
   	   errorDisplayList = errorDisplayList + 'Title is a required field.';   	 	
   }  
   if (isBlank(document.getElementById('fname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'fname';
   	   errorLabelList = errorLabelList + 'fnameLabel';
   	   errorDisplayList = errorDisplayList + 'First Name is a required field.';   	 	   	 	
   }  
   if (isBlank(document.getElementById('lname'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'lname';
   	   errorLabelList = errorLabelList + 'lnameLabel';
   	   errorDisplayList = errorDisplayList + 'Last Name is a required field.';   	 	
   }        
   if (isBlank(document.getElementById('institution'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'institution';
   	   errorLabelList = errorLabelList + 'institutionLabel';
   	   errorDisplayList = errorDisplayList + 'Institution is a required field.';   	 	
   } 
   if (isBlank(document.getElementById('phone'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'phone';
   	   errorLabelList = errorLabelList + 'phoneLabel';
   	   errorDisplayList = errorDisplayList + 'Phone is a required field.';   	 	
   } 
   if (!isValidEmail(document.getElementById('email'))) {
   	   if (errorIDList != '') {
   	   	errorIDList = errorIDList + ',';
   	   	errorLabelList = errorLabelList + ',';
   	   	errorDisplayList = errorDisplayList + ',';
   	   }
   	   errorIDList = errorIDList + 'email';
   	   errorLabelList = errorLabelList + 'emailLabel';
   	   errorDisplayList = errorDisplayList + 'E-mail must be in the proper format.'; 
   }
   	
   if (errorIDList != '') {
   	var errDisplay = '<strong>The following errors have occurred:</strong><ul>';
   	
   	errIDArray = errorIDList.split(',');
   	errLabelArray = errorLabelList.split(',');
   	errDisplayArray = errorDisplayList.split(',');

   	for (i=0; i < errLabelArray.length; i++) {   		
   		document.getElementById(errLabelArray[i]).style.border='1px solid #FF0000';	 
   		errDisplay = errDisplay + '<li>' + errDisplayArray[i] + '</li>';
   	}   	
   	errDisplay = errDisplay + '</ul>';
   	
   	document.getElementById('errorMessages').innerHTML = errDisplay;
   	document.getElementById('errorMessages').style.display = 'block';
   	document.getElementById(errIDArray[0]).focus();
   	return;
   }
   else  {
     document.getElementById('inqForm').submit();   	    
   }
}

function swapTab(tab) {	
  for (i = 0; i < tabArray.length; i++) {
    if (tabArray[i] == tab) {      
      document.getElementById('tabDiv'+tabArray[i]).style.display = 'inline';
      document.getElementById('tab'+tabArray[i]).src = '/frame-images/taconic/tabs/on/' + tabImgArray[i];
    }	
    else {
      document.getElementById('tabDiv'+tabArray[i]).style.display = 'none';
      document.getElementById('tab'+tabArray[i]).src = '/frame-images/taconic/tabs/off/' + tabImgArray[i];
    }
  }
}

function initTabs() { 
  for (i = 1; i < tabArray.length; i++) {  	
    document.getElementById('tabDiv'+tabArray[i]).style.display = 'none';
    document.getElementById('tab'+tabArray[i]).src = '/frame-images/taconic/tabs/off/' + tabImgArray[i];
  }
}	

function isValidDate(strDateObj) {
 var date1 = new Date();
 var dateComponents;
 
 if (strDateObj.value.indexOf(".") == -1) {
   dateComponents=strDateObj.value.split("/");
 }
 else {
   dateComponents=strDateObj.value.split("."); 	
 }
 if(dateComponents.length == 3) {  
  if(!isNaN(dateComponents[0]) && !isNaN(dateComponents[1]) && !isNaN(dateComponents[2])) {   
   if(dateComponents[0] < 13 && dateComponents[2] >= date1.getFullYear()) {    
    date1.setMonth(dateComponents[0]-1);	
	  date1.setFullYear(dateComponents[2]);	
	    return true;
   }
   else {    
    return false;
   }
  }
  else  {
   return false;
  }
 }
 else {
  return false;
 }
}

function checkDateAfter(arrDateObj) {
  var today = new Date();
  today.setHours(0);
  today.setMinutes(0);

  var date1;
  var date1split;
 
  if (arrDateObj.value.indexOf(".") == -1) {
    date1split=arrDateObj.value.split("/");
  }
  else {
    date1split=arrDateObj.value.split("."); 	
  }
    
  date1 = new Date(date1split[2],eval(date1split[0] - 1),date1split[1]);

  date1.setHours(0);
  date1.setMinutes(00);
  if (date1 <= today) {
    return false;
  }
  
  return true;
}

function clearErrors() {
   // Clear Errors
   if (errorLabelList != '') {
   	 
	 var errArray = errorLabelList.split(',');
   	 for (i=0; i < errArray.length; i++) { 
   	 	if (document.getElementById(errArray[i])) { 	 	
   	 	  document.getElementById(errArray[i]).style.border = '0px none';
   	 	}
   	 }   	

   	 document.getElementById('errorMessages').innerHTML = '';
   	 document.getElementById('errorMessages').style.display = 'none';
   	 
   	 errorLabelList = '';   	
   	 errorIDList = '';
   	 errorDisplayList = '';      	  
   }	
}

function setErrors(eLst,eLabelLst,eDispLst) {
  if (eLst != '') {
   	var errDisplay = '<strong>The following errors have occurred:</strong><ul>';
   	
   	errIDArray = eLst.split(',');
   	errLabelArray = eLabelLst.split(',');
   	errDisplayArray = eDispLst.split(',');

   	for (i=0; i < errLabelArray.length; i++) {   		
   		document.getElementById(errLabelArray[i]).style.border='1px solid #FF0000';	 
   		errDisplay = errDisplay + '<li>' + errDisplayArray[i] + '</li>';
   	}   	
   	errDisplay = errDisplay + '</ul>';
   	
   	document.getElementById('errorMessages').innerHTML = errDisplay;
   	document.getElementById('errorMessages').style.display = 'block';
   	document.getElementById(errIDArray[0]).focus();
   	return 1;
  }
  return 0;
}  