//Globals
var AppWidth = 1018;
var AppHeight = 604;
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';
}

// 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;
}

function SetPageHeight(heightinpx)
{
	document.getElementById('OutsideDIV').height = heightinpx;
	document.getElementById('LeftSideIMG').height = heightinpx - 490;
	document.getElementById('RightSideIMG').height = heightinpx - 142;
	//document.getElementById('FooterDIV').top = heightinpx - 16; doesn't work...
	
}
/*******************************************************************************
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()
{
	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+'.gif';
			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;
}

/*******************************************************************************
For Showing Divs in FAQs
*******************************************************************************/
function ToggleDiv(idx)
{
	var el = document.getElementById('HiddenDiv'+idx);
	if (el.style) el = el.style;
	var current = el.display;
	el.display=(current=='none'||current==''?'block':'none');
}
