function fixpix()
{
	if (document.getElementById('nieuws1') && document.getElementById('nieuws1').getElementsByTagName('img')[0])
	{
		var newspic = document.getElementById('nieuws1').getElementsByTagName('img')[0];
		
		if (newspic.width > 215)
		{
			newspic.width = '215';
		}
		newspic.style.visibility = 'visible';
	}
}


// XML
function getHTTPObject() {
    var xmlhttp = false;

    
 	if (window.ActiveXObject)
 	{
     	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 	}
 	else
    {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

function xml2div(vid,vfunc,vvars,run) { // requires vid=div id, vfunc = function, vvars=vars
	var xmlhttp = getHTTPObject();
	xmlhttp.open("GET", "/engine.php?func="+vfunc+"&vars="+escape(vvars),true); // Open verbinding via GET, via deze URL en communiceer asynchroon
	xmlhttp.onreadystatechange = function()  { 
    	if (xmlhttp.readyState == 4) 
    	{
        	document.getElementById(vid).innerHTML = xmlhttp.responseText; // geef de data weer in een dialoogvenster
   			if (run != '')
   			{
	   			eval(run);
   			}       
    	}
    }
	xmlhttp.send(null) // Verstuur de request
}

if (document.getElementById('nieuwsmenu'))
{
	var nlinks = document.getElementById('nieuwsmenu').getElementsByTagName('a');
	for (i = 0; i < nlinks.length; i++)
	{
		nlinks[i].onclick = function ()
		{
			var nid = this.id.substr(3,this.id.length);
			xml2div('nieuws1', 'fpnews', 'nw_id='+nid+'&site_id='+document.getElementById('nieuwsmenu').getElementsByTagName('ul')[0].id,'fixpix()');
			return false;
		}
	}
}

if (document.getElementById('links'))
{
	var hids = document.getElementById('links').getElementsByTagName('span');
	var cid = new Array();
	for (i = 0; i < hids.length; i++)
	{
		hids[i].style.display = 'none';
		
		cid[i] = hids[i].id.substr(5,hids[i].id.length);
		
		if (document.getElementById('meer' + cid[i]))
		{
			document.getElementById('meer' + cid[i]).innerHTML = 'meer &raquo;';
			document.getElementById('meer' + cid[i]).onclick = function ()
			{
				if (document.getElementById('links' + this.id.substr(4,this.id.length)).style.display == 'none')
				{
					document.getElementById('links' + this.id.substr(4,this.id.length)).style.display = 'block';
					this.innerHTML = '&laquo; verbergen';
				}
				else
				{
					document.getElementById('links' + this.id.substr(4,this.id.length)).style.display = 'none';
					this.innerHTML = 'meer &raquo;';
				}
				return false;
			}
		}
	}
}

if (document.getElementById("hulp"))
{
	var hulps = document.getElementById("hulp").getElementsByTagName("div");
	for (i = 0; i < hulps.length; i++)
	{
		hulps[i].onmouseover = function()
		{
			this.oldbg = this.style.backgroundColor;
			this.style.backgroundColor = '#EEEEEE';
			this.style.cursor = 'pointer';
			this.title = 'Klik voor meer informatie';
		}
	
		hulps[i].onmouseout = function()
		{
			this.style.backgroundColor = this.oldbg;
		}
		
		hulps[i].onclick = function()
		{
			var thid = this.id.substr(3,this.id.length);
			if (this.innerHTML.indexOf('hm11121') != -1)
			{
				this.oldinner = this.innerHTML;
				xml2div(this.id, 'hulp', 'id='+thid,'');
				
			}
			else
			{
				this.innerHTML = this.oldinner;

			}
			
		}
		
	}
}

fixpix();