//require swfobject.as

function createCheckAppSWF(checkAppPath, mainLCName, appType)
{
	var checkAppSWFContainerParentID = "checkAppSWF";
	var checkAppSWFContainerID = "c_checkApp";

	var np = document.getElementById(checkAppSWFContainerParentID);
	if (np != null)
	{
		return;
	}

	//create a node to make the swf gets away from screen
	//don't hide it or make it invisible!!
	np = document.createElement("div");
	np.setAttribute("id", checkAppSWFContainerParentID);
	np.style.position = "absolute";
	np.style.left = "-10px";
	np.style.top = "-10px";
	document.body.appendChild(np);

	//create a node to act as a container for swf
	var n = document.createElement("div");
	n.setAttribute("id", checkAppSWFContainerID);
	np.appendChild(n);

	//create swf using swfobject
	var so = new SWFObject(checkAppPath, "checkApp", "1", "1", "7.0.14.0");
	so.addParam("swLiveConnect", true);
	so.addParam("quality", "high");
	so.addParam("menu", "false");
	so.addParam("scale", "noscale");
	so.addVariable("mainLCName", mainLCName);
	so.addVariable("appType", appType);
	so.write(checkAppSWFContainerID);
}

function openWindow(path, winName, w, h, property)
{
	var screenWidth = screen.width;
	var screenHeight = screen.height;

	var targetX = (screenWidth - w) / 2;
	var targetY = (screenHeight - h) / 2;

	var win = window.open(path, winName, "width="+w+",height="+h+",top="+targetY+",left="+targetX+","+property);
	if (!win)
	{
		alert("The popup is blocked! Please configure your popup blocker to allow popup windows from our site!");
		return;
	}

	win.focus();
	return win;
}

function refreshUserSession()
{
	getAppSwf().SetVariable("callRefreshUserSession", 1);
}

function getAppSwf()
{
	return document.getElementById("flexapp");
}
