document.write("<div id=\"join_box\" class=\"join_box\" style=\"width:313px;height:500px;\"><form enctype=\"multipart/form-data\" method=\"post\" action=\"faces_register.php\" onsubmit=\"return checkForm(this)\" ><input id=\"reg_username\" type=\"text\" class=\"join_username\" name=\"user\" onkeypress=\"return validate(this)\" onkeyup=\"makeLowerCase(this);\" title=\"Required - only letter and numbers allowed.\"><input id=\"reg_password1\" type=\"password\" class=\"join_password\" name=\"pass\" title=\"Required - enter your a password.\"><input id=\"reg_password2\" type=\"password\" class=\"join_password2\" name=\"pass2\" title=\"Required - enter your password again.\"><input id=\"reg_email\" type=\"text\" class=\"join_email\" name=\"email\" title=\"Required - enter a valid email address.\"><input id=\"browse\" type=\"file\" class=\"join_file\" value=\"\" name=\"browse\" title=\"Required - select an image. (jpg format only)\"><div class=\"join_file_button\"></div><input type=\"hidden\" name=\"myfile\"><input type=\"text\" class=\"join_fname\" name=\"fname\" title=\"Optional - enter your name.\"><input type=\"text\" class=\"join_lname\" name=\"lname\" title=\"Optional - enter your last name.\"><input type=\"text\" class=\"join_country\" name=\"country\" title=\"Optional - enter your country.\"><input type=\"text\" class=\"join_state\" name=\"state\" title=\"Optional - enter your state.\"><input id=\"reg_zip\" type=\"text\" class=\"join_zip\" name=\"zip\" title=\"Required - enter your zip code.\"><input type=\"submit\" class=\"join_button\" value=\"\" name=\"subjoin\" value=\"yes\" title=\"Click to join! Zip code now required.\"></form><div class=\"join_closeBtn\" onclick=\"closeJoinBox();\" title=\"Close window\"></div></div>");

	var myJoinBox;
	myJoinBox = document.getElementById("join_box");

	var screenPlusImgWidth = iecompattest().clientWidth - parseInt(myJoinBox.style.width);
	var halfOfRemainingWidth = screenPlusImgWidth/2;

	var screenPlusImgHeight = iecompattest().clientHeight - parseInt(myJoinBox.style.height);
	var halfOfRemainingHeight = screenPlusImgHeight/2;

	myJoinBox.style.left = parseInt(halfOfRemainingWidth) + "px";
	myJoinBox.style.top = parseInt(halfOfRemainingHeight) + "px";

	function checkForm(form){
		var username_value = document.getElementById("reg_username").value;
		if(username_value==""){
		alert("Missing username. Please correct and try again.");
		document.getElementById("reg_username").focus();
		return false;
		}

		var password1_value = document.getElementById("reg_password1").value;
		if(password1_value==""){
		alert("Missing password. Please correct and try again.");
		document.getElementById("reg_password1").focus();
		return false;
		}

		var password2_value = document.getElementById("reg_password2").value;
		if(password2_value==""){
		alert("Missing confirmation password. Please correct and try again.");
		document.getElementById("reg_password2").focus();
		return false;
		}

		if(password1_value != password2_value){
		alert("Passwords did not match. Please correct and try again.");
		document.getElementById("reg_password2").value = "";
		document.getElementById("reg_password2").focus();
		return false;
		}

		var email_value = document.getElementById("reg_email").value;
		if(email_value==""){
		alert("Missing email address. Please correct and try again.");
		document.getElementById("reg_email").focus();
		return false;
		}
		
		var str=document.getElementById("reg_email").value;
		AtPos = str.indexOf("@");
		StopPos = str.lastIndexOf(".");

		if (AtPos == -1 || StopPos == -1) {
			alert("Please input a valid email address!");
			return false;
		}

		if (StopPos < AtPos) {
			alert("Please input a valid email address!");
			return false;
		}

		if (StopPos - AtPos == 1) {
			alert("Please input a valid email address!");
			return false;
		} 

		var browse_value = document.getElementById("browse").value;
		if(browse_value==""){
		alert("Missing user image. Please correct and try again.");
		document.getElementById("browse").focus();
		return false;
		}

		var zip_value = document.getElementById("reg_zip").value;
		if(zip_value==""){
		alert("Missing zipcode. Please correct and try again.");
		document.getElementById("reg_zip").focus();
		return false;
		}

		return true;
	}

