function bdhhi_PositionedPopup(
	mozillaEvent,
	sHref, 
	sWinname, 
	bCentered, 
	iLeft, 
	iTop, 
	iWidth, 
	iHeight, 
	bToolbar, 
	bLocation, 
	bStatus, 
	bMenubar, 
	bScrollbars, 
	bResizable,
	bUseOpener)
{	
	if(window.event != null)
	{
		window.event.returnValue=false;
	}
	else if (mozillaEvent)
	{
		mozillaEvent.preventDefault();
	}

	sLoadingPage = "/Scripts/Loading.htm";
	
	wh = iHeight;
	ww = iWidth;
	
	if (bCentered)
	{
		wt = (screen.availHeight - wh) / 2;
		wl = (screen.availWidth - ww) / 2;
	}
	else
	{
		wt = iTop; 
		wl = iLeft;
	}
	
	windowFeatures="";
	
	if (bToolbar) windowFeatures += ",toolbar=yes";
	if (bLocation) windowFeatures += ",location=yes";
	if (bStatus) windowFeatures += ",status=yes";
	if (bMenubar) windowFeatures += ",menubar=yes";
	if (bScrollbars) windowFeatures += ",scrollbars=yes";
	if (bResizable) windowFeatures += ",resizable=yes";
	
	// If asked and if available, use the window.opener window
	if (window.opener != null && bUseOpener)
	{
		var obj=window.opener;
		obj.location = sHref;
	}
	else
	{
		// Open with approximate size
		var obj=window.open(sLoadingPage,
			sWinname,
			"left=" + wl + 
			",top=" + wt + 
			",height=" + wh + 
			",width=" + ww + 
			windowFeatures);
	
		try
		{
			historyLength = -1;
			
			// If this is a reused window for 
			// another server, this will fail
			// and history can assumed to have 
			// more than one item
			try
			{
				historyLength = obj.history.length;
			}
			catch(e){}
			
			// Check if this is the first use
			// of this window
			if(historyLength == 0)
			{
				// Set to exact size
				obj.resizeTo(ww, wh);
				obj.moveTo(wl, wt);
			}
			
			// Set the location regardless
			obj.location = sHref;
		}
		catch(e)
		{
			// If that didn't work, close and reopen the lame way
			obj.close();
			obj=window.open(sHref,
				sWinname,
				"left=" + wl + 
				",top=" + wt + 
				",height=" + wh + 
				",width=" + ww + 
				windowFeatures);
		}
	}
	
	obj.focus();
}

function bdhhi_CenteredPopup(
	mozillaEvent,
	sHref, 
	sWinname, 
	iMargin, 
	bToolbar, 
	bLocation, 
	bStatus, 
	bMenubar, 
	bScrollbars, 
	bResizable,
	bUseOpener)
{
	wt = iMargin; 
	wl = iMargin;
	wh = screen.availHeight - (2 * wt);
	ww = screen.availWidth - (2 * wl);
	
	return bdhhi_PositionedPopup(
		mozillaEvent,
		sHref, 
		sWinname, 
		false, 
		wl, 
		wt, 
		ww, 
		wh, 
		bToolbar, 
		bLocation, 
		bStatus, 
		bMenubar, 
		bScrollbars, 
		bResizable,
		bUseOpener);
}

function bdhhi_GenericPopup(mozillaEvent, sHref, sWinname)
{
	return bdhhi_CenteredPopup(
		mozillaEvent,
		sHref, 
		sWinname, 
		45, 
		true, 
		true, 
		true, 
		true, 
		true, 
		true,
		false)
}

function bdhhi_InlineResourcePopup(mozillaEvent, sHref, sWinname)
{
	return bdhhi_CenteredPopup(
		mozillaEvent,
		sHref, 
		sWinname, 
		45, 
		false, 
		false, 
		false, 
		false, 
		true, 
		true,
		false)
}

//

function collections_KwiksetPopup(mozillaEvent, href)
{
	return bdhhi_CenteredPopup(
		mozillaEvent,
		href, 
		"Kwikset", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		true)
}

function collections_PfisterPopup(mozillaEvent, href)
{
	return bdhhi_CenteredPopup(
		mozillaEvent,
		href, 
		"PricePfister", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		true)
}

function collections_SlideShow(mozillaEvent, href)
{
	return bdhhi_PositionedPopup(
		mozillaEvent,
		href, 
		"SlideShow", 
		true, 
		-1, 
		-1, 
		730, 
		500, 
		false, 
		false, 
		false, 
		false, 
		false, 
		false,
		false);
}