var g_childWindow = null;

function openHelpWindow(helpURL, winName)
{
	if (helpURL.indexOf("http") != -1)
	{
		helpURL = winName;
		winName = "helpWin";
	}
	OpenChildWindow(helpURL, winName, "width=500,height=360,top=50,left=280,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");
}

function openCallusWindow()
{
	var callUrl = "callUs_Pop.aspx";
	popCall = window.open(callUrl, "CallUS", "width=499,height=360,top=50,left=100,alwaysRaised=yes,toolbar=0,directories=0,menubar=0,status=1,resizable=yes,location=0,scrollbars=1,copyhistory=0");
	popCall.focus();
}

function OpenChildWindow(childURL, childName, childFeatures)
{
	if ((!FindChildWindow(childName)) || childName == "")
	{
		g_childWindow = window.open(childURL, childName, childFeatures);
	} 
	else
	{
		g_childWindow = window.open("", childName);
		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))
	{
		return true;
	}

	return false;
}

function SetFocus(controlId)
{
	var vld = FindElement(controlId);
	if (vld)
	{
		vld.focus();
		if (vld.type == "text") { vld.select(); }
	}
}