// JavaScript Document

function changeLanguage(f)
{
    var theUrl = f.jump.options[f.jump.selectedIndex].value ;
    if (theUrl != "")
	{
            location.href = theUrl ;
    }
}

function goReturn()
{
	getEvent=event.keyCode;
	if (getEvent == "13")
	{
   		linkToId();
    }
}

function linkToId()
{
	var id = document.getElementById("enrollId").value;
	
	var valid = validateSpecialChars(id);
	if(valid)
	{
		var newLocation = "http://dtglobal.netra21.net/enroll.asp?sponsor=" + id;
		window.open (newLocation);
	}
}

function validateSpecialChars(myStringID)
{
	// declare which special chars to validate
	var illegalChars = " !@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	for (var i = 0; i < myStringID.length; i++)
	{
		if (illegalChars.indexOf(myStringID.charAt(i)) != -1)
		{
			alert ("The Sponsor ID you have entered contains either a space or one of the following special characters:\n" + illegalChars + "\nThese are not allowed.\nPlease remove them and try again.");
			return false;
		}
	}
	return true;
}
