var __blinkTimes = 10;
doBlink = function() { if ($('blink')) { if(__blinkTimes > 0) { $('blink').style.background = (__blinkTimes % 2 == 0) ? '#ffff00' : '#F5F5F5'; __blinkTimes--; setTimeout('doBlink()', 200); } } };
checkEmail = function (val) {
   var format = /^[0-9a-z]([-+_\.]*[0-9a-z])*@[0-9a-z]([-_\.]?[0-9a-z])*\.[a-z]{2,3}$/i;
   return (val.match(format));
};
validChars = function (txt) { for (i = 0; i < txt.length; i++) { var theChar = txt.substring(i, i+1); if ( ( theChar < 'a' || theChar > 'z' ) &&	( theChar < 'A' || theChar > 'Z' )   && ( theChar < '0' || theChar > '9' ) &&	( theChar < '_' || theChar > '_' ) ) { return theChar; } } return ''; };
leapYear = function(year) { var totalDays = 28; if (year % 4 == 0) { if (year % 100 == 0) { if (year % 400 == 0) totalDays = 29; } else totalDays = 29; } return totalDays; };
fix = function(obj) { $(obj).focus(); };
do_progress = function() { $('dos').value = '';$('editor_form').action = '';$('editor_form').submit(); };

editAvatar = function(val, evt) {
	var ico_layer = $('icons');
	if (ico_layer) {
		if (ico_layer.style.visibility == 'hidden') {
			positionLayer('icons', evt, '','');
			toggleSelects('hide');
			ico_layer.style.visibility = 'visible';
			ico_layer.style.display = 'block';
		}
		else {
			ico_layer.style.visibility = 'hidden';
			ico_layer.style.display = 'none';
		}
	}
};

selectAvatar = function(icon) {
	var pObj = $('pic-profile');
	if (pObj) {
		$('icons').style.visibility = 'hidden';
		$('icons').style.display = 'none';
		pObj.src = '/images/icons/usericon'+icon+'.jpg';
		$('avatar').value = icon;
		toggleSelects('show');
		if ($('member_name')) $('member_name').focus();
	}
};

closeAvatars = function() {
	$('icons').style.visibility = 'hidden';
	$('icons').style.display = 'none'; //fix a scrolling bug with invisible layer
	toggleSelects('show');
	if ($('member_name') && $('member_name').type != 'hidden') $('member_name').focus();
};

function validInput(formObj, fld) {
	var txt = formObj.value;
	for (i = 0; i < txt.length; i++) {
		var theChar = txt.substring(i, i+1);
		if ( ( theChar < 'a' || theChar > 'z' ) &&	( theChar < 'A' || theChar > 'Z' ) 
		  && ( theChar < '0' || theChar > '9' ) &&	( theChar < '_' || theChar > '_' ) ) {
			alert("Problem: " + fld + " field contains an invalid character:\nThis is the character inside parentheses: (" + theChar + ")\nIf you don't see a character it could be a space. \nPlease remove the offending character.");
			if (formObj.type == 'text') formObj.select();
			return false;
		}
	}
	return true;
};