function isblank (str)
{
	var i;
	var c;

	for (i = 0; i < str.length; i++) {
		c = str.charAt (i);
		if ((c != ' ') && (c != '\t') && (c != '\n'))
			return (false);
	}

	return (true);
}


function isemail (str)
{
	var re1 = new RegExp ("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var re2 = new RegExp ("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

	return (!re1.test (str) && re2.test (str));
}


function isvaliduser (str)
{
	var re = new RegExp ("^[a-zA-Z]([a-zA-Z0-9\\-\\.\\_\\@])*$");

	return (re.test (str));
}


function isvaliddate (year, month, day)
{
	var ly;

	if (year % 4 == 0)
		if (year % 100 == 0)
			if (year % 400 == 0)
				ly = 1;
			else
				ly = 0;
		else
			ly = 1;
	else
		ly = 0;

	switch (month) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
		case "January":
		case "March":
		case "May":
		case "July":
		case "August":
		case "October":
		case "December":
			return ((day >= 1) && (day <= 31));
			break;

		case 2:
		case "February":
			if (ly)
				return ((day >= 1) && (day <= 29));
			else
				return ((day >= 1) && (day <= 28));
			break;

		case 4:
		case 6:
		case 9:
		case 11:
		case "April":
		case "June":
		case "September":
		case "November":
			return ((day >= 1) && (day <= 30));
			break;

		default:
			return (false);
	}
}


function confirm_del (object)
{
	var msg;

	msg = "Are you sure you want to delete this " + object + "?\n\n";
	msg += "Note: to avoid seeing this message in the future, uncheck the \"Confirm\n";
	msg += "deletes\" option in the \"General Info\" tab of the \"My account\" page.";

	return (confirm (msg));
}


function upload_warning (file)
{
	var msg;

	if (file != "") {
		msg = "You are about to upload a file to our server, and should\n";
		msg += "be aware that the upload time will vary depending on the\n";
		msg += "size of the file and the speed of your Internet connection.\n";
		msg += "There are some tips on how to reduce some of your file sizes\n";
		msg += "to achieve faster uploads in the Help Index.\n\n";
		msg += "Note: to avoid seeing this message in the future, uncheck the\n";
		msg += "\"Upload warnings\" option in the \"General Info\" tab of the \"My\n";
		msg += "account\" page.";

		alert (msg);
	}

	return (true);
}
