function openWindow(theURL,height,width) {
	var winName = height;
	var features = "'scrollbars=no,resizable=no,toolbar=no,location=no,menubar=no,status=no,height=" + height + ",width=" + width + "'"
  	window.open(theURL,winName,features).focus();
}  

function redirectTo(thisLink){
	opener.window.location.href = thisLink;
	window.close();
}

function register() {
	var alertMessage = "The following fields are required but were not filled in correctly:\n";
	var dataValid = true;
	

	if (eCheck(document.dataForm.txtEmail.value)==false){
		alertMessage = alertMessage + "\n-> Email Address";
		dataValid = false;
	} else if (document.dataForm.txtEmail.value != document.dataForm.txtConfirmEmail.value){
		alertMessage = alertMessage + "\n-> Email Addresses entered do not match";
		dataValid = false;
	}
	
	if (document.dataForm.txtFname.value == "") {
		alertMessage = alertMessage + "\n-> First Name";
		dataValid = false;
	}

	if (document.dataForm.txtLname.value == "") {
		alertMessage = alertMessage + "\n-> Last Name";
		dataValid = false;
	}
	
	if (document.dataForm.txtCompany.value == "") {
		alertMessage = alertMessage + "\n-> Name of Company";
		dataValid = false;
	}
	if (!document.dataForm.chkAcceptPolicy.checked) {
		alertMessage = alertMessage + "\n-> Privacy Policy Checkbox";
		dataValid = false;
	}
	
	if (dataValid == true) {
		document.dataForm.submit(); 
		} else {
		alert (alertMessage);
		return false;
	}

}


function eCheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
		return false
	}else if ((str==null)||(str=="")){
		return false
	}else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		return false
	}else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}else if (str.indexOf(at,(lat+1))!=-1){
		return false
	}else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}else if (str.indexOf(dot,(lat+2))==-1){
		return false
	}else if (str.indexOf(" ")!=-1){
		return false
	} else {
 		return true		
 	}			
}

function openDiv(divName){
	if( document.getElementById )
		{
			var obj = document.getElementById(divName);
			if( obj.style.display == 'none' )
			{
				obj.style.display = 'block';
			} else {
			var theDiv = divName;
				setTimeout("document.getElementById('" + theDiv + "').style.display = 'none'",3500);
			}
		}
}
