
if (!window.PPC) new function() {
try {

window.PPC = this;

var isNS = navigator.appName.indexOf("Netscape")>-1; 

// Set the default "show" mode to that specified by W3C DOM
// compliant browsers

var showMode = 'table-cell';
var stateExpanded = 'expanded';
var stateCollapsed = 'collapsed';

if (document.all) showMode='block';

/**
 * loads a page in response to a an onClick event
 * NOTE: cancelBubble=true must be used on child links to prevent double-submission
 *
 * @param tab TD element for the tab that contains
 *               a single href element
 */
this.tabLoadPage = function  (tab) {
  link = this.first_child(tab);
  if(link) location = link.href;
};

/**
 * changes the interior href style to underline
 * and cursor to hand on mouse over
 *
 * @param tab element for the tab that contains
 *            a single href element
 * @param inside boolean true if entering, false if exiting
 */
this.tabOver = function (tab, inside) {

  link = this.first_child(tab);

  if(link) {
  
	link.style.textDecoration = (inside)? "underline" : "none";
	tab.style.cursor = (inside) ? "hand" : "pointer";
  }
};

// function container for DOM related methods
// taken from a Mozilla whitepaper

/**
 * Throughout, whitespace is defined as one of the characters
 *  "\t" TAB \u0009
 *  "\n" LF  \u000A
 *  "\r" CR  \u000D
 *  " "  SPC \u0020
 *
 * This does not use Javascript's "\s" because that includes non-breaking
 * spaces (and also some other characters).
 */


/**
 * Determine whether a node's text content is entirely whitespace.
 *
 * @param nod  A node implementing the |CharacterData| interface (i.e.,
 *             a |Text|, |Comment|, or |CDATASection| node
 * @return     True if all of the text content of |nod| is whitespace,
 *             otherwise false.
 */
this.is_all_ws = function ( nod )
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}


/**
 * Determine if a node should be ignored by the iterator functions.
 *
 * @param nod  An object implementing the DOM1 |Node| interface.
 * @return     true if the node is:
 *                1) A |Text| node that is all whitespace
 *                2) A |Comment| node
 *             and otherwise false.
 */

this.is_ignorable = function is_ignorable( nod )
{
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && this.is_all_ws(nod) ); // a text node, all ws
}

/**
 * Version of |previousSibling| that skips nodes that are entirely
 * whitespace or comments.  (Normally |previousSibling| is a property
 * of all DOM nodes that gives the sibling node, the node that is
 * a child of the same parent, that occurs immediately before the
 * reference node.)
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The closest previous sibling to |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
this.node_before = function ( sib )
{
  while ((sib = sib.previousSibling)) {
    if (!this.is_ignorable(sib)) return sib;
  }
  return null;
}

/**
 * Version of |nextSibling| that skips nodes that are entirely
 * whitespace or comments.
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The closest next sibling to |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
this.node_after = function ( sib )
{
  while ((sib = sib.nextSibling)) {
    if (!this.is_ignorable(sib)) return sib;
  }
  return null;
}

/**
 * Version of |lastChild| that skips nodes that are entirely
 * whitespace or comments.  (Normally |lastChild| is a property
 * of all DOM nodes that gives the last of the nodes contained
 * directly in the reference node.)
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The last child of |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
this.last_child = function ( par )
{
  var res=par.lastChild;
  while (res) {
    if (!this.is_ignorable(res)) return res;
    res = res.previousSibling;
  }
  return null;
}

/**
 * Version of |firstChild| that skips nodes that are entirely
 * whitespace and comments.
 *
 * @param sib  The reference node.
 * @return     Either:
 *               1) The first child of |sib| that is not
 *                  ignorable according to |is_ignorable|, or
 *               2) null if no such node exists.
 */
this.first_child = function ( par )
{
  var res=par.firstChild;
  while (res) {
    if (!this.is_ignorable(res)) return res;
    res = res.nextSibling;
  }
  return null;
}

/**
 * Version of |data| that doesn't include whitespace at the beginning
 * and end and normalizes all whitespace to a single space.  (Normally
 * |data| is a property of text nodes that gives the text of the node.)
 *
 * @param txt  The text node whose data should be returned
 * @return     A string giving the contents of the text node with
 *             whitespace collapsed.
 */
this.data_of = function ( txt )
{
  var data = txt.data;
  // Use ECMA-262 Edition 3 String and RegExp features
  data = data.replace(/[\t\n\r ]+/g, " ");
  if (data.charAt(0) == " ")
    data = data.substring(1, data.length);
  if (data.charAt(data.length - 1) == " ")
    data = data.substring(0, data.length - 1);
  return data;
}

/**
 * display the basic set of commands in a command panel
 * assumes there are divs with the id's cmdID_basic and cmdID_adv
 * cmdID_adv is hidden and cmdID_basic is displayed
 *
 * @param cmdID root of the div names for this panel.
 */
this.showBasicCmds = function (cmdID)
{
  var basicDiv = document.getElementById(cmdID + "_basic"); 
  var advDiv = document.getElementById(cmdID + "_adv");
  
  basicDiv.style.display = "";
  advDiv.style.display = "none";
}


/**
 * display the adv set of commands in a command panel
 * assumes there are divs with the id's cmdID_basic and cmdID_adv
 * cmdID_adv is displayed and cmdID_basic is hidden
 *
 * @param cmdID root of the div names for this panel.
 */
this.showAdvCmds = function (cmdID)
{
  var basicDiv = document.getElementById(cmdID + "_basic"); 
  var advDiv = document.getElementById(cmdID + "_adv");
  
  basicDiv.style.display = "none";
  advDiv.style.display = "";
}


/**
 * create a popup window for the about box
 *
 * @param aboutURL fully qualified url to handler for this box
 */
this.displayAbout = function (aboutURL)
{
    var newWin;
    
	newWin = window.open(aboutURL,'about','width=520,height=390,resize=0,scrollbars=0,location=no,status=no,menubar=no');
	newWin.focus();
}

/**
 * make the left task panel visible and hides the collpased
 * version of the panel
 *
 * @param taskPane id of the full task panel table cell
 * @param collpasePanel id of the collapsed task panel table cell
 * @param callback url to send state change notification to
 *                 if null no message is sent
 */
this.showTaskPane = function (taskPane, collapsePane, callback)
{
  this.hideTD(collapsePane);
  this.showTD(taskPane);
  if(callback != null && callback.length != 0) {
    var mungedURL = callback;
    if(mungedURL.indexOf("?") < 0) {
      mungedURL = mungedURL + "?";
    }
    else {
      mungedURL = mungedURL + "&";
    }
    this.sendStateChange(mungedURL + "id=" + taskPane +"&state=" + stateExpanded);
  }
}

/**
 * hides the left task panel visible and shows the collpased
 * version of the panel
 *
 * @param taskPane id of the full task panel table cell
 * @param collpasePanel id of the collapsed task panel table cell
 * @param callback url to send state change notification to
 *                 if null no message is sent
 */
this.hideTaskPane = function(taskPane, collapsePane, callback)
{
  this.hideTD(taskPane);
  this.showTD(collapsePane);    
  if(callback != null && callback.length != 0) {
    var mungedURL = callback;
    if(mungedURL.indexOf("?") < 0) {
      mungedURL = mungedURL + "?";
    }
    else {
      mungedURL = mungedURL + "&";
    }
    this.sendStateChange(mungedURL + "id=" + taskPane +"&state=" + stateCollapsed);
  }
}

/**
 * hide a table cell
 *
 * @param cellID id the of the table cell to hide
 */
this.hideTD = function(cellID) {

  cell = document.getElementById(cellID);

  cell.style.display = 'none';
}

/**
 * display a table cell
 *
 * @param cellID id the of the table cell to display
 */
this.showTD = function (cellID) {

  cell = document.getElementById(cellID);

  cell.style.display = showMode;
}
/**
 * toggle the display state of the left task panel
 * assumes there is a client div with id <name>_client
 * and that the collapse/expand image has an id of
 * <name>_img
 *
 * @param name id of the task panel to display/hide
 * @param openImage fully qualified url to the image to indicated expand action
 * @param closedImage fully qualified url to the image to indicated close action
 * @param callback url to send state change notification to
 *                 if null no message is sent
 *
 */
this.toggleTaskDisplay = function(name, openImage, closedImage, callback) { 
  var myDiv = document.getElementById(name + "_client" ); 
  var newState = "";

  if (myDiv.style.display == "none") {
    myDiv.style.display = "";
    this.setImage(name + "_img", openImage);
    newState = stateExpanded;
  } else {
    myDiv.style.display = "none"; 
    this.setImage(name + "_img", closedImage);
    newState = stateCollapsed;
  } 

  if(callback != null && callback.length != 0) {
    var mungedURL = callback;
    if(mungedURL.indexOf("?") < 0) {
      mungedURL = mungedURL + "?";
    }
    else {
      mungedURL = mungedURL + "&";
    }
    this.sendStateChange(mungedURL + "id=" + name +"&state=" + newState);
  }
} 
/**
 * change the image in an image tag
 *
 * @param name id of the image to swap
 * @param image fully qualified url to the new image
 */
this.setImage = function (name, image) {

 var myImg = document.getElementById(name); 
 myImg.src = image;
}  

/**
 * send a request to the specified url
 *
 * @param urlToSend url to request
 */
this.sendStateChange = function (urlToSend) {

  var xmlhttp = false;
  
  try {
    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
      } 
  catch (e) {
    try {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp=false;
    }
  }
  
  if (!xmlhttp) {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp=false;
    }
  }
  
  if(xmlhttp) {

	// we append a random number to prevent caching
    urlToSend = urlToSend + "&random=" + Math.floor(Math.random() * 1000);

    xmlhttp.open("GET", urlToSend, true);
    xmlhttp.setRequestHeader("Cache-control","no-cache");
    xmlhttp.send(null);
  }
}


}
catch (error) {
    
    alert("Error [0]: " + error.description);
} finally {
    
}}();




