function SetUname(strEmail){
	// Set up a default structure with null values 
	// incase our email matching fails.
	var strEmail = document.getElementById("Email").value
	
	var objParts = {
		user: null,
		domain: null,
		ext: null
		};
	 
	// Get the parts of the email address by leveraging
	// the String::replace method. We are 
	// matching on the whole string using ^...$ notation.
	strEmail.replace( 
		new RegExp( "^(.+)@(.+)\\.(\\w+)$" , "i" ), 
		 
		// Send the match to the sub-function.
		function( $0, $1, $2, $3 ){
			objParts.user = $1;
			objParts.domain = $2;
			objParts.ext = $3;
		}
		);
	 
	var strnew = Left(objParts.user,50) ;
	//alert(strnew);
	if (strnew != null)	{
		document.getElementById("Username").value=strnew;
	}
}


function Left(str, n)
{
   if (n <= 0)
         return "";
   else if (n > String(str).length)
         return str;
   else
         return String(str).substring(0,n);
}


function clickclear(thisfield, defaulttext, color) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
		if (!color) {
			color = "000";
		}
		thisfield.style.color = "#" + color;
	}
}
