var menutimer;
function writeFlash(id, url, width, height, wmode, vars, writeTo, useWriteTo)
{
	var writeString = '';
	if(hasFlash)
	{
		
		var widthStr = '';
		var heightStr = '';
		if (width > 0 )
		{
			widthStr = ' width="'+width+'"';
		}
		if (height > 0 )
		{
			heightStr = ' height="'+height+'"';
		}
		writeString='<object id="flashmovie" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"' + widthStr + heightStr + ' id="'+url+'" align="middle">';
		writeString+='<param name="allowScriptAccess" value="sameDomain" />';
		writeString+='<param name="movie" value="'+url+'" />';
		writeString+='<param name="quality" value="high" />';
		writeString+='<param name="wmode" value="'+wmode+'" />';
		writeString+='<param name="FlashVars" value="'+vars+'" />';
		writeString+='<embed id="'+url+'" FlashVars="'+vars+'" src="'+url+'" quality="high" wmode="'+wmode+'"' + widthStr + heightStr + ' name="main" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		writeString+='</object>';		
	}
	else
	{
		if (width > 0 )
		{
			widthStr = width +'px';
		}
		if (height > 0 )
		{
			heightStr = height+'px';
		}
		writeString='<div class="noFlashHolder" style="width:'+widthStr+';height:'+heightStr+';">U heeft geen Flashspeler ge&iuml;nstalleerd/No flashplayer installed. <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Klik hier om te downloaden/Click here to download.</a></div>';
	}
	if(useWriteTo)
	{
		if(writeTo)
			writeTo.innerHTML = writeString;
	}
	else
		document.write(writeString);
}
function fCaller(params)
{
	if(hasFlash)
	{
		//writeFlash('connection', '/flash/connection.swf', 1, 1, 'opaque', params, document.getElementById('connectionDiv'), true);
		//alert(document.getElementById('connectionDiv').innerHTML);
		
		writeFlash('headerFlash', '/flash/header.swf', 770, 145, 'transparent', params, document.getElementById('headerFlash'), true);
	}
}

function generateMenuString()
{
	var menu = document.getElementById('menu');
	var listitems = menu.getElementsByTagName('LI');
	var returnstr = currentMenuIndex +':' + listitems.length + ':';
	for(var i = 0;i<listitems.length;i++)
	{
		var pos = getPos(listitems[i]);
		returnstr+=pos.width +',';	
	}	
	//alert(returnstr);
	return returnstr;
}

function getPos(theObj){
	  x = y = 0;
	  	var oldstyle = theObj.style.display;	
	  	theObj.style.display = 'block';
	  h = theObj.offsetHeight;
	  w = theObj.offsetWidth;
  		theObj.style.display = oldstyle;
	  while(theObj){
	    x += theObj.offsetLeft;
	    y += theObj.offsetTop;
	    theObj = theObj.offsetParent;
	  }
	  return {height:h,width:w,x:x,y:y}
	}
function init()
{
	replaceSIFR();
	fCaller('param=' + generateMenuString());
}
window.onload=function()
{
	
	init();
	//IE6 flicker bug solution:
	try {
		document.execCommand("BackgroundImageCache", false, true);

	} catch(err) {}

	//setTimeout('fCaller(\'menunumber='+currentMenuIndex+'\');',0);
	//onclick="clearTimeout(menutimer);" onmouseout="callFlashMouseOut(this, <%=teller%>);" onmouseover="callFlashMouseOver(this, <%=teller%>);"
		
}

function openpopup(popurl)
{
	winpops=window.open(popurl,"popup","menubar=0,location=0,toolbar=0,scrollbars=1,resizable=0,status=0,width=600,height=500,top=0,left=0")
	winpops.focus();
}
function openpopup(popurl,width,height)
{
	winpops=window.open(popurl,"popup","menubar=0,location=0,toolbar=0,scrollbars=1,resizable=0,status=0,width="+(width+20)+",height="+(height+20)+",top=0,left=0")
	if (winpops) 
	{
		winpops.onload=function()
		{
			document.body.style.margin='0px';
		};
		winpops.focus();
	}
}