var DHTML = (document.getElementById || document.all); //geen Netscape 4
var screensize = 0; //geeft drie schermformaten weer: 800, 1024 en 1280
var windowsize = 0;

//functions

function zet_param( loc, param, def )
{
  var locationstring = "a"+loc;
  var pos, str, param_pos;
  var val = def;
  param += "=";

  pos = locationstring.indexOf('?');
  if ( pos != -1 )
  {
    str = locationstring.substr(pos);
    param_pos  = str.indexOf( param );

    if ( param_pos != -1 )
    {
      val = str.substring(param_pos+param.length)
      pos = val.indexOf(',');
      if ( pos != -1 )
      {
        val = val.substring(0, pos);
      }
    }
  }
  return( val );
}

function show(name)
{
	if (!DHTML) return;
	{
		var x = getObj(name);
		x.visibility = 'visible';
	}
}

function hide(name)
{
	if (!DHTML) return;
	{
		var x = getObj(name);
		x.visibility = 'hidden';
	}
}

function getObj(name)
{
  if (document.getElementById)
  {
    return document.getElementById(name).style;
  }
  else if (document.all)
  {
    return document.all[name].style;
  }
  else return false;
}

function detectscreensize() {
  if (screen.width >= 1280) {
    screensize=1280;
  }
  else if (screen.width >= 1024) {
    screensize=1024;
  }
  else {
    screensize=800;
  }
}

function getFile(pURL,targetdiv) {
   if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc 
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=postFileReady(targetdiv);
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
   } else if (window.ActiveXObject) { //IE 
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP'); 
      if (xmlhttp) {
         xmlhttp.onreadystatechange=postFileReady(targetdiv);
         xmlhttp.open('GET', pURL, false);
         xmlhttp.send();
      }
   }
}

// function to handle asynchronous call
function postFileReady(target) {
   if (xmlhttp.readyState==4) { 
      if (xmlhttp.status==200) { 
         document.getElementById(target).innerHTML=xmlhttp.responseText;
      }
   }
}

function check_form(form, taal)
{
  if (form.naam.value =="")
  {
    alert ( "Vergeet je naam niet ..." );
    form.naam.style.backgroundColor = '#ffd9d9';
    form.naam.focus();
    return false;
  }

  if (form.email.value =="")
  {
    alert ( "Vergeet je E-mail-adres niet ..." );
    form.email.style.backgroundColor = '#ffd9d9';
    form.email.focus();
    return false;
  }
  else
  {
    emailValue= new String(form.email.value);
    emailHasAt=emailValue.indexOf("@");
    emailHasPeriod=emailValue.indexOf(".");
    if ((emailHasAt == -1) || (emailHasPeriod == -1 ))
    {
      alert ( "Dit lijkt mij geen geldig E-mail-adres ..." );
      form.email.style.backgroundColor = '#ffd9d9';
      form.email.focus();
      return false;
    }
  }
}

