function clientHeight()
{
  return filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientheight:0);
}

function clientWidth()
{
  return filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientwith:0);
}

function filterResults(n_win, n_docel, n_body)
{
  var n_result = n_win ? n_win : 0;
  if (n_docel && (!n_result || (n_result > n_docel))) n_result = n_docel;
  return n_body && (!n_result || (n_result > n_body))?n_body:n_result;
}

function splashload()
{
  document.getElementById("splashContainer").style.marginTop = ((clientHeight()-162)/2)+"px";
  window.onresize = splashload;
}

function checkEmail(address)
{
  var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  if (filter.test(address)) return true;
  else return false;
}

function checkForm(formName)
{
  var form  = document.getElementById(formName);
  var error = false;
  var errorMsg = "The following fields have not been filled out correctly:\n";
  if (form.name.value == null || form.name.value == "") 			                		{ error = true; errorMsg += "\n- name"; }
  if (form.company.value  == null || form.company.value  == "")		     					{ error = true; errorMsg += "\n- company"; }
  if (form.place.value == null || form.place.value == "") 	   			   		            { error = true; errorMsg += "\n- place"; }
  if (form.email.value == null || form.email.value == "" || !checkEmail(form.email.value)) { error = true; errorMsg += "\n- e-mail"; }
  if (form.note.value == null || form.note.value == "") 						    		{ error = true; errorMsg += "\n- note"; }
  if (error) alert(errorMsg);
  else document.getElementById(formName).submit();
}

function redirect()
{
  location.href = "index.jsp";
}

function F11()
{
  window.open("index.jsp", "", "channelmode");
}