var request = null;

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

function showSubmenu(id, cat)
{
	var url = 'http://www.mmsolutions.nl/TOC/submenu.php?cat=' + cat + '&id=' + id;
	//var url = http://212.19.199.188/submenu.php?cat=' + cat + '&id=' + id;
	request = makeObject();
	request.open('GET', url, true);
	request.onreadystatechange = maakMenu; 
	request.send(null);
}

function hideSubmenu()
{
	document.getElementById('submenu').innerHTML = "";
}

function maakMenu()
{
	if(request.readyState == 4)
	{ 
		var answer = request.responseText;
		if (answer.length > 0)
		{
			document.getElementById('submenu').innerHTML = "<ul>" + answer + "</ul>";
		}
		else
		{
			document.getElementById('submenu').innerHTML = "";		
		}
	}
}

function pagina_emailen()
{
	email = "mailto:?subject= Interresante link van BCM50.nl";
	email += "&body= De link is "+ document.location;
	document.location = email;
}

function toggleView(id)
{
	var obj = document.getElementById(id);
	
	if (obj.style.display == "none")
	{
		obj.style.display = "block";
	}
	else
	{
		obj.style.display = "none";
	}
}

function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, AUTOSTART, eersteKeer)
{
	var d = document.getElementById(DivID);
	
	str = '<object classid="' + CLSID + '" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"  width=' + WIDTH + ' height=' + HEIGHT +' title="Flash banner">';
	str += '<param name="movie" value=' + URL + '?eersteKeer=' + eersteKeer + '>';
	str += '<param name="wmode" value="transparent" />';
	str += '<param name="quality" value="high" />';
	str += '<embed src="' + URL + '" FlashVars="eersteKeer=' + eersteKeer + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width=' + WIDTH + ' height=' + HEIGHT +' wmode="transparent"></embed></object>';

	d.innerHTML = str;
}

function verticalAlign()
{
	var d = document.getElementById("container");
	var schermhoogte = screen.availHeight;
	var containerhoogte = d.clientHeight;
	
	if (schermhoogte > containerhoogte)
	{
		d.style.marginTop = ((schermhoogte - containerhoogte) / 4) + 'px';
	}
}