var vps = ''; // VPS Window
function LaunchVPSPlan(width, height, plan, community)
{
	var urlString = "plan="+plan;
	if(community != undefined)
		urlString += "&community="+community;
	LaunchVPSBase(width, height, urlString);
}
function LaunchVPSBase(width, height, param)
{
   var url = "/vps/index.html" + (param != undefined ? "?"+param : "");
	
	if (!vps.closed && vps.location)
		vps.location.href = url;
	else
	{
		vps = window.open(url, "VPS", "resizable=no,scrollbars=no,status=no,width="+width+",height="+height);
		if (!vps.opener)
			vps.opener = self;
	}
	if (window.focus) {vps.focus()}
}
function LaunchVPS(width, height)
{
	LaunchVPSBase(width, height);
}
function LaunchVPSConfig(width, height, urlString)
{
	LaunchVPSBase(width, height, urlString);
}
function OpenQTVR(path)
{
	window.open("html/qtvr.html?path="+path, "QTVR", "resizable=no,width=400,height=316");
}
function OpenVideo(path)
{
	window.open("html/video.html?path="+path, "Video", "resizable=no,width=864,height=546");
}
function GetPlan()
{
	var r = _query_string;
	if(plan != undefined)
	{
		r = "plan="+plan; 
	}
	return r;
}
function JSTrace(message)
{
	alert(message);
}
function PrintSWF(width, height, percentage)
{
	var swf_str = "";
	var flashVars_str = GetPlan();
	var w = width + (percentage ? "%" : "");
	var h = height + (percentage ? "%" : "");
	if(isFirefox && percentage)
		h = 600;
// 	var flashVars_str = _query_string;
	
	swf_str += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+w+"\" height=\""+h+"\" id=\"VPS\" align=\"middle\">";
	swf_str += "<param name=\"FlashVars\" value=\"" + flashVars_str + "\">";
	swf_str += "<param name=\"allowScriptAccess\" value=\"sameDomain\">";
	swf_str += "<param name=\"movie\" value=\"VPS.swf\">";
	swf_str += "<param name=\"scale\" VALUE=\"noscale\">";
	swf_str += "<param name=\"quality\" value=\"high\">";
	swf_str += "<param name=\"bgcolor\" value=\"#ffffff\">";
	swf_str += "<embed src=\"VPS.swf\" FlashVars=\"" + flashVars_str + "\" quality=\"high\" scale=\"noscale\" bgcolor=\"#ffffff\" width=\""+w+"\" height=\""+h+"\" name=\"VPS\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
	swf_str += "</object>";

	return swf_str;
}
function ChangeModule(sModule, win)
{
	GetVPS(win).ChangeModule(sModule);
}
function NextStep(win)
{
	GetVPS(win).NextStep();
}
function GetURLString(win)
{
    var urlString = GetVPS(win).GetURLString();
    return urlString; 
}
function Test()
{
	JSTrace(GetVPS().GetURLString());
}
function GetVPS(win)
{
	if(win == undefined)
		win = this;
    if (navigator.appName.indexOf("Microsoft") != -1)
        return win["VPS"];
    else
        return win.document["VPS"];
}
