function z2z_superChartLitePopup_show(targetPath)
{
	var superChartTitle = "superChart";
	var minWidth = 800;
	var minHeight = 500;

	var superChartPopupContainerId = "z2z_superChartLitePopupContainer";

	var win = new Window({title: superChartTitle, wiredDrag:true, minWidth:minWidth, minHeight:minHeight});
	var so = new z2z.SWFObject(targetPath, "z2z_superChartLitePopup", "100%", "100%", "7.0.14.0");
	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length)
	{	// netscape plugin architecture
		//do nothing
	}
	else
	{
		so.addParam("wmode", "opaque");
	}
	var winContent = "<div id='"+superChartPopupContainerId+"'>"+so.getSWFHTML()+"</div>";
	win.setHTMLContent(winContent); 

	win.setDestroyOnClose();
	win.showCenter();
	win.toFront();
}

function z2z_superChart_GenericFSCommand(command, str)
{
	//support for old version of safari
	var prefixIndex = command.indexOf("FSCommand:");
	if (prefixIndex != -1)
	{
		command = command.substr(10);
	}
	var args=str.split(",");
    switch (command)
	{
        case "z2z_superChartLiteWinPopBrowser":
        	var targetPath = str;
			var z2z_superChartLiteWin = window.open(targetPath,'','width='+(screen.width-10)+',height='+(screen.height-60)+',top=0,left=0,resizable=1');
			if(z2z_superChartLiteWin)
			{
				z2z_superChartLiteWin.focus();
			}
			else
			{
				alert('The popup is blocked! Please configure your popup blocker to allow popup windows from our site!');
			}
            break;
        case "z2z_superChartLiteWinPopBrowserWeb2":
        	z2z_superChartLitePopup_show(str);
        	break;
    }
}

function z2z_showStock(pChartContainerId, pChartId, pStockId, pChartWidth, pChartHeight, pLang, pOpenMaxChartType, pCustomHandler)
{
	var noStockIdError = "Please enter stock code."
	var StockIdFormatInValidError = "Sorry, the stock code entered is in the wrong format. Please enter numbers only.";

	var needServerCall = false;
	if (!pStockId)
	{
		alert(noStockIdError);
		return needServerCall;
	}

	var stockIdRE = /^[0-9]{1,4}$/
	if (!stockIdRE.test(pStockId))
	{
		alert(StockIdFormatInValidError);
		return;
	}

	var para = "?openMaxChartType="+pOpenMaxChartType;
	if (pOpenMaxChartType == "customHandler")
	{
		para += "&customHandler="+pCustomHandler;
	}
	else if (pOpenMaxChartType == "customCommand")
	{
		para += "&customCommand="+pCustomHandler;
	}
	if (pLang)
	{
		para += "&lang="+pLang;
	}
	para += "&stockId="+pStockId;

	var so;

	so = new z2z.SWFObject("http://www.redandgreenguide.com/chart/PGSuperChartLiteApp.swf"+para, pChartId, pChartWidth, pChartHeight, "7.0.14.0");
	so.addParam("wmode", "opaque");
	so.addParam("swLiveConnect", "true");
	so.addParam("AllowScriptAccess", "always");
	so.write(pChartContainerId);
}

