var g_childWindow = null;

function StatusOff(){ return onText(""); }
function onText(str){ window.status = str; return true }
function Yours()    { return onText("Continue with purchase");}
function YoursRequest()    { return onText("Continue with request");}

function doJump(url)
{
	if (url != "")
		top.location.href = url;	
}

function OpenChildWindow(childURL, childName, childFeatures){
	
	if (!FindChildWindow(childName))
		g_childWindow = window.open(childURL, childName, childFeatures);

	g_childWindow.focus();

	if (document.location.protocol == "http:")
		g_childWindow.document.location.href=childURL;	

}

function CloseChildWindow(){
	if (g_childWindow != null){
		if (!g_childWindow.closed)
			g_childWindow.close();
		g_childWindow = null;
	}
}

function FindChildWindow(childName){
	if ((g_childWindow != null) && (g_childWindow.closed != true)){
		g_childWindow = window.open("", childName);
		return true;
	}
	else
		return false;
}

function GetElementInDocument(inDoc, elementName)
{
	with (inDoc) {
		for (var i = 0; i < forms.length; i++) {
			if (forms[i].name == elementName) return forms[i];
			var el = GetElementInForm(forms[i], elementName)
			if (el != null) return el;
		}
	}
	return null;
}

function GetElement(elementName)
{
	if (document.getElementsByName) {
		var el = document.getElementsByName(elementName).item(0);
		if (el != null) return el;

	} else if (document.all == null) {
		var el;
		el = GetElementInDocument(document, elementName);
		if (el != null) return el;

		with (document)
			for (var i = 0; i < layers.length; i++) {
				el = GetElementInDocument(layers[i].document, elementName);
				if (el != null) return el;
			}

	} else {
		with (document)
			for (var i = 0; i < all.length; i++)
				if (all(i).name == elementName)
					return all(i);
	}	
	return null;
}

function getInsideWindowWidth()
{
	if (document.all == null)
		return window.innerWidth;
	else
		return document.body.clientWidth;
}

function safemail(name, domain, display) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');
}

function subjectmail(name, domain, display, subject) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href=mailto:' + name + '@' + domain + '?subject=' + subject + '>' + displayed + '</a>');
}

function imagemail(name, domain, display, txt) {
document.write('<a href=mailto:' + name + '@' + domain + '>' + '<img src="' + display + '" border="0" alt="' + txt + name + '@' + domain + '"></a>');
}

function setDisplayBlock(ObjectID, state){
var object = document.getElementById(ObjectID);
object.style.display = state;
}

function toggleDisplay(ObjectID){
var object = document.getElementById(ObjectID);
state = object.style.display;
if (state == 'none') {
	object.style.display = 'block';
	document.img_1.src = 'http://www.nfcb.org/images/navigation/arrow-right.gif';
}
else if (state != 'none'){
	object.style.display = 'none';
	document.img_1.src = 'http://www.nfcb.org/images/navigation/arrow-down.gif';
}
}

var objPopUp = null;
			
			function popUp(event,objectID) {
				objPopTrig = document.getElementById(event);
				objPopUp = document.getElementById(objectID);
				// xPos = objPopTrig.offsetLeft;
				xPos = event.clientX;
				yPos = event.clientY;
				//yPos = objPopTrig.offsetTop + objPopTrig.offsetHeight;
				if (xPos + objPopUp.offsetWidth >  document.body.clientWidth) xPos = xPos - 187;
				//if (yPos + objPopUp.offsetHeight >  document.body.clientHeight) yPos = yPos - objPopUp.offsetHeight - objPopTrig.offsetHeight;
				objPopUp.style.left = xPos + 'px';
				objPopUp.style.top = yPos + 'px';
				objPopUp.style.visibility = 'visible';
			}

function popHide(){
	objPopUp.style.visibility = 'hidden';
	objPopUp = null;
}