/************************************/
/*** FORCES PLAN GLOBAL JAVSCRIPT ***/
/************************************/
//*** 
//*** THIS CODE LAST UPDATED: 05/01/10
//***
//*** (REMEMBER TO CHANGE REVISION CODE IN 'php_config.inc.php')


// Global client-side objects:
var hideX = "4000px";
var defaultPosX = "50px";
var visibleTextObj;
var infoWinObj = new Array();

function showText(elID,		posX){
	// "posX" is optional parameter:
	if (typeof(posX) == "undefined") posX = defaultPosX;
	var elObj = getObject(elID);

	// First hide any visible text object:
	if (typeof(visibleTextObj) != "undefined") hideText();

	// Now make new text object visible:
	elObj.style.right = posX;

	// Finally, remember new text object:
	visibleTextObj = elObj;

	return false;
}

function hideText(){

	visibleTextObj.style.right = hideX;

	return false;
}

function getObject(elID){
	var dom = document.getElementById ? true : false;
	var ns4 = (document.layers) ? true : false;
	var ie = (document.all) ? true : false;
	var elObj = null;

	if (dom) elObj = document.getElementById(elID);
	else if (ie) elObj = document.all(elID);
	else if (ns4) elObj = document.layers[elID];

	return elObj;
}

function infoWindow(urlStr,	size){
	// "size" is optional parameter ("large", "medium" or "small":
	if (typeof(size) == "undefined") size = "large";
	var winName = "fpInfo_";	// Try and make unique from other websites but use same name throughout this website..
	var winIndex;			// .. window object stored as an array so that, eg, small window can be opened over large one	
	var winWidthLarge = 580, winHeightLarge = 650; // Default values for "large"
	var winWidth, winHeight, winLeft, winTop, winFeatures

	switch (size){
		default:
			size = "large";
		case "large":
			// Use default values
			winWidth = winWidthLarge, winHeight = winHeightLarge;
			winIndex = 0;
			break;

		case "medium":
			winWidth = 500, winHeight = 500; //, winLeft = 40, winTop = 75;
			winIndex = 1;
			break;

		case "small":
			winWidth = 500, winHeight = 350; //, winLeft = 40, winTop = 125;
			winIndex = 3;
			break;

		case "smallest":
			winWidth = 500, winHeight = 220; //, winLeft = 90, winTop = 150;
			winIndex = 4;
			break;

		case "largest": // Same height as 'large' but wider
			winWidth = 800, winHeight = winHeightLarge;
			winIndex = 5;
			break;
	}

	// Set winLeft and winRight so as to centralise smaller windows wrt large window:
	winLeft = parseInt((winWidthLarge - winWidth) / 2);
	winTop = parseInt((winHeightLarge - winHeight) / 2);


	winName += size; // Make name unique for different szes so that, eg, small window can be opened over large one 
	winFeatures = "width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop + ",resizable,scrollbars";

//	if (typeof(infoWinObj[winIndex]) != "undefined") infoWinObj[winIndex].close();
	clearWindow(infoWinObj[winIndex]);
	infoWinObj[winIndex] = window.open(urlStr, winName, winFeatures);
	infoWinObj[winIndex].focus();
}

function infoWindow_OLD(urlStr){
	var winName = "apInfo"; // Try and make unique from other websites but use same name throughout this website
	var winWidth = 600, winHeight = 650, winLeft = 0, winTop = 0;
	var winFeatures = "width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop + ",resizable,scrollbars";
	var infoWinObj;

	infoWinObj = window.open(urlStr, winName, winFeatures);
	infoWinObj.focus();
}

function clearWindow(winObj){
	var docObj;

	// Clear any existing content:
	if (typeof(winObj) != "undefined"){		// Has window been opened?
		if (winObj.closed == false){		// And not subsequently closed?
			docObj = winObj.document.open();
			docObj.writeln('<html><head></head><body></body></html>');
			docObj.close();
		}
	}
}

function closeWindow(winObj){
	if (typeof(winObj) != "undefined"){		// Has window been opened?
		if (winObj.closed == false){		// And not subsequently closed?
			winObj.close();
//alert("closing window");
		}
	}
}

