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,
		false)
}

function bdhhi_InlineResourcePopup(mozillaEvent, sHref, sWinname)
{
//	alert('test');
//	return;
	return bdhhi_CenteredPopup(
		mozillaEvent,
		sHref, 
		sWinname, 
		45, 
		false, 
		false, 
		false, 
		false, 
		true, 
		true,
		false,
		false)
}

function bdhhi_USASupportPopup(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('https://kwikset.custhelp.com/cgi-bin/kwikset.cfg/php/enduser/std_alp.php'), 
		"SupportPopup", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_NewProductSupportPopup(mozillaEvent, href)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		href, 
		"SupportPopup", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_FAQPopup(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('http://kwikset.custhelp.com/cgi-bin/kwikset.cfg/php/enduser/std_alp.php?p_sid=VRl_-vxh&p_lva=&p_sp=&p_li'), 
		"FAQPopup", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_Where2BuyPopup(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('http://direct.where2getit.com/cwc/apps/w2gi.php?template=search&client=kwikset'),
		"Where2BuyPopup", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_InvestorPopup(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=BDK&script=2100'), 
		"InvestorPopup", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_DeadboltProductTourPopup(mozillaEvent)
{
	bdhhi_PositionedPopup(
		mozillaEvent,
		"/HomeSafety/ProductTour/default.aspx", 
		"DeadboltTour", 
		true, 
		-1, 
		-1, 
		704, 
		595, 
		false, 
		false, 
		false, 
		false, 
		false, 
		false,
		false);
}

function bdhhi_SmartSeriesProductTour(mozillaEvent)
{
	bdhhi_PositionedPopup(
		mozillaEvent,
		"/SmartScan/default.html", 
		"SmartScanTour", 
		true, 
		-1, 
		-1, 
		854, 
		695, 
		false, 
		false, 
		false, 
		false, 
		false, 
		false,
		false);
}

function bdhhi_SmartScanMiniSitePopup(mozillaEvent)
{
	bdhhi_PositionedPopup(
		mozillaEvent,
		"/SmartScan/SmartScan.html", 
		"SmartScan", 
		true, 
		-1, 
		-1, 
		825, 
		620, 
		false, 
		false, 
		false, 
		false, 
		false, 
		false,
		false);
}

function bdhhi_FinishDetailPopup(mozillaEvent, sHref, sWinname)
{
	bdhhi_PositionedPopup(
		mozillaEvent,
		sHref, 
		sWinname, 
		true, 
		-1, 
		-1, 
		600, 
		650, 
		false, 
		false, 
		false, 
		false, 
		false, 
		false,
		false);
}

function bdhhi_CareersPopup(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('http://www.bdhhi.com/career'), 
		"Careers", 
		45, 
		true, 
		true, 
		true, 
		true, 
		true, 
		true,
		false)
}

function bdhhi_KeyDreamsPromo(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		pageTracker._getLinkerUrl('http://kwikset.eprize.net/secure'), 
		"KeyDreamsPromo", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_GoCollectionsPopup(mozillaEvent, href)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		href, 
		"Collections", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		true)
}

/**************************TASH ADD THIS *************************/

function bdhhi_Installation(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		"/Support/SmartScan/SmartScanPdf/smartscan-installation-instructions.pdf", 
		"InstallationInstructions", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}

function bdhhi_SellSheet(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		"/Support/SmartScan/SmartScanPdf/smartscan-sell-sheet.pdf", 
		"SellSheet", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}
function bdhhi_ssManual(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		"/Support/SmartScan/SmartScanPdf/smartscan-user-manual.pdf", 
		"SSManual", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}
function bdhhi_ssTemplate(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		"/Support/SmartScan/SmartScanPdf/smartscan-template.pdf", 
		"SSTemplate", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}
function bdhhi_ssTriFold(mozillaEvent)
{
	bdhhi_CenteredPopup(
		mozillaEvent,
		"/Support/SmartScan/SmartScanPdf/smartscan-trifold.pdf", 
		"SSTemplate", 
		45, 
		true, 
		false, 
		true, 
		false, 
		true, 
		true,
		false)
}
