// (C) 2006 williamz.net - all rights reserved.  You may not copy or adapt this code without permission in writing
// and payment of any appropriate licensing fees.

// Vairiable that holds whether browser is IE or not - doesn't differentiate further...
var IE = document.all?true:false;

// Function to position box B centrally in box A
function centreBInA(boxA, boxB, bOffset)
{
	
	transElem = null;
	stuffElem = null;
	hold = null;
	
	var transElem = document.getElementById(boxB);
	var stuffElem = document.getElementById(boxA);
	
	if (IE)
	{
		hold = stuffElem.currentStyle.width.split("p");
		trLeftPos = hold[0];
	
		hold = transElem.currentStyle.width.split("p");
		trLeftPos = trLeftPos - hold[0];
		trLeftPos = trLeftPos /2;
	}else{
		hold = document.defaultView.getComputedStyle(stuffElem,null).getPropertyValue('width').split("p");
		trLeftPos = hold[0];
	
		hold = document.defaultView.getComputedStyle(transElem,null).getPropertyValue('width').split("p");
		trLeftPos = trLeftPos - hold[0];
		trLeftPos = trLeftPos /2;
	}
	trLeftPos = trLeftPos + "px";
	transElem.style.left = trLeftPos;
		if (IE)
	{
		hold = stuffElem.currentStyle.height.split("p");
		trTopPos = hold[0];
	
		hold = transElem.currentStyle.height.split("p");
		trTopPos = trTopPos - hold[0];
		trTopPos = trTopPos /2;
	}else{
		hold = document.defaultView.getComputedStyle(stuffElem,null).getPropertyValue('height').split("p");
		trTopPos = hold[0];
	
		hold = document.defaultView.getComputedStyle(transElem,null).getPropertyValue('height').split("p");
		trTopPos = trTopPos - hold[0];
		trTopPos = trTopPos /2;
	}
	trTopPos = trTopPos - bOffset;
	trTopPos = trTopPos + "px";
	transElem.style.top = trTopPos;
}


// Function to position the submit WP form
function posWPSubForm()
{
	centreBInA( 'mainPageStuff', 'translateFormArea', 30);
}


// Function to display message in existing html element
function disp(id, msg)
{
	document.getElementById(id).innerHTML = msg;
}  

function elViz(elem)
{
	document.getElementById(elem).style.display = 'block';
//	centreBInA('mainPageStuff', elem, 0)
}

function elNotViz(elem)
{
	document.getElementById(elem).style.display = 'none';
}


function changePageTitle(newTitle)
{
	document.getElementById('pTitle').innerHTML = newTitle;
}

function toggle(elem)
{
		elTog = document.getElementById(elem);
		
		if(IE)
		{
			var dispState = elTog.currentStyle.display
		}else{
			var dispState = document.defaultView.getComputedStyle(elTog,null).getPropertyValue('display').split("p")
		}

		if (dispState == "block")
		{
			elTog.style.display = 'none';
		}else{
			elTog.style.display = 'block'
		}

}

function checkState(elem)
{
		elObj = document.getElementById(elem);
		
		if(IE)
		{
			var dispState = elObj.currentStyle.display
		}else{
			var dispState = document.defaultView.getComputedStyle(elObj,null).getPropertyValue('display').split("p")
		}
		
		return elObj;
}