var g_childWindow = null;

function StatusOff(){ return onText(""); }
function onText(str){ window.status = str; return true }
function Yours()    { return onText("View your current order");}
function YoursRequest()    { return onText("Continue with request");}


function GetNumberSrc(iNum, bZero)
{
	var s;
	if (iNum >= 1 && iNum <= 9)
		s = iNum;
	else
		s = (iNum == 0 && bZero) ? "0" : "clear";
	return s + ".gif";
}


function gotoUrl(url) {
	if (!HandleSaveLightboxNotes(url))
		top.location.href = url;
}

function doJump(url)
{
	if ((url != "") && !HandleSaveLightboxNotes(url))
		self.location.href = url;	
}

function HandleSaveLightboxNotes(urlStr)
{
	if ((location.pathname.search(/lightbox\.asp/i) != -1))
	{
		var elForm = GetViewForm();
		if (elForm == null)
			return false;

		if (elForm.hdnDirty.value == "1") {
			var bSave = confirm("Do you wish to save your changes to this lightbox?");
			elForm.hdnSaveChanges.value = bSave ? "1" : "0"
			putHiddenChanges();
		}
		elForm.source.value = "exitLightbox";
		elForm.target = "_top";
		elForm.method = "GET";
		elForm.navTarget.value = urlStr;
		elForm.submit();
		return true;
	}
	else if ((location.pathname.search(/clipbin\.asp/i) != -1))
	{
		var elForm = GetViewForm();
		if (elForm == null)
			return false;

		if (elForm.hdnDirty.value == "1") {
			var bSave = confirm("Do you wish to save your changes to this clipbin?");
			elForm.hdnSaveChanges.value = bSave ? "1" : "0"
			putHiddenChanges();
		}
		elForm.source.value = "exitLightbox";
		elForm.target = "_top";
		elForm.method = "GET";
		elForm.navTarget.value = urlStr;
		elForm.submit();
		return true;
	}
	else
		return false;
}


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 centerGlobalNav()
{

}