function placeFocus()
{
	if (document.forms.length > 0)
	{
		var field = document.forms[0];
		for (i = 0; i < field.length; i++)
		{
			if ((field.elements[i].type == "text") || 
				 (field.elements[i].type == "textarea") || 
				 (field.elements[i].type.toString().charAt(0) == "s"))
			{
				document.forms[0].elements[i].focus();
				break;
			}
		}
	}
}

function verifyEmail(str)
{
	// are regular expressions supported?
	if (str == "") return false;
	var supported = 0;
	if (window.RegExp)
	{
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported)
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
	var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
	var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
	return (!r1.test(str) && r2.test(str));
}

function verifyUsername(str)
{
	if ((str == "") || (str == undefined) || (str == null)) return false;
	var GoodChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-";
	for (var i=0; i<=str.length-1; i++)
	{
		if (GoodChars.indexOf(str.charAt(i)) == -1)
		{
			return false;
		}
	}
	return true;
}

function cc()
{
	if (document.cookie == "") 
	{
		/* if a cookie is not found - alert user -
			change cookieexists field value to false */
		alert("Cookies must be enabled.");

		/* If the user has Cookies disabled an alert will let him know 
			that cookies need to be enabled to log on.*/ 

	    document.cookiecheck.cookieexists.value = "false";
	}
	else
	{
		/* this sets the value to true and nothing else will happen,
			the user will be able to log on*/
		document.cookiecheck.cookieexists.value = "true";
	}
}

/* Set a cookie to be sure that one exists.
   Note that this is outside the function*/
document.cookie = 'killme' + escape('nothing');
