


function CheckUserName(UserName){
	// SAVE THE ROUND TRIP IF THE NAME IS BLANK
	if(UserName != '') {
	
			var oXMLHttp = zXmlHttp.createRequest();
			var url = "/AddCompany/CheckUserName.asp?UserName=" + UserName

			oXMLHttp.open("GET", url + '&rnd=' + Math.random(), true);
			oXMLHttp.onreadystatechange = function() {
				if(oXMLHttp.readyState == 4) {
					if(oXMLHttp.status == 200){
						var Response = oXMLHttp.responseText;
						HandleResponse(Response)
					} else alert("There was an error while processing this screen.  The document was not ready to process. (Code: " + oXMLHttp.status + ")  Please try again.");
				}
			};
			oXMLHttp.send(null);
	}
}

function HandleResponse(sRes) {
	if(sRes == 0) {
		document.getElementById('lblUserNameStatus').innerHTML = "<strong><font color=\"red\">Username Taken, Please Try Another One.</font></strong>"
		document.getElementById('UserName').focus()
	}	else {
		document.getElementById('lblUserNameStatus').innerHTML = "<strong><font color=\"green\">Username Available</font></strong>"
	}
}

//  This function will select an item from a drop down list.
//  DropDownId - The id of the drop down box we are looking through.
//  ValToSet - This is the value from the drop down we are looking to match.
//  #### NOTES
//  This function must be called after the page has loaded... aka in the page onload.  Otherwise the drop down box
//  might not be printed to the site yet.
//  Created By:  AjW
function SelectFromDropDown(DropDownId, ValToSel) {
	VID = document.getElementById(DropDownId)
	for (var i=0;i<VID.length;i++) {
		if(VID.options[i].value == ValToSel) { 
			VID.options[i].selected = true;
			break;
		}
	}
}