lmRootPath = "http://www.livemanuals.com/packages/";
try {
rootPath=window.top.location.href.substr(0,window.top.location.href.toLowerCase().lastIndexOf('index.html'));
rootPath.length==0?rootPath=window.top.location.href:null;}
catch(err){
	rootPath='';
}
((typeof(myRootPath)=='string') && (myRootPath.length != 0))?rootPath=myRootPath:null;
VsimWidth = 775;
VsimHeight = 550;
HsimWidth = 450;
HsimHeight = 700;
manualWidth = 620;
manualHeight = 620;
showLocationBar = 'no';
allowScrollBars = 'no';
showStatusBar = 'yes';
showStatusBarManual = 'no';

manOpenId = '';
simOpenId = '';
function openLManualWindow()  {

  // DETERMINE ROOT PATH

//  rootPath=window.top.location.href.substr(0,window.top.location.href.toLowerCase().lastIndexOf('index.html'));
//  rootPath.length==0?rootPath=window.top.location.href:null;
  ((typeof(myRootPath)=='string') && (myRootPath.length != 0))?rootPath=myRootPath:null;

  // INPUT VARIABLES
  // **********************************
  // arguments[0] = Product Path
  // arguments[1] = Product ID
  // arguments[2] = Chapter
  // arguments[3] = Anchor
  // arguments[4] = Product Name
  // arguments[5] = Frame Border
  // arguments[6] = Style Sheet
  
  arguments[0] = arguments[0]?arguments[0].substr(0,5).toUpperCase():'';
  arguments[1] = arguments[1]?arguments[1]:'';
  arguments[2] = arguments[2]?arguments[2]:'';
  arguments[3] = arguments[3]?arguments[3]:'';
  arguments[4] = arguments[4]?escape(arguments[4]):'';
  arguments[5] = arguments[5]?arguments[5]:'1';
  arguments[6] = arguments[6]?arguments[6]:'0';
  
  // check to see if this is a call from the question and answer search results page
  if (((arguments[2] == null) || (arguments[2] == "")) && ((arguments[3] == null) || (arguments[3] == "")))
    qaHelp = false;
  else
    qaHelp = true;
    
  // make sure the manual window is open
  if ((window.manualHandler) && (!window.manualHandler.closed)) {
    // if the wrong product manual is in the window,
    // reload it to the correct product manual
    if (manOpenId.toLowerCase() != arguments[0].toLowerCase()) {
      window.manualHandler.close();
      window.manualHandler = window.open(rootPath + "common/loadmanual.html?prodPath=" + arguments[0].toUpperCase() + "&pid=" + arguments[1] + "&chapter=" + arguments[2] + "&anchor=" + arguments[3] + "&prodName=" + arguments[4] + "&fb=" + arguments[5] + "&ss=" + arguments[6], "manualWindow", "location=" + showLocationBar + ",height=" + manualHeight + ",width=" + manualWidth + ",toolbar=no,status=" + showStatusBarManual + ",top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars=" + allowScrollBars);
      if (! manualHandler.opener) { manualHandler.opener = self }
      manOpenId = arguments[0];
    }
    // if it is the correct product manual, focus the window
    else {
      // load the appropriate qa help pages within the manual
      if (qaHelp) {
        theProdPath = getParameter(window.manualHandler.top.location.href.toLowerCase(), "prodpath");
        if (theProdPath != null) {
          window.manualHandler.top.TREE.document.location.href = rootPath + theProdPath.toUpperCase() + "/pkg/manual/" + arguments[2].toUpperCase() + "nav.html#" + arguments[3];
          window.manualHandler.top.WORK.document.location.href = rootPath + theProdPath.toUpperCase() + "/pkg/manual/" + arguments[2].toUpperCase() + ".html#" + arguments[3];
        }
      }
      // focus window
      manualHandler.window.focus();
    }
  }
  else {
    window.manualHandler = window.open(rootPath + "common/loadmanual.html?prodPath=" + arguments[0].toUpperCase() + "&pid=" + arguments[1] + "&chapter=" + arguments[2] + "&anchor=" + arguments[3] + "&prodName=" + arguments[4] + "&fb=" + arguments[5] + "&ss=" + arguments[6], "manualWindow", "location=" + showLocationBar + ",height=" + manualHeight + ",width=" + manualWidth + ",toolbar=no,status=" + showStatusBarManual + ",top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars=" + allowScrollBars);
    if (! manualHandler.opener) { manualHandler.opener = self }
    manOpenId = arguments[0];
  }
}

// VERTICAL SIMULATION WINDOW FUNCTION

function openLVSimWindow()  {

  // DETERMINE ROOT PATH

//  rootPath=window.top.location.href.substr(0,window.top.location.href.toLowerCase().lastIndexOf('index.html'));
//  rootPath.length==0?rootPath=window.top.location.href:null;
  ((typeof(myRootPath)=='string') && (myRootPath.length != 0))?rootPath=myRootPath:null;

  // INPUT VARIABLES
  // **********************************
  // arguments[0] = Product Path
  // arguments[1] = Product ID
  // arguments[2] = Application Name
  // arguments[3] = Scenario Name
  // arguments[4] = Scenario Number
  // arguments[5] = Product Name
  // arguments[6] = Frame Border
  // arguments[7] = Style Sheet
  
  arguments[0] = arguments[0]?arguments[0].substr(0,5).toUpperCase():'';
  arguments[1] = arguments[1]?arguments[1]:'';
  arguments[2] = arguments[2]?arguments[2]:'';
  arguments[3] = arguments[3]?arguments[3]:'';
  arguments[4] = arguments[4]?arguments[4]:'';
  arguments[5] = arguments[5]?escape(arguments[5]):'';
  arguments[6] = arguments[6]?arguments[6]:'1';
  arguments[7] = arguments[7]?arguments[7]:'0';

  // make sure the simulation window is open
  if ((window.VsimHandler) && (!window.VsimHandler.closed)) {
    // if the wrong product is in the window, reload it to the correct product
    if (simOpenId.toLowerCase() != arguments[0].toLowerCase()) {
      window.VsimHandler.close();  
      window.VsimHandler = window.open(rootPath + arguments[0].toUpperCase() + "/pkg/simulation/sim.html?prodPath=" + arguments[0].toUpperCase() + "&pid=" + arguments[1] + "&prodName=" + arguments[5] + "&applicationName=" + arguments[2].toLowerCase() + "&scenarioName=" + arguments[3].toLowerCase() + "&scenarioNumber=" + arguments[4] + "&fb=" + arguments[6] + "&ss=" + arguments[7], "VSimWindow", "height=" + VsimHeight + ",width=" + VsimWidth + ",toolbar=no,status=" + showStatusBar + ",location=" + showLocationBar + ",top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars=" + allowScrollBars);
      if (! VsimHandler.opener) { VsimHandler.opener = self }
      simOpenId = arguments[0];
    }
    // if it is the correct product, load scenario if requested and focus the window
    else {
      // load scenario if requested
      if (scenarioFromManual(arguments[2], arguments[3], arguments[4])) {
        if (VsimHandler.window.nav) {
          VsimHandler.window.nav.scenarioLoader(arguments[2].toLowerCase(), arguments[3].toLowerCase(), arguments[4]);
        }
        else {
          VsimHandler.window.scenarioLoader(arguments[2].toLowerCase(), arguments[3].toLowerCase(), arguments[4]);
        }
      }
      // focus window
      VsimHandler.window.focus();
    }
  }
  // if simulation window is not open, open up a new window with
  // the proper product and url variables
  else {
    window.VsimHandler = window.open(rootPath + arguments[0].toUpperCase() + "/pkg/simulation/sim.html?prodPath=" + arguments[0].toUpperCase() + "&pid=" + arguments[1] + "&prodName=" + arguments[5] + "&applicationName=" + arguments[2].toLowerCase() + "&scenarioName=" + arguments[3].toLowerCase() + "&scenarioNumber=" + arguments[4] + "&fb=" + arguments[6] + "&ss=" + arguments[7], "VSimWindow", "height=" + VsimHeight + ",width=" + VsimWidth + ",toolbar=no,status=" + showStatusBar + ",location=" + showLocationBar + ",top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars=" + allowScrollBars);
    if (! VsimHandler.opener) { VsimHandler.opener = self }
    simOpenId = arguments[0];
  }
}

pid = '';
ptid = '';
imgLoc = '';
imgLink = '';
sPageLoading = false;
tpt = '';



// PARTNERS MANUAL WINDOW FUNCTION

function openRManualWindow()  {

  // INPUT VARIABLES
  // **********************************
  // arguments[0] = Product Path   OBSOLETE
  // arguments[1] = Product ID
  // arguments[2] = Chapter
  // arguments[3] = Anchor
  // arguments[4] = Partner ID
  // arguments[5] = Logo Image URL
  // arguments[6] = Logo Image Link
  // arguments[7] = Same Page Loading
  // arguments[8] = Template ID

  prodPath=arguments[0]?arguments[0]:'';
  pid=arguments[1]?arguments[1]:pid;
  chapter=arguments[2]?arguments[2]:'';
  anchor=arguments[3]?arguments[3]:'';
  ptid=arguments[4]?arguments[4]:ptid;
  imgLoc=arguments[5]?escape(escape(arguments[5])):imgLoc;
  imgLink=arguments[6]?escape(escape(arguments[6])):imgLink;
  if (typeof(arguments[7])=='string') {
    sPageLoading=eval(arguments[7]);
  }
  tpt=arguments[8]?arguments[8]:tpt;
  
  imgLoc = escape(imgLoc);
  imgLink = escape(imgLink);
  sPageLoading=eval(sPageLoading);
  
  if (!sPageLoading) {
    if (window.top.name == 'VSimWindow') {
      // check to see if this is a call from the question and answer search results page
      if (((chapter == null) || (chapter == "")) && ((anchor == null) || (anchor == "")))
        qaHelp = false;
      else
        qaHelp = true;
      // make sure the manual window is open
      
      if ((window.manualHandler) && (!window.manualHandler.closed)) {
        // if the wrong product manual is in the window,
        // reload it to the correct product manual
        if ((manualHandler.window.top.location.href.toLowerCase().indexOf("loadmanual.cfm?") == -1) || (manualHandler.window.top.location.href.toLowerCase().indexOf("pid=" + pid.toLowerCase()) == -1) || (manualHandler.window.top.location.href.toLowerCase().indexOf("ptid=" + ptid.toLowerCase()) == -1)) {
          window.manualHandler.close();
          window.manualHandler=window.open(lmRootPath+'products/common/loadManual.cfm?ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&chapter='+chapter+'&anchor='+anchor+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'manualWindow','location='+showLocationBar+',height='+manualHeight+',width='+manualWidth+',toolbar=no,status='+showStatusBarManual+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
          (!manualHandler.opener)?manualHandler.opener=self:dVar=null;
        }
        // if it is the correct product manual, focus the window
        else {
          // load the appropriate qa help pages within the manual
          if (qaHelp) {
            theProdPath = getParameter(window.manualHandler.top.BOTTOM.document.location.href.toLowerCase(), "prodpath");
            if (theProdPath != null) {
              window.manualHandler.top.TREE.document.location.href = lmRootPath + "products/" + theProdPath + "/manual/" + chapter + "nav.html#" + anchor;
              window.manualHandler.top.WORK.document.location.href = lmRootPath + "products/" + theProdPath + "/manual/" + chapter + ".html#" + anchor;
            }
          }
          // focus window
          manualHandler.window.focus();
        }
      }
      else {
        window.manualHandler=window.open(lmRootPath+'products/common/loadManual.cfm?ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&chapter='+chapter+'&anchor='+anchor+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'manualWindow','location='+showLocationBar+',height='+manualHeight+',width='+manualWidth+',toolbar=no,status='+showStatusBarManual+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
        (!manualHandler.opener)?manualHandler.opener=self:dVar=null;
      }
    }
    else {
      window.manualHandler=window.open(lmRootPath+'products/common/loadManual.cfm?ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&chapter='+chapter+'&anchor='+anchor+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'manualWindow','location='+showLocationBar+',height='+manualHeight+',width='+manualWidth+',toolbar=no,status='+showStatusBarManual+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
      (!manualHandler.opener)?manualHandler.opener=self:dVar=null;
    }
  }
  else {
    window.top.location.href = lmRootPath+'products/common/loadManual.cfm?ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&chapter='+chapter+'&anchor='+anchor+'&sPage=true&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading;
    window.name = 'mainWindow';
  }
  
  
  
  
  imgLoc = '';
  imgLink = '';

}



// PARTNERS VERTICAL SIMULATION WINDOW FUNCTION

function openRVSimWindow()  {

  // INPUT VARIABLES
  // **********************************
  // arguments[0] = Product Path   OBSOLETE
  // arguments[1] = Product ID
  // arguments[2] = Application Name
  // arguments[3] = Scenario Name
  // arguments[4] = Scenario Number
  // arguments[5] = Partner ID
  // arguments[6] = Logo Image URL
  // arguments[7] = Logo Image Link
  // arguments[8] = Same Page Loading
  // arguments[9] = Template ID
 
  prodPath=arguments[0]?arguments[0]:'';
  pid=arguments[1]?arguments[1]:pid;
  aName=arguments[2]?arguments[2]:'';
  sName=arguments[3]?arguments[3]:'';
  sNum=arguments[4]?arguments[4]:'';
  ptid=arguments[5]?arguments[5]:ptid;
  imgLoc=arguments[6]?escape(arguments[6]):imgLoc;
  imgLink=arguments[7]?escape(arguments[7]):imgLink;
  if (typeof(arguments[8])=='string') {
    sPageLoading=eval(arguments[8]);
  }
  tpt=arguments[9]?arguments[9]:tpt;
  
  imgLoc = escape(imgLoc);
  imgLink = escape(imgLink);
  sPageLoading=eval(sPageLoading);
  
  if (!sPageLoading) {
    if (window.top.name == 'manualWindow') {
      // make sure the simulation window is open
      if ((window.VsimHandler) && (!window.VsimHandler.closed)) {
        // if the wrong product is in the window, reload it to the correct product
        if ((VsimHandler.window.top.location.href.toLowerCase().indexOf("loadvsim.cfm?") == -1) || (VsimHandler.window.top.location.href.toLowerCase().indexOf("pid=" + pid.toLowerCase()) == -1) || (VsimHandler.window.top.location.href.toLowerCase().indexOf("ptid=" + ptid.toLowerCase()) == -1)) {
          window.VsimHandler.close();
          window.VsimHandler=window.open(lmRootPath+'install/loader.cfm?simType=V&ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&applicationName='+aName.toLowerCase()+'&scenarioName='+sName.toLowerCase()+'&scenarioNumber='+sNum+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'VSimWindow','height='+VsimHeight+',width='+VsimWidth+',toolbar=no,status='+showStatusBar+',location='+showLocationBar+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
          (!VsimHandler.opener)?VsimHandler.opener=self:dVar=null;
        }
        // if it is the correct product, load scenario if requested and focus the window
        else {
          // load scenario if requested
          if (scenarioFromManual(aName, sName, sNum)) {
            if (VsimHandler.window.nav) {
              VsimHandler.window.nav.scenarioLoader(aName.toLowerCase(), sName.toLowerCase(), sNum);
            }
            else {
              VsimHandler.window.scenarioLoader(aName.toLowerCase(), sName.toLowerCase(), sNum);
            }
          }
          // focus window
          VsimHandler.window.focus();
        }
      }
      // if simulation window is not open, open up a new window with
      // the proper product and url variables
      else {
        window.VsimHandler=window.open(lmRootPath+'install/loader.cfm?simType=V&ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&applicationName='+aName.toLowerCase()+'&scenarioName='+sName.toLowerCase()+'&scenarioNumber='+sNum+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'VSimWindow','height='+VsimHeight+',width='+VsimWidth+',toolbar=no,status='+showStatusBar+',location='+showLocationBar+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
        (!VsimHandler.opener)?VsimHandler.opener=self:dVar=null;
      }
    }
    else {
      window.VsimHandler=window.open(lmRootPath+'install/loader.cfm?simType=V&ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&applicationName='+aName.toLowerCase()+'&scenarioName='+sName.toLowerCase()+'&scenarioNumber='+sNum+'&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading,'VSimWindow','height='+VsimHeight+',width='+VsimWidth+',toolbar=no,status='+showStatusBar+',location='+showLocationBar+',top=0,left=0,screenx=0,screeny=0,resizable=yes,scrollbars='+allowScrollBars);
      (!VsimHandler.opener)?VsimHandler.opener=self:dVar=null;
    }
  }
  else {
    window.top.location.href = lmRootPath+'install/loader.cfm?simType=V&ptid='+ptid+'&tpt='+tpt+'&pid='+pid+'&applicationName='+aName.toLowerCase()+'&scenarioName='+sName.toLowerCase()+'&scenarioNumber='+sNum+'&sPage=true&imgLoc='+imgLoc+'&imgLink='+imgLink+'&sPage='+sPageLoading;
    window.name = 'mainWindow';
  }
  
  
  
  imgLoc = '';
  imgLink = '';
  
}















// SCENARIO VARIABLES CHECKER

function scenarioFromManual(applicationName, scenarioName, scenarioNumber) {
  // make sure that all variables for loading scenario exist
  if ((applicationName != null) && (applicationName.length != 0)) {
    if ((scenarioName != null) && (scenarioName.length != 0)) {
      if ((scenarioNumber != null) && (scenarioNumber.length != 0)) {
        return true;
      }
    }
  }
  // one or more of the variables are missing or null
  return false;
}

// gets the value of a parameter from a URL
// URL is written in the standard query format: http://site/page?param1=value1&param2=value2&...
// returns null if the parameter was not found in the URL

function getParameter(url, name) {
    // get the parameters(query) portion of the URL
    var i = url.lastIndexOf("?");
    if(i==-1)
       return null;
    var paramStr = url.substring(i+1, url.length); // can't use substr - JavaScript 1.2+
    var params = paramStr.split("&");

    // scan all parameters for the specified parameter name
    for(i=0; i<params.length; i++) {
       var nv = params[i].split("=", 2);
       if(nv[0] == name)
          return (nv.length>1) ? nv[1] : "";
    }
    return null; // parameter was not found
}


function lmlocal()
{
	openVSimWindow = openLVSimWindow;
	openManualWindow = openLManualWindow;
}

function lmremote()
{
	openVSimWindow = openRVSimWindow;
	openManualWindow = openRManualWindow;
}


lmlocal();
