/*****************************************************************************
*  BEK grafische producties
*  Kenedylaan 16
*  5460 AA Veghel
*  T: +31 (0)413 34 15 06
*  F: +31 (0)413 34 18 22
*  W: http://www.bek.nl
*****************************************************************************/

//
// Reload browser window (NN4) if resized
//
function BCS_reloadPage(init)
{
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=BCS_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
BCS_reloadPage(true);


//
// Open window
//
function BCS_openWindow(u, w, f)
{
	//theURL,winName,features
	window.open(u, w, f);
}


//
// General Purpose Object finder
// d = document
// n = element name
// x = object name
//
function BCS_findObj(n, d)
{
	var p,i,x;
	
	if (!d)
	{
		d = document;
	}
	
	if ((p = n.indexOf("?")) > 0 && parent.frames.length)
	{
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0,p);
	}
	
	if (!(x = d[n]) && d.all)
	{
		x = d.all[n];
		for (i=0; !x && i < d.forms.length; i++)
		{
			x = d.forms[i][n]
		}
	}
	
	for (i=0; !x && d.layers && i < d.layers.length; i++) x=BCS_findObj(n,d.layers[i].document);
	
	if (!x && d.getElementById)
	{
		x = d.getElementById(n);
	}
	
	return x;
} 


//
// General Purpose Text to Layer
//
function BCS_setTextOfLayer(objName, x, newText)
{
	if ((obj = BCS_findObj(objName)) != null) with (obj)
	
	if (document.layers)
	{
		document.write(unescape(newText));
		document.close();
	}
	else
	{
		innerHTML = unescape(newText);
	}
}


//
// Image swap menu icons / contextual popup text
//
function BCS_triggerICN(img_name, img_src, idx)
{
	document[img_name].src = img_src;
	BCS_setTextOfLayer('icn_context', '', icn_txt[idx]);
}


//
// General Purpose image swap
//
function BCS_imgSwap(img_name, img_src)
{
	document[img_name].src = img_src;
}


//
// General Purpose style (CSS) swap
//
function BCS_changeStyle(theElm, theClass)
{
	document.getElementById(theElm).className = theClass;
}