/*
 *  Opens a new window for Chart XML. 
 *
 *  chartXML  file name of Chart XML file 
 *
 */
function showXML(chartXML)
{
  window.open(chartXML,"ChartXML","height=500,width=600,top=150,left=100,scrollbars=yes,resizable=yes");
}

/*
 *  Opens a new window for Chart Designer. 
 *
 *  chartXML   file path (relative to "usersguide" dir) of Chart XML file 
 *  parse  selects if data is parsed for table view or displayed as XML: true=parse (default), false=don't parse
 *
 */
function editXML(chartXML, parse)
{
  if (parse == null) parse = "true";
  win=open("http://products.davisor.com/chart/designer/main.jsp?xml=../doc/usersguide/"+chartXML+"&parseData="+parse,"designer","scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=yes,status=no,width=900,height=780");
}

/*
 *  Opens a new window for a JSP/servlet result if we are in server.
 *
 *  fileName  file name of executed page
 *
 */
function runCode(fileName)
{
  var host = window.self.location.host;

  if (host == '')
    window.alert("This function is available only when 'chart.war' is deployed to a local server.")
  else if (host == 'products.davisor.com')
    window.alert("This function is available when the download package is deployed to a local server.")
  else
    window.open(fileName,"CodeResult","height=500,width=600,top=150,left=100,scrollbars=yes,resizable=yes")     
}

/*
 *  Loads menu and content frames if current page is not allready in frame.
 *
 *  index  relative path to main index page
 *
 */
function addMenu(index)
{
  if (parent.location.href == self.location.href)
  {
    var current = window.self.location.pathname;
    window.location.replace (index + '?' + current);
  }
}
