function getXMLHttp(){
  var xmlHttp

  try{
    //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  
  catch(e){
    //Internet Explorer
    try{
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e){
      try{
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e){
        alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}

function HandleResponse(response){
  document.getElementById('project_content').innerHTML = response;
  document.getElementById('project_informatie').style.display = 'Block';
  scrollModalPosition();
}

function scrollModalPosition(){
	document.getElementById('project_informatie').style.top = (document.body.scrollTop) + "px";
}

function hide_div(div){
	document.getElementById(div).style.display ="none";
}
function show_div(div){
	document.getElementById(div).style.display ="block";
}

function show_foto(foto){
	show_div('fotos');
	changeOpac('90','achtergrond');
	changeOpac('100','fotos');
	document.getElementById('achtergrond').style.backgroundColor = '#CCCCCC';
	document.getElementById('achtergrond').style.color = '#FFFFFF';
	document.getElementById('foto').src = foto;
}

function change_foto(foto){
	document.getElementById('foto').src = foto;
}

function hide_foto(){
	document.getElementById('foto').src = '';
	document.getElementById('fotos').style.display ="none";
	changeOpac('100','achtergrond');
	document.getElementById('achtergrond').style.backgroundColor = '#FFFFFF';
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

function open_projectinfo(id){
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse(xmlHttp.responseText);
    }
  }
  xmlHttp.open("GET", "/local/projectinformatie.php?id="+id, true); 
  xmlHttp.send(null);
}

function open_projectfoto(id){
  var xmlHttp = getXMLHttp();
  
  xmlHttp.onreadystatechange = function()
  {
    if(xmlHttp.readyState == 4)
    {
      HandleResponse(xmlHttp.responseText);
    }
  }
  xmlHttp.open("GET", "/local/projectinformatie.php?u=foto&id="+id, true); 
  xmlHttp.send(null);
}
