
//////////////////////////////////////
// Created By Michael Christiansen  //
//////////////////////////////////////

//create mail address for web master
mailAddressWebmaster = "uvfoto@hotmail.com";
WebmasterName = "Allan Olivarius";
function MailAddressWebMaster()
{
  document.write("<A href='mailto:" + mailAddressWebmaster + "'>" + WebmasterName + "</A>");
}


/////////////////////////////////
// functions to adjust layout  //
/////////////////////////////////
var wndHeight = 0;
var wndWidth = 0;

function SetFormCheckBoxes(szFormName, bCheckSet)
{
	if (document.forms[szFormName].autocheckbox) 
	{
		if (document.forms[szFormName].autocheckbox.length) 
			for (i=0; i<document.forms[szFormName].autocheckbox.length; i++) 
				document.forms[szFormName].autocheckbox[i].checked=bCheckSet;
		else 
			document.forms[szFormName].autocheckbox.checked=bCheckSet;
	}
} 

function GetWndDim()
{
	if (document.all) 	
	{
		wndHeight = document.body.clientHeight;
		wndWidth = document.body.clientWidth;
	}
	else 
	{
		wndHeight = window.innerHeight;
		wndWidth = window.innerWidth;
	}
}

function 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=findObj(n,d.layers[i].document);
	if (!x && document.getElementById) 
		x=document.getElementById(n);
	if (!x && document.getElementByTag) 
		x=document.getElementByTag(n);
	return x;
}

function getWidth(id) 
{ 
	return findObj(id).offsetWidth;
}

function getOffsetTop(id) 
{
	var el = findObj(id);
	var ot = el.offsetTop;
	while((el = el.offsetParent) != null) 
		ot += el.offsetTop;
	return ot;
}
function GetLeftMargin()
{
	return (Math.round((wndWidth-getWidth("pageheader"))/2)); 
}

function AdjDoc(lGraphicBorderWidth) 
{
	// ajust the left margin
	var marginVal = GetLeftMargin();
	if (marginVal < 20)
		marginVal = 5;
	findObj("pageheader").style.marginLeft = marginVal;
	findObj("pagemenu").style.marginLeft = marginVal;
	findObj("pagebody").style.marginLeft = marginVal;
	// fit the height of scrollContent to the max height.
	var secHeight = (wndHeight-getOffsetTop("bodycontent"));
	if (secHeight < 40) 
		secHeight = 40;
	findObj("bodycontent").style.height = secHeight;

	document.body.scrollTop = 0;
	// ajust the left margin of the menu
	var layerID;
	var layerObj = findObj("layer0");
	if (layerObj)
	{
		var deltaMarVal = marginVal - KT_parseInt(layerObj.style.left);
		for(i = 0 ; i < layerN ; i++)
		{
			layerID = "layer" + i;
			layerObj = findObj(layerID);
			if (layerObj.menuType=='MenuButton' )
				layerObj.style.left = KT_parseInt(layerObj.style.left) + deltaMarVal + lGraphicBorderWidth;
		}
	}
}
function PopUpWindow(szPageUrl,lPageWidth,lPageHeight)
{
	var	lWndHeight = 0;
	var lScreenHeight = 0;
	var	szTotalPageContent;
	if (!lPageHeight)
	{
		if (screen.availHeight)
			lScreenHeight = screen.availHeight-75;
		else
			lScreenHeight = 600;
	}
	else
		lScreenHeight = lPageHeight;
	var oNewDoc = window.open(szPageUrl,"new_page","width=" + lPageWidth + ",height=" + lScreenHeight + ",toolbar=0");
	if (document.all) 	
		lWndHeight = document.body.clientHeight;
	else 
		lWndHeight = window.innerHeight;
}

