//Globals
var AppWidth = 902;
var AppHeight = 602;
var ImgArr = new Array();

/*******************************************************************************
For Div Centring
*******************************************************************************/
function CentreDiv()
{
	//use outside and inside divs instead of border because Mozilla puts border outside, and IE within div boundary
	//Frame
	var el = document.getElementById('ApplicationFrame');
	if (el.style) el = el.style;
	el.width = AppWidth;
	el.left=Math.max(parseInt(pageWidth()/2-AppWidth/2),0);
	el.height = AppHeight;
	el.top = Math.max(parseInt(pageHeight()/2-AppHeight/2),0);
	el.visibility = 'visible';
	//Content
	var el = document.getElementById('ApplicationContent');
	if (el.style) el = el.style;
	el.width = AppWidth-2;
	el.height = AppHeight-2;
}

// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function pageWidth()
{
	return window.innerWidth != null ? 
		window.innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
			document.documentElement.clientWidth : 
			document.body != null ? 
				document.body.clientWidth :
				null;
}

// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function pageHeight()
{
	return window.innerHeight != null ?
		 window.innerHeight : 
		 document.documentElement && document.documentElement.clientHeight ?
			document.documentElement.clientHeight : 
			document.body != null ?
				document.body.clientHeight :
				null;
}

/*******************************************************************************
For Image Preloading and rollovers
*******************************************************************************/
function ClassImg()
{
	this.ID = '';
	this.DImage = new Image();
	this.FImage = new Image();
	this.AImage = new Image();
	return this;
}
function PreloadImages(HasFlyover)
{
	for(i=0;i<document.images.length;i++)
	{
		var idx = document.images[i].id;
		if(idx.indexOf('btn') > -1)
		{
			ImgArr[idx] = new ClassImg();
			ImgArr[idx].ID = idx;
			ImgArr[idx].DImage.src = 'images/'+ImgArr[idx].ID+'_d.gif';
			if (HasFlyover)
				ImgArr[idx].FImage.src = 'images/'+ImgArr[idx].ID+'_f.gif';
			else
				ImgArr[idx].FImage.src = 'images/'+ImgArr[idx].ID+'_a.gif';
			ImgArr[idx].AImage.src = 'images/'+ImgArr[idx].ID+'_a.gif';
		}
	}
}
function ImgMOvr(obj)
{
	obj.src = ImgArr[obj.id].FImage.src;
}
function ImgMOut(obj)
{
	obj.src = ImgArr[obj.id].DImage.src;
}
function ImgMDwn(obj)
{
	obj.src = ImgArr[obj.id].AImage.src;
}

