function createRequestObject()
{
   	var ro;
   	var browser = navigator.appName;
   	
	if(browser == "Microsoft Internet Explorer")
	{
        	
		Ajax = new ActiveXObject("Microsoft.XMLHTTP");
   	
	}
	else
	{
       	
		Ajax = new XMLHttpRequest();
  	 	
	}
  	
	return Ajax;
		
}

var AjaxObject = new createRequestObject();
var FotoNummer = 1;
var FotoCount = 0;

function StartWisselIndex(Count)
{
	FotoCount = Count;
	setTimeout("VeranderFotoIndex()",1000);
}

function VeranderFotoIndex()
{	 
	FotoNummer = Math.ceil(Math.random() * FotoCount);
	AjaxObject.open('get', 'External/Foto.php?unique=' + Math.random()); 
	AjaxObject.onreadystatechange = VeranderFotoEindIndex;
	AjaxObject.send(null);
}

function VeranderFotoEindIndex()
{
	if(AjaxObject.readyState == 4)
	{		
		document.getElementById("FotoVak_"+FotoNummer).innerHTML = AjaxObject.responseText;
		StartWisselIndex(FotoCount);
	}
} 

//---------------------------------------------//

var VeldID = '';
function VeranderFotoCategorie(VeldNaam, CategorieID)
{	 
	FotoNummer = Math.ceil(Math.random() * FotoCount);
	VeldID = VeldNaam;
	AjaxObject.open('get', 'External/Foto.php?catID='+CategorieID+'&unique=' + Math.random()); 
	AjaxObject.onreadystatechange = VeranderFotoEindCategorie;
	AjaxObject.send(null);
}

function VeranderFotoEindCategorie()
{
	if(AjaxObject.readyState == 4)
	{		
		document.getElementById(VeldID).innerHTML = AjaxObject.responseText;
	}
} 

//---------------------------------------------//

var VeldID = '';
function VeranderFotoProjecten(VeldNaam, projectID)
{	 
	FotoNummer = Math.ceil(Math.random() * FotoCount);
	VeldID = VeldNaam;
	AjaxObject.open('get', '../../External/Foto.php?projectID='+projectID+'&unique=' + Math.random()); 
	AjaxObject.onreadystatechange = VeranderFotoEindProjecten;
	AjaxObject.send(null);
}

function VeranderFotoEindProjecten()
{
	if(AjaxObject.readyState == 4)
	{		
		document.getElementById(VeldID).innerHTML = AjaxObject.responseText;
	}
} 