function OpenOptio(media_url, lang, mod, prod)
{
  var strID = '20050000';
  var strPkgInfo = 'language=' + lang + '&loadmodule=' + mod + '&pid=' + prod;
  var winLeft = (screen.width-640)/2;
  var winTop = (screen.height-560)/2;  
  window.open(media_url + '/?'+strPkgInfo+'&id='+strID,'OptioDentistryWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=640,height=560,top='+winTop+',left='+winLeft+',bgcolor=#000000');
}

function LaunchGame(media_url)
{
  var strID = '20050000';
  var winLeft =(screen.width-543)/2;
  var winTop = (screen.height-540)/2;  
  window.open(media_url + '/kidszone/game.php?id='+strID,'OptioGame','scrollbars=no,menubar=no,toolbar=no,status=no,width=543,height=540,top='+winTop+',left='+winLeft+',resizable=no');
} 

function showError(message) {
	$('p.message').hide();	
	if ($('#error-message')) {
		$('#error-message').html(message);
		$('#error-message').show();
		window.scrollTo(0,0);	
	} else {
		alert(message);
	}
}

function checkCommentForm(form) {
	error = false;
	
	// Check if all fields have been filled in
	if (form.name.value == '') { error = true; form.name.className = "error"; } else { form.name.className = ""; }
	if (form.practice.value == '') { error = true; form.practice.className = "error"; } else { form.practice.className = ""; }
	if (form.email.value == '') { error = true; form.email.className = "long error"; } else { form.email.className = ""; }
	if (error) {
		showError("Please complete all required fields.");
		return false;
	}	
}

function checkPartnerForm(form) {
	error = false;
	
	// Check if all fields have been filled in
	if (form.email.value == '') { error = true; form.email.className = "long error"; } else { form.email.className = ""; }
	if (error) {
		showError("Please complete all required fields.");
		return false;
	}	
}

function addToMailingList(form) {
	if (form.email.value == '') return false;
	http = create_http_request();
	http.onreadystatechange = function() {
		if (http.readyState == 4 && http.status == 200) {
			var div = document.getElementById("mailing-list");
			div.innerHTML = "<p id=\"thank-you\">Thank you for your interest.</p>";
			$("#thank-you").fadeIn();
		}
	}
	var url = form.action + "?email=" + encodeURI(form.email.value);
	http.open("POST", url, true);
	http.send(null);	
	return false;		
}