function submit_callback() {
	if ((document.callback.name.value == "") || (document.callback.email.value == "") || (document.callback.phone.value == "")) {
		alert("Please complete the form.");
	} else if (document.callback.email.value.indexOf("@") == -1) {
		alert("Email is invalid format (example: someone@somewhere.com)");
	} else {
		document.callback.submit();
	}
}

// 
function check() {
	if(document.forms.addForm.term_monthly) {
		for (i=0;i<document.forms.addForm.term_monthly.length;i++) {
			if (document.forms.addForm.term_monthly[i].checked) {
				document.forms.addForm.term_monthly[i].checked = false;
			}
		}
	}
	 if(document.forms.addForm.tomcat_type.value == '58' && (document.forms.addForm.vhost_type.value == '48' || document.forms.addForm.vhost_type.value == '' )) {
	 	alert('Tomcat Servlet Engine requires an I.P.-based account');
		document.forms.addForm.vhost_type.value='49';
	}
}

// Validate that a hosting term was selected
function validate() {
	for (i=0;i<document.forms.addForm.term_monthly.length;i++) {
		if (document.forms.addForm.term_monthly[i].checked)
			return true;
		}
	alert('Please select your hosting term');
	return false;
}

// Popup help windows
function getHelp(topic) {
	window.open('help.php?help='+topic, 'helpWin', 'width=375, height=250, left=50, top=50, toolbar=0, scrollbars=1, resizable=1');
}


var statusWin, toppos, leftpos;
toppos = (screen.height - 401)/2;
leftpos = (screen.width - 401)/2;
function showProgress() {
	statusWin = window.open('progress.php','Status','height=250,width=350,top='+toppos+',left='+leftpos+',location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes');
	statusWin.focus();
}

function hideProgress() {
	if (statusWin != null) {
		if (!statusWin.closed) {
			statusWin.close();
		}
	}
}

function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	popper = window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
	if (popper != null) {
		popper.focus();
	}
}

function Validator(theForm) {
	var error = ""; 
	if (theForm.name.value == "") {
		error += "-- Your name is required.\n";
	}  
	if (theForm.comment.value == "") {
	    error += "-- A message is required.\n";
	}  
	if (theForm.email.value == "") {
		error += "-- Please include an email address for a response.\n";
	}
	if ((theForm.email.value.indexOf ('@',0) == -1 ||
	   theForm.email.value.indexOf ('.',0) == -1) &&
	   theForm.email.value != "") {
		error += "-- Please verify that your email address is valid.\n";
	} 
	if (error != "") {
		alert("The following form field(s) were incomplete or incorrect:\n\n" + error + "\n Please complete or correct the form and submit again.");
		return (false);
	} else {
		return (true);
	} 
}

function like_our_kb(q) {
	var search = q;
	var like_our_kb_url = '/like_our_kb.php?eng='+search;
	yoyoma = window.open(like_our_kb_url, "like_our_kb","width=450,height=515,scrollbars=no,resizable=yes,status=no,toolbar=no,menu=no");
	yoyoma.top.location.href = like_our_kb_url;
	yoyoma.focus();
}
