
var g_xml = null;


var g_htm = "";

function CheckWellFormed(xml)
{
	if (xml == null)
	{
		var xml = xmltext.value;
		//alert (xml);
	}
	/*
	var dom = CreateXMLDocument();
	dom.async = false;
	dom.loadXML(xml);
	
	var xsl = CreateXMLDocument();
	xsl.async = false;
	xsl.load("transformations/defaultss_NET.xsl");
	*/
	
	var result = TransformToString(xml, "transformations/defaultss_NET.xsl");//dom.transformNode(xsl);        //!CROSSBROWSER
	//alert (result);
	var win = open('', "Example", 'scrollbars=yes,resizable=yes,width=800,height=600,screenX=50,screenY=50,top=50,left=50');
	win.document.open();
	win.document.write(result);
	win.document.close();
}

/**
 *
 */
function SceneWindow(file,window)
{
	msgWindow = open(file,window,'scrollbars=yes,status=yes,resizable=yes,width=1024,height=768,screenX=0,screenY=0,top=0,left=0,status=yes');
	if (msgWindow.opener == null)
  	msgWindow.opener = self;
}

/**
 *
 */
function PopWindow(file,window)
{
	msgWindow = open(file,window,'scrollbars=yes,resizable=yes,width=800,height=600,screenX=50,screenY=50,top=50,left=50');
	if (msgWindow.opener == null)
  	msgWindow.opener = self;
}

/**
 *
 */
function QueryString(param)
{
	var loca = document.location.href;
	//alert (loca);
	if(loca.indexOf('?' + param + '=')>-1 || loca.indexOf('&' + param + '=')>-1)
	{
		var qString = loca.split('?');
		var keyVal = qString[1].split('&');
		for(var i=0;i<keyVal.length;i++)
		{
			if(keyVal[i].indexOf(param + '=')==0)
			{
				var val = keyVal[i].split('=');
				return val[1];
			}
		}
		return false;
	}
	else
	{
		return false;
	}
}

function SwitchGraphicsEngine(graphicsEngine)
{
	window.status = "Switching graphics engine to " + graphicsEngine + "."; 
	Bridgeworks.UpdateScene("<?bwplugin url=\"" + graphicsEngine + "\" action=\"load\"?>");
	window.status = "Done."; 
}
