// params must be an array of arrays with id of element, error message, id of element above which the error message should be diplayed
function gsClientValidate(params) {
	var isErr = false;
	var errs = document.getElementsByClassName('blueError');
  for(i=0; i<errs.length; i++) {
		errs[i].style.display = 'none';
	}
	for(i=0; i<params.length; i++) {
		var tmp = params[i];
    var toCheck = $(tmp[3]).getInputs(null,tmp[0]);
    var msg = tmp[1];
    var errF = $(tmp[2]);
    if (toCheck[0].getValue()=='') {
//			new Insertion.Before(errF, '<div class="formError">'+msg+'</div>');
    	  new Insertion.Before(errF,'<div class="blueError"><div class="blueErrorR"><div class="blueErrorL">'+msg+'</div></div><div class="cleaner"></div>');
        isErr = true;
		}
	}
	if (isErr) { return false }
	else { return true; }
}
// old function by mr Kersha changed to work with one form on a page and touching elements by ID
function gsClientValidateByElementId(params) {
	var isErr = false;
	var errs = document.getElementsByClassName('formError');
	for(i=0; i<errs.length; i++) {
		errs[i].style.display = 'none';
	}
	for(i=0; i<params.length; i++) {
		var tmp = params[i];
		if ($(tmp[0]).value=='') {
			new Insertion.Before(tmp[2], '<div class="formError">'+tmp[1]+'</div>');
			isErr = true;
		}
	}
	if (isErr) { return false }
	else { return true; }
}
