var browser = new oBrowser();

window.onload = function() {
	/*
	writeBlock("mainMenu", "mainMenu");
	writeBlock("sponsor", "sponsor", "sponsor vv Hardegarijp");
	writeBlock("stand", "stand", "stand vv Hardegarijp 1");
	writeBlock("verjaarden", "verjaardagen", "verjaardagen deze maand");
	writeBlock("bba", "bba", "Bjusterbaarlike Alve");
	*/
}

function writeFlash(name, source, width, height, bgColor)
{
	var result = "";
	result += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + name + "\" align=\"middle\">";
	result += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
	result += "<param name=\"movie\" value=\"" + source + "\" />";
	result += "<param name=\"quality\" value=\"high\" />";
	result += "<param name=\"bgcolor\" value=\"" + bgColor + "\" />";
	result += "<embed src=\"" + source + "\" quality=\"high\" bgcolor=\"" + bgColor + "\" width=\"" + width + "\" height=\"" + height + "\" name=\"" + name + "\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";

	return result;
}


function writeShadow(content)
{
	var result = "";
	result += "<TABLE class=\"shadow\">";
	result += "<TR>";
	result += "<TD class=\"tl\"><img src=\"images/empty.gif\" width=\"5\" height=\"5\"></TD>";
	result += "<TD class=\"t\"></TD>";
	result += "<TD class=\"tr\"></TD>";
	result += "</TR>";
	result += "<TR>";
	result += "<TD class=\"l\"></TD>";
	result += "<TD class=\"shadowContent\">";
	result += content;
	result += "</TD>";
	result += "<TD class=\"r\"></TD>";
	result += "</TR>";
	result += "<TR>";
	result += "<TD class=\"bl\"></TD>";
	result += "<TD class=\"b\"></TD>";
	result += "<TD class=\"br\"><img src=\"images/empty.gif\" width=\"5\" height=\"5\"></TD>";
	result += "</TR>";
	result += "</TABLE>";

	return result;
}

function write(content)
{
	document.write(content);
}


function createShadows(object)
{
	//var object = document.getElementById(id);
	if (object)
	{
		if (object.innerHTML && object.tagName != "TABLE")
		{
			try
			{
				object.innerHTML = writeShadow(object.innerHTML);
			}
			catch (e)
			{
				debugger;
				alert("mislukt: " + e);
			}
		}		
		else
		{
			try
			{
				object.outerHTML = writeShadow(object.outerHTML);
			}
			catch (e)
			{
				debugger;
				alert("mislukt: " + e);
			}			
		}
	}
}


function writePNG(url, width, height, alt)
{
	if (document.body.style.filter)
	{
		return "<img src=\"" + url + "\" alt=\"" + alt + "\" width=\"" + width + "\" height=\"" + height + "\">";
	}
	else
	{
		return "<img src=\"images/empty.gif\" width=\"" + width + "\" height=\"" + height + "\" style=\"filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url + "',sizingMethod='scale')\" alt=\"" + alt + "\">";
	}
}


/**
	Schrijf een blok op het scherm

	@param name		Naam van het blok
	@param object	ID van het object
	@param title	Titel van het object
**/
function writeBlock(name, object, title)
{
	var object = document.getElementById(object);

	if (!object)
		return ;

	if (title)
	{

		var oDiv = document.createElement("DIV");
		object.insertAdjacentElement("beforeBegin", oDiv);
		oDiv.innerHTML = title;
		oDiv.style.height = 27;
		oDiv.style.width = browser.getWidth(object);
		oDiv.className = "blockHeader";
		oDiv.style.position = "relative";
		oDiv.style.zIndex = 10;

		var header = document.createElement("IMG");

		header.src = "images/block/header.jpg";
		header.style.position = "absolute";
		reposition(header, oDiv);
		header.style.display = "block";
		header.style.zIndex = 0;

		document.body.appendChild(header);
	}

	var target = document.createElement("IMG");

	target.src = "images/block/block.jpg";
	target.style.position = "absolute";
	reposition(target, object);
	target.style.display = "block";

	object.style.position = "relative";
	object.style.zIndex = 10;

	document.body.appendChild(target);


}

function reposition(object, parentObject)
{
	object.style.top = browser.getPos(parentObject)[1];
	object.style.left = browser.getPos(parentObject)[0];
	object.style.width = browser.getWidth(parentObject);
	object.style.height = browser.getHeight(parentObject) + 10;
}


// insertAdjacentHTML(), insertAdjacentText() and insertAdjacentElement () 
// for Netscape 6/Mozilla by Thor Larholm me@jscript.dk 
// Usage: include this code segment at the beginning of your document 
// before any other Javascript contents. 

if (typeof HTMLElement!="undefined" && ! HTMLElement.prototype.insertAdjacentElement)
{ 
	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode) 
	{ 
		switch (where) { 
			case 'beforeBegin': 
				this.parentNode.insertBefore(parsedNode,this) 
				break; 
			case 'afterBegin': 
				this.insertBefore(parsedNode,this.firstChild); 
				break; 
			case 'beforeEnd': 
				this.appendChild(parsedNode); 
				break; 
			case 'afterEnd': 
				if (this.nextSibling) 
					this.parentNode.insertBefore(parsedNode,this.nextSibling); 
				else 
					this.parentNode.appendChild(parsedNode); 
			break; 
		} 
	} 

	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr) 
	{ 
		var r = this.ownerDocument.createRange(); 
		r.setStartBefore(this); 
		var parsedHTML = r.createContextualFragment(htmlStr); 
		this.insertAdjacentElement(where,parsedHTML) 
	} 

	HTMLElement.prototype.insertAdjacentText = function(where,txtStr) 
	{ 
		var parsedText = document.createTextNode(txtStr) 
		this.insertAdjacentElement(where,parsedText) 
	} 
}