
var	wndSample = null;
var wndPic = null;

//////////////////////////////////////////////////////////////////
// NAME:         goSample()
//
// DESCRIPTION:  open a new window with the sample
//////////////////////////////////////////////////////////////////
function goSample(strFile, strId) {
	var sCMD = "/store/download_sample.asp?f=" + escape(strFile) + "&id=" + escape(strId);
	if ( wndSample == null ) {
		wndSample = window.open(sCMD,"sub","status,height=600,width=800,resizable=1");
		if ( !wndSample.opener ) wndSample.Opener = window;
	} else if ( wndSample.closed ) 	{
		wndSample = window.open(sCMD,"sub","status,height=600,width=800,resizable=1");
		if ( !wndSample.opener ) wndSample.Opener = window;		
	}
	else
		wndSample.focus();
}

//////////////////////////////////////////////////////////////////
// NAME:         addToBasket()
//
// DESCRIPTION:  add a product to the shopper's basket
//////////////////////////////////////////////////////////////////
function addToBasket(strPid, strSub, iQty, iFreq) {
	var strURL = "/store/xt_orderform_additem.asp";
	var iQuantity
	var iFrequency

	iQty ? iQuantity=iQty : iQuantity=1;
	iFreq ? iFrequency=iFreq : iFrequency=0;

	strURL += "?pid=" + strPid + "&sub=" + strSub + "&qty=" + iQuantity + "&freq=" + iFrequency;
	window.location = strURL;
}

//////////////////////////////////////////////////////////////////
// NAME:         goSingleProduct()
//
// DESCRIPTION:  go to the single product page
//////////////////////////////////////////////////////////////////
function goSingleProduct(strPid) {
	var strURL = "/store/single_product.asp" ;
	strURL += "?pid=" + strPid;
	window.location = strURL ;
}

//////////////////////////////////////////////////////////////////
// NAME:         showWindow()
//
// DESCRIPTION:  displays the ecri tutorial
//////////////////////////////////////////////////////////////////
function showWindow() {
	var strAddress = "/store/special_files/ecri_tutorial/thechallenge.htm";
	var new_window = window.open(strAddress,"theWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=630");
	new_window.focus();
}

//////////////////////////////////////////////////////////////////
// NAME:         showBizWindow(type)
//
// DESCRIPTION:  displays the ecri tutorial
//////////////////////////////////////////////////////////////////
function showBizWindow(type) {
	if (type==1)
	{
	var strAddress = "/store/special_files/biz_forecast/biz_summary.asp";
	}
	if (type==2)
	{
	var strAddress = "/store/special_files/biz_forecast/biz_contributors.asp";
	}
	var new_window = window.open(strAddress,"theWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=650");
	new_window.focus();
}


function goProvider(strProvider) {
	if ( strProvider == "-99" ) {
		var objSelect = document.forms.frmProviders.selProvider ;
		strProvider = objSelect[objSelect.selectedIndex].value ;
	}
	
	var strURL = "/store/provider.asp?provider=" + strProvider;
	window.location = strURL;
}


//////////////////////////////////////////////////////////////////
// NAME:         goPic()
//
// DESCRIPTION:  open up a dismal market picture
//////////////////////////////////////////////////////////////////
function goPic(sPic)
{
	var sLocation = "/store/dm_picture.asp?p=" + sPic;

	if (wndPic == null || wndPic.closed)
		wndPic = window.open(sLocation,"sub","status,height=400,width=400");
	else
		wndPic.location = sLocation;

	wndPic.focus();
}

//////////////////////////////////////////////////////////////////
// NAME:         regionWindow()
//
// DESCRIPTION:  open a new window with the states broken into windows
//////////////////////////////////////////////////////////////////
function regionWindow(strFile)
{
	var sREG = strFile
	
	if ( wndSample == null )	
	{
		wndSample = window.open(sREG, "sub", 'top=25,left=25,resizable=no,width=438,height=400,scrollbars=yes,menubar=no')
        wndSample.focus()

		if ( !wndSample.opener )
			wndSample.Opener = window;
	}
	else if ( wndSample.closed ) 
	{
		wndSample = window.open(sREG,"sub", 'top=25,left=25,resizable=no,width=438,height=400,scrollbars=yes,menubar=no')

		if ( !wndSample.opener )
			wndSample.Opener = window;		
	}
	else
	{		
		wndSample = null;
		regionWindow(strFile)
	}
}

//////////////////////////////////////////////////////////////////
// NAME:         sampleAdd()
//
// DESCRIPTION:  open a new window with additional product info
//////////////////////////////////////////////////////////////////
function SampleAdd(sFile) {
	var sADD = sFile;
	wndSample = window.open(sADD, "sub", 'status,height=600,width=700,resizable=1,scrollbars=yes,menubar=no');
  wndSample.focus();
}
