

function companypage(comid)
{
	document.getElementById('companycontainer').style.display='none';
	document.getElementById('companysearchfield').style.display='none';
	document.getElementById('companydetailscontainer').style.display='';
	var httpObj = ajaxFunction();
	var query = "companyajax.php?qrnd=" + Math.random()  + "&action=companypage" + "&comid=" + comid;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('companydetailscontainer').innerHTML = httpObj.responseText;	
		}
	}
}

function searchcompany(zoek,activecontract,comtype,orderby)
{
	document.getElementById('companycontainer').style.display='';
	document.getElementById('companysearchfield').style.display='';
	document.getElementById('companydetailscontainer').style.display='none';
	var httpObj = ajaxFunction();
	var query = "companyajax.php?qrnd=" + Math.random()  + "&action=searchcompany" + "&zoek=" + zoek+ "&activecontract=" + activecontract + "&comtype=" + comtype + "&orderby=" + orderby;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('companycontainer').innerHTML = httpObj.responseText;	
		}
	}
}
function teamnewsophalen(ploegid,aantal,organisatieid)
{
	var httpObj = ajaxFunction();
	var query = "teamnewsajax.php?qrnd=" + Math.random() + "&ploegid=" + ploegid + "&aantal=" + aantal + "&organisatieid=" + organisatieid;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('teamnewscontainer').innerHTML = httpObj.responseText;	
		}
	}
}


function contentbox_calendar(month,year,container,param,organisatieid,actie)
{
	if(actie == '1'){
		var naam = container.split('-');
		var teller = naam[1];
		var newyear = year;
		var newmonth = month - teller;
		if(newmonth < 1){
			newmonth = Number(newmonth) + Number('12');
			newyear = Number(newyear) - Number('1');
		}
		
		var teller = '0';
		var newcontainer = naam[0] + '-' + teller;
		while(document.getElementById(newcontainer)){
			contentbox_calendar(newmonth,newyear,newcontainer,param,organisatieid,'0');
			newmonth = Number(newmonth) + Number('1');
			if(newmonth > 12){
				newmonth = '1';
				newyear = Number(newyear) + Number('1');
			}
			teller = Number(teller) + Number('1');
			var newcontainer = naam[0] + '-' + teller;
		}

	}


	var httpObj = ajaxFunction();
	var query = "calendarajax.php?qrnd=" + Math.random() + "&year=" + year + "&month=" + month + "&container=" + container + "&param=" + param + "&organisatieid=" + organisatieid ;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById(container).innerHTML = httpObj.responseText;
			
			
			
			
		}
	}
}

function organigramophalen(organstructid,onder)
{

	var httpObj = ajaxFunction();
	var query = "organigramajax.php?qrnd=" + Math.random() + "&searchorganigram=" + document.getElementById('searchorganigram').value + "&organstructid=" + organstructid + "&onder=" + onder;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('organigramcontainer').innerHTML = httpObj.responseText;	
		}
	}
}

function gamesophalen() 
{
	document.getElementById('gamescontainer').innerHTML ='<center><img src="images/loading.gif" style="height:30px;top:20px;"></center>';
	var httpObj = ajaxFunction();
	var query = "gamesajax.php?qrnd=" + Math.random() + "&searchteam=" + document.getElementById('searchteam').value + "&startdatum=" + document.getElementById('startdatum').value + "&einddatum=" + document.getElementById('einddatum').value + "&organisatieid=" + document.getElementById('vieworganisatieid').value;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('gamescontainer').innerHTML = httpObj.responseText;	
		}
	}
}
function trainingenophalen() 
{
	document.getElementById('trainingencontainer').innerHTML ='<center><img src="images/loading.gif" style="height:30px;top:20px;"></center>';
	var httpObj = ajaxFunction();
	var query = "trainingenajax.php?qrnd=" + Math.random() + "&searchteam=" + document.getElementById('searchteam').value + "&organisatieid=" + document.getElementById('vieworganisatieid').value;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('trainingencontainer').innerHTML = httpObj.responseText;	
		}
	}
}


function locatiesophalen() 
{

	var httpObj = ajaxFunction();
	var query = "locatieajax.php?qrnd=" + Math.random() + "&searchlocaties=" + document.getElementById('searchlocaties').value ;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('locatiescontainer').innerHTML = httpObj.responseText;	
		}
	}
}

function wissel_teampagploeg(websiteid){
	if(document.getElementById(websiteid).style.display =='block')
	{
		document.getElementById(websiteid).style.display = 'none';
		document.getElementById(websiteid).style.visibility = 'hidden';
	}
	else
	{
		document.getElementById(websiteid).style.visibility = 'visible';
		document.getElementById(websiteid).style.display = 'block';
	}
}

function archiefophalen() 
{
	document.getElementById('archiefcontainer').innerHTML = '<center><img src="images/loading.gif" style="height:30px;top:20px;"></center>';
	
	var httpObj = ajaxFunction();
	var query = "archief.php?qrnd=" + Math.random() + "&search=" + document.getElementById('search').value ;
	httpObj.open("GET",query, true);
	httpObj.send(null);
	httpObj.onreadystatechange = function()
	{
		if(httpObj.readyState == 4)
		{
			document.getElementById('archiefcontainer').innerHTML = httpObj.responseText;	
		}
	}	
}


function zichtbaarheid(websiteid,source) 
{
		if(document.getElementById(websiteid).style.display ==''){
			document.getElementById(websiteid).style.display = 'none';
			document.getElementById(websiteid).style.visibility = 'hidden';
		}else{
			document.getElementById(websiteid).style.visibility = 'visible';
			document.getElementById(websiteid).style.display = '';
			document.getElementById('frame' + websiteid).src = source;
		}
}

