var old; var oldTab; function initGraph(id) { if (old != null) { old.style.display = "none"; oldTab.style.color = "#555555"; }; cur = document.getElementById('year'+id); cur.style.display = 'block'; curTab = document.getElementById('yearTab'+id); curTab.style.color = '#FF0000'; old = cur; oldTab = curTab; } function isblank(s) { for (var i = 0; i < s.length; i++) { var c = s.charAt(i); if ((c != ' ') && (c != '\n') && (c != '\t')) return false; } return true; } function verifyComment(f) { var empty_fields = new Array(); f.name.mandatory = true; f.email.mandatory = true; f.comment.mandatory = true; f.captcha.mandatory = true; for (var i = 0; i < f.length; i++) { var e = f.elements[i]; if (((e.type == 'text') || (e.type == 'textarea')) && e.mandatory) { document.getElementById('error_' + e.name).style.display = 'none'; document.getElementById(e.name).style.borderTop = '1px solid #CCC'; document.getElementById(e.name).style.borderRight = '1px solid #CCC'; document.getElementById(e.name).style.borderBottom = '1px solid #CCC'; document.getElementById(e.name).style.borderLeft = '3px solid #CCC'; if ((e.value == null) || (e.value == '') || isblank(e.value)) { empty_fields.push(e.name); continue; } } } if (empty_fields.length == 0) return true; if (empty_fields.length > 0) { for (var i = 0; i < empty_fields.length; i++) { document.getElementById(empty_fields[i]).style.borderTop = '1px solid #C33'; document.getElementById(empty_fields[i]).style.borderRight = '1px solid #C33'; document.getElementById(empty_fields[i]).style.borderBottom = '1px solid #C33'; document.getElementById(empty_fields[i]).style.borderLeft = '3px solid #C33'; new Effect.Pulsate('error_' + empty_fields[i], {duration: 2.0, from: 0.5, afterFinish: showErrorMessages(empty_fields)}); } } return false; } function showErrorMessages(e) { for (var i = 0; i < e.length; i++) { document.getElementById('error_' + e[i]).style.display = 'block'; } }