//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2000-2004 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//*****************************************************************************

//----------------------------------------------------------------------------
// Code to determine the browser and version.
//----------------------------------------------------------------------------

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isOP    = false;  // Opera
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "Opera";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isOP = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as Netscape 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }

  s = "MSIE";
  if ((i = ua.indexOf(s))) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}

var browser = new Browser();

//----------------------------------------------------------------------------
// Code for handling the menu bar and active button.
//----------------------------------------------------------------------------

var activeButton = null;

// Capture mouse clicks on the page so any active button can be
// deactivated.

if (browser.isIE)
  document.onmousedown = pageMousedown;
else
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var el;

  // If there is no active button, exit.
  if (activeButton == null)
    return;

  // Find the element that was clicked on.
  if (browser.isIE)
    el = window.event.srcElement;
  else
    el = (event.target.tagName ? event.target : event.target.parentNode);

  // If the active button was clicked on, exit.
  if (el == activeButton)
    return;

  // If the element is not part of a menu, reset and clear the active
  // button.
  if (getContainerWith(el, "DIV", "menu") == null) {
    if ( activeButton.getAttribute("id") == 'fcTaskInputABC' || activeButton.getAttribute("id") == 'fcTaskAction' || activeButton.getAttribute("id") == 'fcTaskActionOthers' || activeButton.getAttribute("id") == 'fcOppProcessAction' || activeButton.getAttribute("id") == 'acctGoContextMenu' )
    {
      activeButton.style.display = "none";
      activeButton = null;
    }
    else  // regular menu
    {
      resetButton(activeButton);
      activeButton = null;
    }
  }
}

function menu_js_clear_active_button()
{
  if (activeButton != null)
  {
          var el;
          // Find the element that was clicked on.
          if (browser.isIE) el = window.event.srcElement;
          else              el = (event.target.tagName ? event.target : event.target.parentNode);

          // If the active button was clicked on, exit.
          if (el == activeButton)
            return;

          // If the element is not part of a menu, reset and clear the active button
          if (getContainerWith(el, "DIV", "menu") == null)
          {
            if ( activeButton.getAttribute("id") == 'fcTaskInputABC' || activeButton.getAttribute("id") == 'fcTaskAction' || activeButton.getAttribute("id") == 'fcTaskActionOthers' || activeButton.getAttribute("id") == 'fcOppProcessAction' )
            {
              activeButton.style.display = "none";
              activeButton = null;
            }
            else  // regular menu
            {
              resetButton(activeButton);
              activeButton = null;
            }
          }
  }	
}

function buttonClick(event, menuId) { return buttonClickAdv( event, menuId, 0, 0 ); }
function buttonClickAdv(event, menuId, xAdjust, yAdjust )
{
  var button;

  // Get the target button element.

  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.
  // Additionally, initialize menu display.

  if (button.menu == null) {
    button.menu = document.getElementById(menuId);
    if (button.menu.isInitialized == null)
      menuInit(button.menu);
  }
  adjustiFrame( button.menu );

  // Reset the currently active button, if any.
  if (activeButton != null)
  {
    resetButton(activeButton);
  }

  // Activate this button, unless it was the currently active one.
  if (button != activeButton) {
    depressButton(button, xAdjust, yAdjust);
    activeButton = button;
  }
  else
  {
    activeButton = null;
  }

  return false;
}


function buttonClickV2( event, contextObjType, contextObjId, cpos )
{
  var button;

  // Get the target button element.
  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.
  // Additionally, initialize menu display.
  if (button.menu == null) {
    button.menu = document.getElementById('ajax_contextmenu_div');
    if (button.menu.isInitialized == null)
      menuInit(button.menu);
  }
  adjustiFrame( button.menu );

  // Reset the currently active button, if any.
  if (activeButton != null)
  {
    resetButton(activeButton);
  }

  // Activate this button, unless it was the currently active one.
  if (button != activeButton)
  {
    depressButton(button, 0, 0);
    activeButton = button;
  }
  else
    activeButton = null;

  ajax_context_menu( contextObjType, contextObjId, cpos );
  return false;
}
function contextMenuCursor( event, contextObjType, contextObjId, cpos )
{
  var button;
    // Re-show the Add New Row button for adding a new row in the middle.
  document.getElementById("ajax_contextmenu_div").style.display = '';
  // Get the target button element.
  if (browser.isIE)
    button = window.event.srcElement;
  else
    button = event.currentTarget;

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.
  // Additionally, initialize menu display.
  if (button.menu == null) {
    button.menu = document.getElementById('ajax_contextmenu_div');
    if (button.menu.isInitialized == null)
      menuInit(button.menu);
  }
  adjustiFrame( button.menu );

  // Reset the currently active button, if any.
  if (activeButton != null)
  {
    resetButton(activeButton);
  }

  // Activate this button, unless it was the currently active one.
  if (button != activeButton)
  {
    depressButtonAtCursor(button,event,0,0);
    activeButton = button;
  }
  else
    activeButton = null;

  ajax_context_menu( contextObjType, contextObjId, cpos );
  return false;
}



function depressButton(button, xAdjust, yAdjust)
{
  // Update the button's style class to make it look like it's
  // depressed.
  button.className += " menuButtonActive";

  // Position the associated drop down menu under the button and
  // show it.
  var x = getAbsElementX(button);
  var y = getAbsElementY(button) + button.offsetHeight;

  if ( browser.isIE )
  {
    var potentialDivparent = getDivContainer( button );
    if ( potentialDivparent != null )
    {
//      if ( potentialDivparent.style.overflow == 'auto' )
//      {
//        button.menu.style.left = (x+parseInt(xAdjust) - getAbsElementX(potentialDivparent) ) + "px";
//        button.menu.style.top  = (y+parseInt(yAdjust) - getAbsElementY(potentialDivparent) ) + "px";
//      }
//      else
      {
        button.menu.style.left = (x+parseInt(xAdjust)) + "px";
        button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
      }
    }
    else
    {
      button.menu.style.left = (x+parseInt(xAdjust)) + "px";
      button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
    }
  }
  else
  {
    button.menu.style.left = (x+parseInt(xAdjust)) + "px";
    button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
  }
  button.menu.style.visibility = "visible";
  adjustiFrame( button.menu );
}

function depressButtonAtCursor(button, event, xAdjust, yAdjust)
{
  // Update the button's style class to make it look like it's
  // depressed.
  button.className += " menuButtonActive";

  // Position the associated drop down menu under the button and
  // show it.
  
  var x = event.clientX+document.body.scrollLeft;
  var y = event.clientY+document.body.scrollTop;

  if ( browser.isIE )
  {
    var potentialDivparent = getDivContainer( button );
    if ( potentialDivparent != null )
    {
//      if ( potentialDivparent.style.overflow == 'auto' )
//      {
//        button.menu.style.left = (x+parseInt(xAdjust) - getAbsElementX(potentialDivparent) ) + "px";
//        button.menu.style.top  = (y+parseInt(yAdjust) - getAbsElementY(potentialDivparent) ) + "px";
//      }
//      else
      {
        button.menu.style.left = (x+parseInt(xAdjust)) + "px";
        button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
      }
    }
    else
    {
      button.menu.style.left = (x+parseInt(xAdjust)) + "px";
      button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
    }
  }
  else
  {
    button.menu.style.left = (x+parseInt(xAdjust)) + "px";
    button.menu.style.top  = (y+parseInt(yAdjust)) + "px";
  }
  button.menu.style.visibility = "visible";
  adjustiFrame( button.menu );
}

function resetButton(button) {

  // Restore the button's style class.

  removeClassName(button, "menuButtonActive");

  // Hide the button's menu, first closing any sub menus.

  if (button.menu != null) {
    closeSubMenu(button.menu);
    button.menu.style.visibility = "hidden";
    adjustiFrame( button.menu );
  }
}

//----------------------------------------------------------------------------
// Code to handle the menus and sub menus.
//----------------------------------------------------------------------------

function menuMouseover(event) {

  var menu;

  // Find the target menu element.

  if (browser.isIE)
    menu = getContainerWith(window.event.srcElement, "DIV", "menu");
  else
    menu = event.currentTarget;

  // Close any active sub menu.

  if (menu.activeItem != null)
    closeSubMenu(menu);
}

var adjustiFrameMaxZIndex = 1000;
function adjustiFrame( menuDiv )
{
  if ( !browser.isIE )
  {
    adjustiFrameMaxZIndex = adjustiFrameMaxZIndex + 1;
    menuDiv.style.zIndex = adjustiFrameMaxZIndex;
    return;
  }

  iFrameDiv = document.getElementById("DivShim");
  var divParent = getDivContainer( menuDiv );
  if ( divParent != null )
  {
    iFrameDiv = document.getElementById("DivShim_"+divParent.getAttribute("id") );
    if ( iFrameDiv == null )
    {
      var iframeEl = document.createElement("IFRAME");
      iframeEl.id = 'DivShim_'+divParent.getAttribute("id");
      iframeEl.frameBorder = 0;
      iframeEl.src = "javascript:;";
      iframeEl.style.display = "none";
      iframeEl.style.position = "absolute";
      iframeEl.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
      divParent.appendChild(iframeEl);
    }
    iFrameDiv = document.getElementById("DivShim_"+divParent.getAttribute("id") );
    if ( iFrameDiv == null )
      return;
  }

  try {

    //
    // This is a workaround for the task contextmenu popup displaying
    // a box with "false" in in when the delete menu item is chosen.
    // This style is getting set back to null for some reason.
      
    if (menuDiv.id == "ajax_contextmenu_div") {
       if (menuDiv.style.display = null) {
          menuDiv.style.display = "block";
        } 
    }
  
  
    iFrameDiv.style.position = "absolute";
    iFrameDiv.style.width = menuDiv.offsetWidth;
    iFrameDiv.style.height = menuDiv.offsetHeight;
    iFrameDiv.style.top = menuDiv.style.top;
    iFrameDiv.style.left = menuDiv.style.left;
    iFrameDiv.style.visibility = menuDiv.style.visibility;
    iFrameDiv.style.display    = menuDiv.style.display;
    menuDiv.style.display="block";
    adjustiFrameMaxZIndex = adjustiFrameMaxZIndex + 1;
    menuDiv.style.zIndex = adjustiFrameMaxZIndex;
    iFrameDiv.style.zIndex = adjustiFrameMaxZIndex-1;
  }
  catch(e) {
  }
}

function closeSubMenu(menu) {

  if (menu == null || menu.activeItem == null)
    return;

  // Recursively close any sub menus.

  if (menu.activeItem.subMenu != null) {
    closeSubMenu(menu.activeItem.subMenu);
    menu.activeItem.subMenu.style.visibility = "hidden";
    menu.activeItem.subMenu = null;
  }
  removeClassName(menu.activeItem, "menuItemHighlight");
  menu.activeItem = null;
}

//----------------------------------------------------------------------------
// Code to initialize menus.
//----------------------------------------------------------------------------

function menuInit(menu) {

  var itemList, spanList;
  var textEl, arrowEl;
  var itemWidth;
  var w, dw;
  var i, j;

  // For IE, replace arrow characters.

  if (browser.isIE) {
    menu.style.lineHeight = "2.5ex";
    spanList = menu.getElementsByTagName("SPAN");
    for (i = 0; i < spanList.length; i++)
      if (hasClassName(spanList[i], "menuItemArrow")) {
        spanList[i].style.fontFamily = "Webdings";
        spanList[i].firstChild.nodeValue = "4";
      }
  }

  // Find the width of a menu item.

  itemList = menu.getElementsByTagName("A");
  if (itemList.length > 0)
    itemWidth = itemList[0].offsetWidth;
  else
    return;

  // For items with arrows, add padding to item text to make the
  // arrows flush right.

  for (i = 0; i < itemList.length; i++) {
    spanList = itemList[i].getElementsByTagName("SPAN");
    textEl  = null;
    arrowEl = null;
    for (j = 0; j < spanList.length; j++) {
      if (hasClassName(spanList[j], "menuItemText"))
        textEl = spanList[j];
      if (hasClassName(spanList[j], "menuItemArrow"))
        arrowEl = spanList[j];
    }
    if (textEl != null && arrowEl != null) {
      textEl.style.paddingRight = (itemWidth 
        - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
      // For Opera, remove the negative right margin to fix a display bug.
      if (browser.isOP)
        arrowEl.style.marginRight = "0px";
    }
  }

  // Fix IE hover problem by setting an explicit width on first item of
  // the menu.

  if (browser.isIE) {
    w = itemList[0].offsetWidth;
    itemList[0].style.width = w + "px";
    dw = itemList[0].offsetWidth - w;
    w -= dw;
    itemList[0].style.width = w + "px";
  }

  // Mark menu as initialized.
  menu.isInitialized = true;
}

//----------------------------------------------------------------------------
// General utility functions.
//----------------------------------------------------------------------------

function getDivContainer(node)
{
  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.
  node = node.parentNode;
  while (node != null)
  {
    if (node.tagName != null && ( node.tagName == "DIV" || node.tagName == "div" ) )
      return node;
    node = node.parentNode;
  }
  return null;
}

function getContainerWith(node, tagName, className) {

  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.
  while (node != null)
  {
    if (node.tagName != null && node.tagName == tagName && hasClassName(node, className))
      return node;
    node = node.parentNode;
  }

  return node;
}

function hasClassName(el, name) {

  var i, list;

  // Return true if the given element currently has the given class
  // name.
  list = el.className.split(" ");
  for (i = 0; i < list.length; i++)
    if (list[i] == name)
      return true;

  return false;
}

function removeClassName(el, name) {

  var i, curList, newList;

  if (el.className == null)
    return;

  // Remove the given class name from the element's className property.

  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++)
    if (curList[i] != name)
      newList.push(curList[i]);
  el.className = newList.join(" ");
}


/* =================================================================================================
 * TransMenu 
 * March, 2003
 * Customizable multi-level animated DHTML menus with transparency.
 * =================================================================================================
 * "Can I use this?"
 * 
 * Use of this library is governed by the Creative Commons Attribution 2.0 License. You can check it 
 * out at: http://creativecommons.org/licenses/by/2.0/
 *
 * Basically: You may copy, distribute, and eat this code as you wish. But you must give me credit 
 * for writing it. You may not misrepresent yourself as the author of this code.
 * =================================================================================================
 * "It's kinda hard to read, though"
 *
 * The uncompressed, commented version of this script can be found at: 
 * http://youngpup.net/projects/transMenus
 * ============================================================================================== */
TransMenu.spacerGif="graphics/z0.gif";
TransMenu.dingbatOn="graphics/z0.gif";
TransMenu.dingbatOff="graphics/z0.gif";
TransMenu.dingbatSize=14;
TransMenu.menuPadding=5;
TransMenu.itemPadding=3;
TransMenu.shadowSize=2;
TransMenu.shadowOffset=3;
TransMenu.shadowColor="#888888";
TransMenu.shadowPng="graphics/z0.png";
TransMenu.backgroundColor="#D0D0D0";
TransMenu.backgroundPng="img/white-90.png";
TransMenu.hideDelay=200;
TransMenu.slideTime=60;
TransMenu.reference={topLeft:1,topRight:2,bottomLeft:3,bottomRight:4};
TransMenu.direction={down:1,right:2};
TransMenu.registry=[];
TransMenu._maxZ=100;
TransMenu.isSupported=function()
{
  var ua=navigator.userAgent.toLowerCase();
  var pf=navigator.platform.toLowerCase();
  var an=navigator.appName;
  var r=false;
  if(ua.indexOf("gecko")>-1&&navigator.productSub>=20020605)r=true;
  else if(an=="Microsoft Internet Explorer")
  {
    if(document.getElementById)
    {
      if(pf.indexOf("mac")==0){r=/msie (\d(.\d*)?)/.test(ua)&&Number(RegExp.$1)>=5.1;}
      else r=true;
    }
  }
  return r;
}

TransMenu.initialize=function(){for(var i=0,menu=null;menu=this.registry[i];i++){menu.initialize();}}
TransMenu.renderAll=function(){var aMenuHtml=[];for(var i=0,menu=null;menu=this.registry[i];i++){aMenuHtml[i]=menu.toString();}
document.write(aMenuHtml.join(""));}
function TransMenu(oActuator,iDirection,iLeft,iTop,iReferencePoint,parentMenuSet){this.addItem=addItem;this.addMenu=addMenu;this.toString=toString;this.initialize=initialize;this.isOpen=false;this.show=show;this.hide=hide;this.items=[];this.onactivate=new Function();this.ondeactivate=new Function();this.onmouseover=new Function();this.onqueue=new Function();this.ondequeue=new Function();this.index=TransMenu.registry.length;TransMenu.registry[this.index]=this;var id="TransMenu"+this.index;var contentHeight=null;var contentWidth=null;var childMenuSet=null;var animating=false;var childMenus=[];var slideAccel=-1;var elmCache=null;var ready=false;var _this=this;var a=null;var pos=iDirection==TransMenu.direction.down?"top":"left";var dim=null;function addItem(sText,sUrl){var item=new TransMenuItem(sText,sUrl,this);item._index=this.items.length;this.items[item._index]=item;}
function addMenu(oMenuItem){if(!oMenuItem.parentMenu==this)throw new Error("Cannot add a menu here");if(childMenuSet==null)childMenuSet=new TransMenuSet(TransMenu.direction.right,-5,2,TransMenu.reference.topRight);var m=childMenuSet.addMenu(oMenuItem);childMenus[oMenuItem._index]=m;m.onmouseover=child_mouseover;m.ondeactivate=child_deactivate;m.onqueue=child_queue;m.ondequeue=child_dequeue;return m;}
function initialize(){initCache();initEvents();initSize();ready=true;}
function show(){if(ready){_this.isOpen=true;animating=true;setContainerPos();elmCache["clip"].style.visibility="visible";adjustiFrame( elmCache["clip"] );elmCache["clip"].style.zIndex=TransMenu._maxZ++;slideStart();_this.onactivate();}}
function hide(){if(ready){_this.isOpen=false;animating=true;for(var i=0,item=null;item=elmCache.item[i];i++)dehighlight(item);if(childMenuSet)childMenuSet.hide();slideStart();_this.ondeactivate();}}
function setContainerPos(){var sub=oActuator.constructor==TransMenuItem;var act=sub?oActuator.parentMenu.elmCache["item"][oActuator._index]:oActuator;var el=act;var x=0;var y=0;var minX=0;var maxX=(window.innerWidth?window.innerWidth:document.body.clientWidth)-parseInt(elmCache["clip"].style.width);var minY=0;var maxY=(window.innerHeight?window.innerHeight:document.body.clientHeight)-parseInt(elmCache["clip"].style.height);while(sub?el.parentNode.className.indexOf("transMenu")==-1:el.offsetParent){x+=el.offsetLeft;y+=el.offsetTop;if(el.scrollLeft)x-=el.scrollLeft;if(el.scrollTop)y-=el.scrollTop;el=el.offsetParent;}
if(oActuator.constructor==TransMenuItem){x+=parseInt(el.parentNode.style.left);y+=parseInt(el.parentNode.style.top);}
switch(iReferencePoint){case TransMenu.reference.topLeft:break;case TransMenu.reference.topRight:x+=act.offsetWidth;break;case TransMenu.reference.bottomLeft:y+=act.offsetHeight;break;case TransMenu.reference.bottomRight:x+=act.offsetWidth;y+=act.offsetHeight;break;}
x+=iLeft;y+=iTop;x=Math.max(Math.min(x,maxX),minX);y=Math.max(Math.min(y,maxY),minY);elmCache["clip"].style.left=x+"px";elmCache["clip"].style.top=y+"px";}
function slideStart(){var x0=parseInt(elmCache["content"].style[pos]);var x1=_this.isOpen?0:-dim;if(a!=null)a.stop();a=new Accelimation(x0,x1,TransMenu.slideTime,slideAccel);a.onframe=slideFrame;a.onend=slideEnd;a.start();}
function slideFrame(x){elmCache["content"].style[pos]=x+"px";}
function slideEnd(){if(!_this.isOpen)elmCache["clip"].style.visibility="hidden";adjustiFrame( elmCache["clip"] );animating=false;}
function initSize(){var ow=elmCache["items"].offsetWidth;var oh=elmCache["items"].offsetHeight;var ua=navigator.userAgent.toLowerCase();elmCache["clip"].style.width=ow+TransMenu.shadowSize+2+"px";elmCache["clip"].style.height=oh+TransMenu.shadowSize+2+"px";elmCache["content"].style.width=ow+TransMenu.shadowSize+"px";elmCache["content"].style.height=oh+TransMenu.shadowSize+"px";contentHeight=oh+TransMenu.shadowSize;contentWidth=ow+TransMenu.shadowSize;dim=iDirection==TransMenu.direction.down?contentHeight:contentWidth;elmCache["content"].style[pos]=-dim-TransMenu.shadowSize+"px";elmCache["clip"].style.visibility="hidden";adjustiFrame(elmCache["clip"]);if(ua.indexOf("mac")==-1||ua.indexOf("gecko")>-1){elmCache["background"].style.width=ow+"px";elmCache["background"].style.height=oh+"px";elmCache["background"].style.backgroundColor=TransMenu.backgroundColor;elmCache["shadowRight"].style.left=ow+"px";elmCache["shadowRight"].style.height=oh-(TransMenu.shadowOffset-TransMenu.shadowSize)+"px";elmCache["shadowRight"].style.backgroundColor=TransMenu.shadowColor;elmCache["shadowBottom"].style.top=oh+"px";elmCache["shadowBottom"].style.width=ow-TransMenu.shadowOffset+"px";elmCache["shadowBottom"].style.backgroundColor=TransMenu.shadowColor;}
else{elmCache["background"].firstChild.src=TransMenu.backgroundPng;elmCache["background"].firstChild.width=ow;elmCache["background"].firstChild.height=oh;elmCache["shadowRight"].firstChild.src=TransMenu.shadowPng;elmCache["shadowRight"].style.left=ow+"px";elmCache["shadowRight"].firstChild.width=TransMenu.shadowSize;elmCache["shadowRight"].firstChild.height=oh-(TransMenu.shadowOffset-TransMenu.shadowSize);elmCache["shadowBottom"].firstChild.src=TransMenu.shadowPng;elmCache["shadowBottom"].style.top=oh+"px";elmCache["shadowBottom"].firstChild.height=TransMenu.shadowSize;elmCache["shadowBottom"].firstChild.width=ow-TransMenu.shadowOffset;}}
function initCache(){var menu=document.getElementById(id);var all=menu.all?menu.all:menu.getElementsByTagName("*");elmCache={};elmCache["clip"]=menu;elmCache["item"]=[];for(var i=0,elm=null;elm=all[i];i++){switch(elm.className){case"items":case"content":case"background":case"shadowRight":case"shadowBottom":elmCache[elm.className]=elm;break;case"item":elm._index=elmCache["item"].length;elmCache["item"][elm._index]=elm;break;}}
_this.elmCache=elmCache;}
function initEvents(){for(var i=0,item=null;item=elmCache.item[i];i++){item.onmouseover=item_mouseover;item.onmouseout=item_mouseout;item.onclick=item_click;}
if(typeof oActuator.tagName!="undefined"){oActuator.onmouseover=actuator_mouseover;oActuator.onmouseout=actuator_mouseout;}
elmCache["content"].onmouseover=content_mouseover;elmCache["content"].onmouseout=content_mouseout;}
function highlight(oRow){oRow.className="item hover";if(childMenus[oRow._index])oRow.lastChild.firstChild.src=TransMenu.dingbatOn;}
function dehighlight(oRow){oRow.className="item";if(childMenus[oRow._index])oRow.lastChild.firstChild.src=TransMenu.dingbatOff;}
function item_mouseover(){if(!animating){highlight(this);if(childMenus[this._index])childMenuSet.showMenu(childMenus[this._index]);else if(childMenuSet)childMenuSet.hide();}}
function item_mouseout(){if(!animating){if(childMenus[this._index])childMenuSet.hideMenu(childMenus[this._index]);else dehighlight(this);}}
function item_click(){if(!animating){if(_this.items[this._index].url)location.href=_this.items[this._index].url;}}
function actuator_mouseover(){parentMenuSet.showMenu(_this);}
function actuator_mouseout(){parentMenuSet.hideMenu(_this);}
function content_mouseover(){if(!animating){parentMenuSet.showMenu(_this);_this.onmouseover();}}
function content_mouseout(){if(!animating){parentMenuSet.hideMenu(_this);}}
function child_mouseover(){if(!animating){parentMenuSet.showMenu(_this);}}
function child_deactivate(){for(var i=0;i<childMenus.length;i++){if(childMenus[i]==this){dehighlight(elmCache["item"][i]);break;}}}
function child_queue(){parentMenuSet.hideMenu(_this);}
function child_dequeue(){parentMenuSet.showMenu(_this);}
function toString(){var aHtml=[];var sClassName="transMenu"+(oActuator.constructor!=TransMenuItem?" top":"");for(var i=0,item=null;item=this.items[i];i++){aHtml[i]=item.toString(childMenus[i]);}
return'<div id="'+id+'" class="'+sClassName+'">'+'<div class="content"><table class="items" cellpadding="0" cellspacing="0" border="0">'+'<tr><td colspan="2"><img src="'+TransMenu.spacerGif+'" width="1" height="'+TransMenu.menuPadding+'"></td></tr>'+aHtml.join('')+'<tr><td colspan="2"><img src="'+TransMenu.spacerGif+'" width="1" height="'+TransMenu.menuPadding+'"></td></tr></table>'+'<div class="shadowBottom"><img src="'+TransMenu.spacerGif+'" width="1" height="1"></div>'+'<div class="shadowRight"><img src="'+TransMenu.spacerGif+'" width="1" height="1"></div>'+'<div class="background"><img src="'+TransMenu.spacerGif+'" width="1" height="1"></div>'+'</div></div>';}}
TransMenuSet.registry=[];function TransMenuSet(iDirection,iLeft,iTop,iReferencePoint){this.addMenu=addMenu;this.showMenu=showMenu;this.hideMenu=hideMenu;this.hide=hide;this.hideCurrent=hideCurrent;var menus=[];var _this=this;var current=null;this.index=TransMenuSet.registry.length;TransMenuSet.registry[this.index]=this;function addMenu(oActuator){var m=new TransMenu(oActuator,iDirection,iLeft,iTop,iReferencePoint,this);menus[menus.length]=m;return m;}
function showMenu(oMenu){if(oMenu!=current){if(current!=null)hide(current);current=oMenu;oMenu.show();}
else{cancelHide(oMenu);}}
function hideMenu(oMenu){if(current==oMenu&&oMenu.isOpen){if(!oMenu.hideTimer)scheduleHide(oMenu);}}
function scheduleHide(oMenu){oMenu.onqueue();oMenu.hideTimer=window.setTimeout("TransMenuSet.registry["+_this.index+"].hide(TransMenu.registry["+oMenu.index+"])",TransMenu.hideDelay);}
function cancelHide(oMenu){if(oMenu.hideTimer){oMenu.ondequeue();window.clearTimeout(oMenu.hideTimer);oMenu.hideTimer=null;}}
function hide(oMenu){if(!oMenu&&current)oMenu=current;if(oMenu&&current==oMenu&&oMenu.isOpen){hideCurrent();}}
function hideCurrent(){if (null != current){cancelHide(current);current.hideTimer=null;current.hide();current=null;}}}
function TransMenuItem(sText,sUrl,oParent){this.toString=toString;this.text=sText;this.url=sUrl;this.parentMenu=oParent;function toString(bDingbat){var sDingbat=bDingbat?TransMenu.dingbatOff:TransMenu.spacerGif;var iEdgePadding=TransMenu.itemPadding+TransMenu.menuPadding;var sPaddingLeft="padding:"+TransMenu.itemPadding+"px; padding-left:"+iEdgePadding+"px;"
var sPaddingRight="padding:"+TransMenu.itemPadding+"px; padding-right:"+iEdgePadding+"px;"
return'<tr class="item"><td nowrap style="'+sPaddingLeft+'">'+sText+'</td><td width="14" style="'+sPaddingRight+'">'+'<img src="'+sDingbat+'" width="14" height="14"></td></tr>';}}
function Accelimation(from,to,time,zip){if(typeof zip=="undefined")zip=0;if(typeof unit=="undefined")unit="px";this.x0=from;this.x1=to;this.dt=time;this.zip=-zip;this.unit=unit;this.timer=null;this.onend=new Function();this.onframe=new Function();}
Accelimation.prototype.start=function(){this.t0=new Date().getTime();this.t1=this.t0+this.dt;var dx=this.x1-this.x0;this.c1=this.x0+((1+this.zip)*dx/3);this.c2=this.x0+((2+this.zip)*dx/3);Accelimation._add(this);}
Accelimation.prototype.stop=function(){Accelimation._remove(this);}
Accelimation.prototype._paint=function(time){if(time<this.t1){var elapsed=time-this.t0;this.onframe(Accelimation._getBezier(elapsed/this.dt,this.x0,this.x1,this.c1,this.c2));}
else this._end();}
Accelimation.prototype._end=function(){Accelimation._remove(this);this.onframe(this.x1);this.onend();}
Accelimation._add=function(o){var index=this.instances.length;this.instances[index]=o;if(this.instances.length==1){this.timerID=window.setInterval("Accelimation._paintAll()",this.targetRes);}}
Accelimation._remove=function(o){for(var i=0;i<this.instances.length;i++){if(o==this.instances[i]){this.instances=this.instances.slice(0,i).concat(this.instances.slice(i+1));break;}}
if(this.instances.length==0){window.clearInterval(this.timerID);this.timerID=null;}}
Accelimation._paintAll=function(){var now=new Date().getTime();for(var i=0;i<this.instances.length;i++){this.instances[i]._paint(now);}}

Accelimation._B1=function(t){return t*t*t}
Accelimation._B2=function(t){return 3*t*t*(1-t)}
Accelimation._B3=function(t){return 3*t*(1-t)*(1-t)}
Accelimation._B4=function(t){return(1-t)*(1-t)*(1-t)}

Accelimation._getBezier=function(percent,startPos,endPos,control1,control2)
{
  return endPos*this._B1(percent)+control2*this._B2(percent)+control1*this._B3(percent)+startPos*this._B4(percent);
}
Accelimation.instances=[];
Accelimation.targetRes=10;
Accelimation.timerID=null;

if(window.attachEvent)
{
  var cearElementProps=['data','onmouseover','onmouseout','onmousedown','onmouseup','ondblclick','onclick','onselectstart','oncontextmenu'];
  window.attachEvent("onunload", function() {var el;for(var d=document.all.length;d--;){el=document.all[d];for(var c=cearElementProps.length;c--;){el[cearElementProps[c]] = null;}}});
}

var __gTmp = '';
var __baseScreenReloadSpecialBranch = 0;

function emulateEventHandlers(eventNames) {
   for (var i = 0; i < eventNames.length; i++) {        
      document.addEventListener(eventNames[i], function (e) {
         window.event = e;
      }, true); // using capture
   }
}

ua = navigator.userAgent;
if ( ua.indexOf("Netscape") > 0 || ua.indexOf("Gecko") > 0 )
{
   emulateEventHandlers(["click", "mousemove", "mouseover"]);
}

function URLEncode( plaintext )
{
  // The Javascript escape and unescape functions do not correspond
  // with what browsers actually do...
  var SAFECHARS = "0123456789" +                                  // Numeric
                                        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +  // Alphabetic
                                        "abcdefghijklmnopqrstuvwxyz" +
                                        "-_.!~*'()";                                    // RFC2396 Mark characters
  var HEX = "0123456789ABCDEF";
  var encoded = "";
  for (var i = 0; i < plaintext.length; i++ )
  {
    var ch = plaintext.charAt(i);
    if (ch == " ") {
                    encoded += "+";                             // x-www-urlencoded, rather than %20
    } else if (SAFECHARS.indexOf(ch) != -1) {
                    encoded += ch;
    } else {
                    var charCode = ch.charCodeAt(0);
                        if (charCode > 255) {
                            alert( "Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" +
                                        "(URL encoding only supports 8-bit characters.)\n" +
                                                "A space (+) will be substituted." );
                                encoded += "+";
                        } else {
                                encoded += "%";
                                encoded += HEX.charAt((charCode >> 4) & 0xF);
                                encoded += HEX.charAt(charCode & 0xF);
                        }
    }
  } // for

  return encoded;
};

function URLDecode( encoded )
{
   // Replace %xx with equivalent character
   var plaintext = "";
   var i = 0;
   while (i < (encoded.length-2))
   {
     var ch = encoded.charAt(i);
     if (ch == "+") {
               plaintext += " ";
                   i++;
     }
     else if (ch == "%" && encoded.charAt(i+1) != "%") {
       plaintext += unescape( encoded.substr(i,3) );
       i += 3;
     }
     else if (ch == "&" && encoded.charAt(i+1) == "#" && encoded.charAt(i+2) == "3" && encoded.charAt(i+3) == "4" && encoded.charAt(i+4) == ";")
     {
       plaintext += unescape( "%22" );
       i += 5;
     }
     else if (ch == "&" && encoded.charAt(i+1) == "#" && encoded.charAt(i+2) == "3" && encoded.charAt(i+3) == "9" && encoded.charAt(i+4) == ";")
     {
       plaintext += unescape( "%27" );
       i += 5;
     }
     else if (ch == "&" && encoded.charAt(i+1) == "#" && encoded.charAt(i+2) == "6" && encoded.charAt(i+3) == "0" && encoded.charAt(i+4) == ";")
     {
       plaintext += unescape( "%3C" );
       i += 5;
     }
     else if (ch == "&" && encoded.charAt(i+1) == "#" && encoded.charAt(i+2) == "1" && encoded.charAt(i+3) == "0" && encoded.charAt(i+4) == ";")
     {
       plaintext += unescape( "%0A" );
       i += 5;
     }
     else if (ch == "&" && encoded.charAt(i+1) == "#" && encoded.charAt(i+2) == "1" && encoded.charAt(i+3) == "3" && encoded.charAt(i+4) == ";")
     {
       plaintext += unescape( "%0D" );
       i += 5;
     }
     else {
       plaintext += ch;
       i++;
     }
   } // while
   if (i < encoded.length) {
            plaintext += encoded.substr(i,encoded.length-i);
   }
   return unescape(plaintext);
};

function floor(number)
{
  return Math.floor(number*Math.pow(10,2))/Math.pow(10,2);
} 
    
function markDirty(frm, elm, val)
{
  document.forms[frm].elements[elm].value=val;
}

function MM_goToURL() { //v3.0
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var popWin = window.open(theURL,winName,features);
  popWin.opener = self;
  popWin.focus();
}

function ozPopupTiny(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=400,height=300,scrollbars=yes,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function ozPopupMid(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=500,height=400,scrollbars=yes,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function ozPopup(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=760,height=540,scrollbars=yes,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWindow(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=720,height=540,scrollbars=yes,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWin2(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=880,height=680,scrollbars=yes,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWin2WMenu(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=900,height=720,scrollbars=yes,menubar=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWin3(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=10,top=10,width=960,height=700,scrollbars=yes,menubar=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWin4(theURL,winName) { //v2.0
  var popWin = window.open(theURL,winName,'left=100,top=60,width=880,height=560,resizable=yes');
  popWin.opener = self;
  popWin.focus();
}

function OZ_openBrWin5(theURL,winName) { // full screen
  var w = window.screen.availWidth;
  var h = window.screen.availHeight;
  var popWin = window.open(theURL,winName,' screenX=0,screenY=0,left=0,top=0,width='+w+',height='+h+',resizable=1,scrollbars=yes');
  popWin.opener = self;
  popWin.focus();
}

function MM_jumpMenu(targ,selObj,restore)
{
  var selValue = selObj.options[selObj.selectedIndex].value;
  if ( selValue.startswith( "javascript", 0, 10 ) )
    eval( selValue.substring(11) );  // javascript:
  else
  {
    eval(targ+".location='"+selValue+"'");
    if (restore) selObj.selectedIndex=0;
  }
}

function MM_jumpMenu2(targ,selObj,restore)
{
  var s = selObj.options[selObj.selectedIndex].value;
  if ( s.substring(0,1) != '_' )
  {
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  }
  else
  {
    s = s.substring(1, s.length);
    eval( s );
  }
}

 // This method Added by siva for dropdown functionality in Calendar.

function MM_jumpMenu3(targ,selObj,uvalue,restore)
{
  var s = selObj.options[selObj.selectedIndex].value;
  var u = uvalue.options[uvalue.selectedIndex].value;
  if ( s.substring(0,1) != '_' && u.substring(0,1) != '_' )
  {
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"&userview="+uvalue.options[uvalue.selectedIndex].value+"'");
  }
  else
  {
    s = s.substring(1, s.length);
    eval( s );
  }
}

function MM_setSelObj( selObj, tgtVal )
{
  for (i=0; i<selObj.options.length; i++)
  {
    if ( selObj.options[i].value == tgtVal )
      selObj.selectedIndex = i;
  }
}

function MM_getSelObjValue( selObjId )
{
  return $(selObjId).options[$(selObjId).selectedIndex].value;
}

function handleKeyPressReturnUnfocus( e, obj )
{
  var key=e.keyCode || e.which;
  if (key==13) { obj.blur(); return false; }
}
function handleKeyPressExecFunc( e, func, arg )
{
  var key=e.keyCode || e.which;
  if (key==13) { 
  	func(arg); 
  	return false; 
  	}
}

function openLovPopup(fileName, lovName, formName, elmtName)
{
  var paramVal = document.forms[formName].elements[elmtName].value;
  var param = "?paramValue=" + paramVal;

  var lovWin = window.open( fileName + param, lovName, 'width=720,height=500,scrollbars=yes');
    lovWin.opener = self;
    lovWin.focus();
}

function openLovPopupWParam(fileName, lovName, formName, elmtName)
{
  var paramVal = document.forms[formName].elements[elmtName].value;
  var param = "&paramValue=" + paramVal;

  var lovWin = window.open( fileName + param, lovName, 'width=720,height=500,scrollbars=yes');
    lovWin.opener = self;
    lovWin.focus();
}

var openCalV2FieldID;
var openCalV2FormID;
var _openCalV = 2;
function openCalV2( formname, fieldid )
{
  openCalV2FormID  = formname;
  openCalV2FieldID = fieldid;
  _openCalV = 2;
  opencal2( document.forms[openCalV2FormID].elements[openCalV2FieldID].value );
}
var _gOpenCalV4Str;
function acceptDateV2(dayStr)
{
  if ( _openCalV == 2 )
    document.forms[openCalV2FormID].elements[openCalV2FieldID].value = dayStr;

  else if ( _openCalV == 3 )
  {
    $(openCalV3FieldID).value = dayStr;
  }
  else if ( _openCalV == '3WITHPOST' )
  {
    $(openCalV3FieldID).value = dayStr;
    openCalV3Post();
  }
  else if ( _openCalV.startswith( "4", 0, 1 ) )
  {
    $(openCalV3FieldID).value = dayStr;
    _gOpenCalV4Str = _openCalV.substring(1);
    setTimeout('gOpenCalV4Call()',10);
  }
}
function gOpenCalV4Call()
{
    eval( _gOpenCalV4Str );
}

var openCalV3FieldID;
function openCalV3( fieldid )
{
  openCalV3FieldID = fieldid;
  _openCalV = 3;
  opencal2( $(fieldid).value );
}
function openCalV3WithPost( fieldid )
{
  openCalV3FieldID = fieldid;
  _openCalV = '3WITHPOST';
  opencal2( $(fieldid).value );
}
function openCalV4( fieldid, advJS )
{
  openCalV3FieldID = fieldid;
  _openCalV = '4'+advJS;
  opencal2( $(fieldid).value );
}


function getBrowserSizeX() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  }
  else
  {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    }
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
      myWidth = document.body.clientWidth;
    }
  }
  return myWidth;
}

function getBrowserSizeY() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  }
  else
  {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
      myHeight = document.body.clientHeight;
    }
  }
  return myHeight;
}

function Toggle(item) {
   //added by janet 2005.11.7 ---begin
   var max=item+"_max";
   var min=item+"_min";
   objMax=document.getElementById(max);
   objMin=document.getElementById(min);
   //added by janet 2005.11.7 ---end
   obj=document.getElementById(item);

   visible=(obj.style.display!="none")  
   if (visible) {
     obj.style.display="none";
     //added by janet 2005.11.7 ---begin
     if ( objMax != null ) objMax.style.display="block";
     if ( objMin != null ) objMin.style.display="none";
     //added by janet 2005.11.7 ---end
   } else {
     obj.style.display="block";
     //added by janet 2005.11.7 ---begin
     if ( objMax != null ) objMax.style.display="none";
     if ( objMin != null ) objMin.style.display="block";
     //added by janet 2005.11.7 ---end
   }
}
function ToggleSet(item,val) {
   obj=document.getElementById(item);
   obj.style.display=val;
}

var _gToggleSetSlideShowItemId;
var _gToggleSetSlideShowItemHeight;
function ToggleSetSlideShow(itemid)
{
  _gToggleSetSlideShowItemId = itemid;
  _gToggleSetSlideShowItemHeight = 1;
  $(_gToggleSetSlideShowItemId).style.display='block';
  $(_gToggleSetSlideShowItemId).style.height ='1px';
  var timer = window.setTimeout( 'ToggleSetSlideShowAction()', 20 );
}
function ToggleSetSlideShowAction()
{
  _gToggleSetSlideShowItemHeight = _gToggleSetSlideShowItemHeight + 2;
  if ( _gToggleSetSlideShowItemId.substring(0,7) == 'PKGMENU' )
  {
    if ( _gToggleSetSlideShowItemHeight <= 32 )
    {
      $(_gToggleSetSlideShowItemId).style.height = _gToggleSetSlideShowItemHeight + "px";
      var timer = window.setTimeout( 'ToggleSetSlideShowAction()', 20 );
    }
  }
  else
  {
    if ( _gToggleSetSlideShowItemHeight <= 16 )
    {
      $(_gToggleSetSlideShowItemId).style.height = _gToggleSetSlideShowItemHeight + "px";
      var timer = window.setTimeout( 'ToggleSetSlideShowAction()', 30 );
    }
  }
}

var IFrameObj; // our IFrame object
var _backgroundURL;
function jsCallToServer(backgroundURL)
{
  if (!document.createElement)
  {
    return true;
  }
  
  var IFrameDoc;
  _backgroundURL =  backgroundURL;
  if (!IFrameObj && document.createElement)
  {
    // create the IFrame and assign a reference to the object to our global variable IFrameObj.
    // this will only happen the first time callToServer() is called
    try
    {
               var tempIFrame=document.createElement('iframe');
               tempIFrame.setAttribute('id','RSIFrame');
               tempIFrame.src='z0.jsp';
               tempIFrame.style.border='0px';
               tempIFrame.style.width='0px';
               tempIFrame.style.height='0px';
               IFrameObj = document.body.appendChild(tempIFrame);
               
               if (document.frames)
               {// this is for IE5 Mac, because it will only allow access to the document object
               // of the IFrame if we access it through the document.frames array
                    IFrameObj = document.frames['RSIFrame'];
               }
    }
    catch(exception)
    {
        // This is for IE5 PC, which doesn't allow dynamic creation/manipulation of iframe object.
               // Instead, we'll fake it up by creating our own objects.
               iframeHTML='\<iframe id="RSIFrame" src="z0.jsp" style="';
               iframeHTML+='border:0px;';
               iframeHTML+='width:0px;';
               iframeHTML+='height:0px;';
               iframeHTML+='"><\/iframe>';
               document.body.innerHTML+=iframeHTML;
               IFrameObj = new Object();
               IFrameObj.document = new Object();
               IFrameObj.document.location = new Object();
               IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
               IFrameObj.document.location.replace = function(location) {this.iframe.src = location;}
    }
  }          


  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument)
  {
    // we have to give NS6 a fraction of a second
    // to recognize the new IFrame
    setTimeout('jsCallToServer()',10);
    return false;
  }
 
  if (IFrameObj.contentDocument)
  {     // For NS6
          IFrameDoc = IFrameObj.contentDocument;
  }
  else if (IFrameObj.contentWindow)
  {     // For IE5.5 and IE6
          IFrameDoc = IFrameObj.contentWindow.document;
  }
  else if (IFrameObj.document)
  {     // For IE5
           IFrameDoc = IFrameObj.document;
  }
  else
  {
          return true;
  }
 
  IFrameDoc.location.replace(_backgroundURL);
  return false;
}

function ToggleAndSubmit(item, divid) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")  
   if (visible)
   {
     obj.style.display="none";
     backgroundURL = 'ozCmnHideShow.jsp?id='+divid+'&action=none';
   }
   else
   {
     obj.style.display="block";
     backgroundURL = 'ozCmnHideShow.jsp?id='+divid+'&action=block';
   }
   
   jsCallToServer( backgroundURL );
}

function submitQuickAmountNonInventory( oppId )
{
    var oppQuickAmountNonInventory = document.getElementById( 'oppQuickAmountNonInventory' ).value;
    if( oppQuickAmountNonInventory <= 0.0 )
      alert ( 'You have to put in a positive numeric value.' );
    else
      document.location = 'ozSlsOppPln.jsp?id='+oppId+'&ac=submitQuickAmountNonInventory&quickAmountNonInventory='+oppQuickAmountNonInventory;
}

function limit2dec(val)
{
    if (val == 0) return ("0");
    if (val == "") return ("");
    var inputVal = ("" + val);
    if (inputVal.indexOf(".") == -1) inputVal+=".000000";
    else                             inputVal+="000000";
    var decPart = inputVal.substring(0,inputVal.indexOf("."));
    var fracPart = inputVal.substring(inputVal.indexOf(".")+1,inputVal.indexOf(".")+3);
    var dec3Part=parseInt(inputVal.substring(inputVal.indexOf(".")+3,inputVal.indexOf(".")+4));
    if ((dec3Part >= 5))
    {
      if(parseFloat(fracPart)== 99)
      {
        fracPart = "00";
        if(parseFloat(decPart)>=0) decPart  =  ""+ (parseFloat(decPart) + 1);
        else decPart  =  ""+ (parseFloat(decPart) - 1);
      }
      else
      {
        var tmp = parseFloat( fracPart ) + 1;
        if ( tmp < 10 )        fracPart = "0"+tmp;
        else                   fracPart = ""+tmp;
      }
    }
    return ("" + decPart + "." + fracPart);
}


function gen_sidebar_adjust_timeline()
{
  if ( $('gen_ui_helper_div') != null )
  {
    for ( i=0; i< $('gen_ui_helper_div').childNodes.length; i++ )
    {
      try {
        var currentElementChild=$('gen_ui_helper_div').childNodes[i];
        var tmpDivId = currentElementChild.getAttribute("nodeid");
        if ( tmpDivId!=null && tmpDivId.length > 8 && ( tmpDivId.substring(0,8)=='TSK_HST_' || tmpDivId.substring(0,8)=='BUG_HST_' ) )
        {
          gen_sidebar_adjust_timeline_position( currentElementChild );
        }
      }
      catch(ee) { }
    }
  }
}
function gen_cmp_adjust_timeline_position()
{
  if ( $('gen_ui_helper_div') != null )
  {
    for ( i=0; i< $('gen_ui_helper_div').childNodes.length; i++ )
    {
      try {
        var currentElementChild=$('gen_ui_helper_div').childNodes[i];
        var tmpDivId = currentElementChild.getAttribute("nodeid");
        if ( tmpDivId!=null && tmpDivId.length > 8 && tmpDivId.substring(0,8)=='CSH_HST_' )
        {
          gen_sidebar_adjust_timeline_position( currentElementChild );
        }
      }
      catch(ee) { }
    }
  }
}
function gen_sidebar_adjust_timeline_position( node )
{
  var posX = getAbsElementXById( 'TIMELINE_MAINLINE' );
  var posY = getAbsElementYById( 'TIMELINE_MAINLINE' );

  var offsetx = node.getAttribute("offsetx");
  node.style.position = "absolute";
  node.style.top  = "40px";
  node.style.left = (parseInt(offsetx)+6)  + "px";
}
function gen_sidebar_adjust_timeline_viewdtl( id, nodetype, nodeid )
{
  SimpleAJAXCall ( 'xhpCaseSideDtl.jsp'+genappend_submiturl+'&id='+id+'&sbtype=TIMELINEDTL&nodetype='+nodetype+'&nodeid='+nodeid, gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_viewbugdtl( id, nodetype, nodeid )
{
  SimpleAJAXCall ( 'xhpBugSideDtl.jsp'+genappend_submiturl+'&id='+id+'&sbtype=TIMELINEDTL&nodetype='+nodetype+'&nodeid='+nodeid, gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_vieworgdtl( id, nodetype, nodeid )
{
  SimpleAJAXCall ( 'xhpOrgSideDtl.jsp'+genappend_submiturl+'&id='+id+'&sbtype=TIMELINEDTL&nodetype='+nodetype+'&nodeid='+nodeid, gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_viewpsndtl( id, nodetype, nodeid )
{
  SimpleAJAXCall ( 'xhpPsnSideDtl.jsp'+genappend_submiturl+'&id='+id+'&sbtype=TIMELINEDTL&nodetype='+nodetype+'&nodeid='+nodeid, gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_viewoppdtl( id, nodetype, nodeid )
{
  SimpleAJAXCall ( 'xhpOppSideDtl.jsp'+genappend_submiturl+'&id='+id+'&sbtype=TIMELINEDTL&nodetype='+nodetype+'&nodeid='+nodeid, gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_viewcshdtl( csid )
{
  SimpleAJAXCall ( 'xhpCmpGetData.jsp'+genappend_submiturl+'&csid='+csid+'&act=TIMELINEDTL', gen_sidebar_adjust_timeline_viewdtl_refresh, 'POST', '' );
}
function gen_sidebar_adjust_timeline_viewdtl_refresh( in_responseText, in_param )
{
  $('divTimelineDtl').innerHTML = in_responseText; 
}




function insertAtCursor(myField, myValue)
{
  //IE support
  if (browser.isIE)
  {
    myField.focus();
    var sel = document.selection.createRange();
    sel.text = myValue;
    var dummy=myField.createTextRange();
    dummy.findText( myValue );
    dummy.select();
  }
  //MOZILLA/NETSCAPE support
  else if ( browser.isNS )
  {
    myField.focus();
    var startPos = myField.selectionStart;
    var oldLength = myField.value.length;
    if ( oldLength > 0 )
      myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring( startPos, oldLength );
    else
      myField.value = myValue;
    myField.setSelectionRange(startPos, startPos + myValue.length );
  }
  else {
    myField.value += myValue;
  }
}

function insertAtCursor2(myField, myValue)
{
  //IE support
  if (browser.isIE)
  {
    myField.focus();
    var sel = document.selection.createRange();
    sel.text = myValue;
  }
  //MOZILLA/NETSCAPE support
  else if ( browser.isNS )
  {
    myField.focus();
    var startPos = myField.selectionStart;
    var oldLength = myField.value.length;
    if ( oldLength > 0 )
      myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring( startPos, oldLength );
    else
      myField.value = myValue;
  }
  else {
    myField.value += myValue;
  }
}

function getAbsElementYById(elmtId)
{
  var element = document.getElementById( elmtId );
  if ( element!=null ) return getAbsElementY( element );
  else                 return 0;
}
function getAbsElementXById(elmtId)
{
  var element = document.getElementById( elmtId );
  if ( element!=null ) return getAbsElementX( element );
  else                 return 0;
}
function getAbsElementY(element){
  var targetTop = 0;
  if (element.offsetParent) {
    while (element.offsetParent) {
      targetTop += element.offsetTop;
      element = element.offsetParent;
    }
  } else if (element.y) {
    targetTop += element.y;
  }
  return targetTop;
}
function getAbsElementX(element){
  var targetLeft = 0;
  if (element.offsetParent) {
    while (element.offsetParent) {
      targetLeft += element.offsetLeft;
      element = element.offsetParent;
    }
  } else if (element.x) {
    targetLeft += element.yx;
  }
  return targetLeft;
}

function getPositionYRelativeToDiv(element){
  var targetTop = 0;
  if (element.offsetParent) {
    while (element.offsetParent)
    {
      elementOffsetParent = element.offsetParent;
      if ( elementOffsetParent.tagName != null && ( elementOffsetParent.tagName == "DIV" || elementOffsetParent.tagName == "div" ) )
      {
        targetTop += element.offsetTop;
        break;
      }
      targetTop += element.offsetTop;
      element = elementOffsetParent;
    }
  } else if (element.y) {
    targetTop += element.y;
  }
  return targetTop;
}

function getPositionXRelativeToDiv(element){
  var targetLeft = 0;
  if (element.offsetParent) {
    while (element.offsetParent)
    {
      elementOffsetParent = element.offsetParent;
      if ( elementOffsetParent.tagName != null && ( elementOffsetParent.tagName == "DIV" || elementOffsetParent.tagName == "div" ) )
      {
        targetLeft += element.offsetLeft;
        break;
      }
      targetLeft += element.offsetLeft;
      element = elementOffsetParent;
    }
  } else if (element.x) {
    targetLeft += element.x;
  }
  return targetLeft;
}


// 10/2006: we do AJAX Queues now.
var __ajaxJobQueue = [];    // MAIN QUEUE: only one per page.
function ajaxJob() {
  this._submitUrl    = "";
  this._callbackFunc = null;
  this._callbackFuncParam = "";
}
function postXmlHttp( submitUrl, callbackFunc )
{
  var newJob = new ajaxJob();
  newJob._submitUrl    = submitUrl;
  newJob._callbackFunc      = callbackFunc;
  newJob._callbackFuncParam = "";
  __ajaxJobQueue.push( newJob );
  
  postXmlHttpRun();
}

var _postXmlHttpProcessPostChangeCallBack;
var _postXmlHttpProcessPostChangeCallBackParam = '';
var _xmlHttpRequestObj;
var __ajaxJobQueueRunning = 0;
function postXmlHttpRun()
{
  if ( __ajaxJobQueueRunning == 1 )
    return;

  if ( __ajaxJobQueue.length == 0 ) 
    return;

  __ajaxJobQueueRunning = 1;
  var ajaxJob = __ajaxJobQueue.shift();  // get the first job in the queue
  submitUrl    = ajaxJob._submitUrl;
  callbackFunc = ajaxJob._callbackFunc;

  _postXmlHttpProcessPostChangeCallBack = callbackFunc;
  try {
    _postXmlHttpProcessPostChangeCallBackParam = ajaxJob._callbackFuncParam;
  }
  catch (Exception) { _postXmlHttpProcessPostChangeCallBackParam = ""; };

  if(window.createRequest)
  {
    try{
      _xmlHttpRequestObj=window.createRequest();
      _xmlHttpRequestObj.open('POST',submitUrl,true);
      _xmlHttpRequestObj.onreadystatechange=postXmlHttpProcessPostChange;
      _xmlHttpRequestObj.send();
    }
    catch(ee){}
  }
  else if(window.XMLHttpRequest)
  {
    _xmlHttpRequestObj=new XMLHttpRequest();
//    _xmlHttpRequestObj.overrideMimeType('text/xml');
    _xmlHttpRequestObj.open('POST',submitUrl,true);
    _xmlHttpRequestObj.onreadystatechange=postXmlHttpProcessPostChange;
    _xmlHttpRequestObj.send("");
  }
  else if(window.ActiveXObject)
  {
    _xmlHttpRequestObj=new ActiveXObject("Microsoft.XMLHTTP");
    _xmlHttpRequestObj.open('POST',submitUrl,true);
    _xmlHttpRequestObj.onreadystatechange=postXmlHttpProcessPostChange;
    _xmlHttpRequestObj.send();
  }
};

function postXmlHttpProcessPostChange( )
{
  if( _xmlHttpRequestObj.readyState==4 && _xmlHttpRequestObj.status==200 )
  {
    setTimeout( _postXmlHttpProcessPostChangeCallBack, 10 );
    __ajaxJobQueueRunning = 0;
    setTimeout( postXmlHttpRun, 80 );
  }
}

function ebjs_debug( txt )
{
  document.getElementById( 'jsdebugpanel' ).innerHTML = document.getElementById( 'jsdebugpanel' ).innerHTML + ' ' + txt;
}

function ajax_getFormValues(fobj,valFunc)  // valFunc should pass in 'validate'
{
  var str = "";
  var valueArr = null;
  var val = "";
  var cmd = "";

  for(var i = 0;i < fobj.elements.length;i++)
  {
    switch(fobj.elements[i].type)
    {
      case "text":
        if(valFunc)
        {
          //use single quotes for argument so that the value of
          //fobj.elements[i].value is treated as a string not a literal
          cmd = valFunc + "(" + 'fobj.elements[i].value' + ")";
          val = eval(cmd)
        }

        str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
        break;

      case "select-one":
        str += fobj.elements[i].name + "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&";
        break;
      
      default:
        str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
        break;
    }
  }
  str = str.substr(0,(str.length - 1));
  return str;
}

function sidebar_postit_addnote( submitUrl, formName )
{
  submitUrl = submitUrl + '&note=' + unescape ( escape( $( formName+'_sidebar_postit_content').value ) );
  postXmlHttp( submitUrl, 'refreshSidebarPostit()' );
  $( formName+'_sidebar_postit_content').value = '';
}
function sidebar_compass_prev( submitUrl )
{
  submitUrl = submitUrl + '&nav=PREV&day=' + escape( document.forms['sidebar_fc_compass_form'].elements['daykey'].value );
  postXmlHttp( submitUrl, 'refreshCompassContent()' );
}
function sidebar_compass_next( submitUrl )
{
  submitUrl = submitUrl + '&nav=NEXT&day=' + escape( document.forms['sidebar_fc_compass_form'].elements['daykey'].value );
  postXmlHttp( submitUrl, 'refreshCompassContent()' );
}
function sidebar_compass_reload( submitUrl )
{
  submitUrl = submitUrl + '&nav=RELOAD&day=' + escape( document.forms['sidebar_fc_compass_form'].elements['daykey'].value );
  postXmlHttp( submitUrl, 'refreshCompassContent()' );
}
function sidebar_goal_reload( submitUrl )
{
  submitUrl = submitUrl + '&nav=RELOAD';
  postXmlHttp( submitUrl, 'refreshGoalContent()' );
}
function fc_compass_dragdrop( submitUrl )
{
  postXmlHttp( submitUrl, 'ozReload()' );
}
function hotlist_add_entry( submitUrl )
{
  postXmlHttp( submitUrl, 'refreshHotList()' );
}
function salesteam_user_add( submitUrl, userIds )
{
  postXmlHttp( submitUrl+'&uids='+userIds, 'refreshSalesTeam()' );
}
function salesteam_group_add( submitUrl, ugid )
{
  postXmlHttp( submitUrl+'&ugid='+ugid, 'refreshSalesTeam()' );
}
function fc_new_appointment( submitUrl, daystr, apptName, timeSlotId )
{
  fcCalRefreshInProgress = 1;
  postXmlHttp( submitUrl+'&daystr='+daystr+'&tsid='+timeSlotId+'&apptname='+escape(apptName), 'refreshFcApptList()' );
}

function ppolRefreshDailyNotes()
{
  var refreshDiv = document.getElementById('fcDailyNotes');
  if ( refreshDiv != null && _xmlHttpRequestObj.responseText.length>100 )
    refreshDiv.innerHTML = _xmlHttpRequestObj.responseText; 
  fcCalRefreshInProgress = 0;
}
  
function refreshHotList()
{
  var hotlist_content = document.getElementById('sidebar_hotlist_content');
  if ( hotlist_content != null )
    hotlist_content.innerHTML = _xmlHttpRequestObj.responseText; 
  hotlist_content = document.getElementById('topbar_hotlist_content');
  if ( hotlist_content != null )
    hotlist_content.innerHTML = _xmlHttpRequestObj.responseText; 
}

function refreshSidebarPostit()
{
  var postit_content = document.getElementById('sidebar_postit_today_content');
  if ( postit_content != null )
    postit_content.innerHTML = _xmlHttpRequestObj.responseText; 
  postit_content = document.getElementById('topbar_postit_today_content');
  if ( postit_content != null )
    postit_content.innerHTML = _xmlHttpRequestObj.responseText; 
}

function refreshSalesTeam()
{
  var sales_team_content = document.getElementById('sales_team_content');
  if ( sales_team_content != null )
    sales_team_content.innerHTML = _xmlHttpRequestObj.responseText; 
}


function refreshFcApptList()
{
  var refreshDiv = document.getElementById('fcApptDaily');
  if ( refreshDiv != null && _xmlHttpRequestObj.responseText.length>100 )
    refreshDiv.innerHTML = _xmlHttpRequestObj.responseText; 
  adjustApptsPositions();
  fcCalRefreshInProgress = 0;
}






function toggleCfMvFrame( cfMvFrameId, inputObjId )
{
  var cfMvFrame = document.getElementById(cfMvFrameId);
  var inputObj  = document.getElementById(inputObjId);
  if ( cfMvFrame.style.visibility == 'visible' ) hideCfMvFrame( cfMvFrame, inputObj, cfMvFrameId );
  else                                           showCfMvFrame( cfMvFrame, inputObj );
}
function hideCfMvFrame( cfMvFrame, inputObj, cfMvFrameId )
{
  closeFrameById( cfMvFrameId );

  var elList =  document.getElementsByTagName("INPUT");
  var newValue='';
  for (var i = 0; i < elList.length; i++)
  {
    if ( elList[i].name.substr(0,12+cfMvFrameId.length)== 'cfmvoption_'+cfMvFrameId+'_' 
          && elList[i].checked
        )
      newValue += '['+elList[i].name.substr(12+cfMvFrameId.length)+'],';
  }

  if ( newValue.length>2 ) newValue = newValue.substr( 0, newValue.length-1 );
  inputObj.value = newValue;
}

function toggleUserMvFrame( cfMvFrameId1, cfMvFrameId2, inputObjId, hiddenUserIds )
{
  var cfMvFrame1 = document.getElementById(cfMvFrameId1);
  var cfMvFrame2 = null;
  if ( cfMvFrameId2 != null )
    cfMvFrame2 = document.getElementById(cfMvFrameId2);
  var inputObj  = document.getElementById(inputObjId);
  var hiddenUidObj  = document.getElementById(hiddenUserIds);

  if ( cfMvFrame1.style.visibility == 'visible' )
  {
    closeUserMvFrame( cfMvFrameId1, inputObj, hiddenUidObj );
  }
  else
  {
    if ( cfMvFrame2 != null )
    {
      closeFrameById( cfMvFrameId2 );
    }
    showCfMvFrameScroll( cfMvFrame1, inputObj, 0 );  // 0 =adjustWidth
  }
}
function closeUserMvFrame( cfMvFrameId, inputObj, hiddenUidObj )
{
  closeFrameById( cfMvFrameId );

  var elList =  document.getElementsByTagName("INPUT");
  var newValue='';
  var newIds='';
  for (var i = 0; i < elList.length; i++)
  {
    if ( elList[i].name.substr(0,10+cfMvFrameId.length)== 'mvoption_'+cfMvFrameId+'_' 
          && elList[i].checked
        )
    {
      newValue += '['+elList[i].name.substr(10+cfMvFrameId.length)+'],';
      newIds   += document.getElementById( 'mvuserid_'+cfMvFrameId+'_'+elList[i].name.substr(10+cfMvFrameId.length) ).value + ',';
    }
  }
  if ( newValue.length>2 ) newValue = newValue.substr( 0, newValue.length-1 );
  inputObj.value = newValue;
  hiddenUidObj.value = newIds;
}
function submitUserMvFrame( cfMvFrameId1, cfMvFrameId2, inputObjId, hiddenUserIds )
{
  var cfMvFrame1 = document.getElementById(cfMvFrameId1);
  var cfMvFrame2 = document.getElementById(cfMvFrameId2);
  var inputObj  = document.getElementById(inputObjId);
  var hiddenUidObj  = document.getElementById(hiddenUserIds);

  if ( cfMvFrame1 != null && cfMvFrame1.style.visibility == 'visible' )
  {
    closeUserMvFrame( cfMvFrameId1, inputObj, hiddenUidObj );
  }
  if ( cfMvFrame2 != null && cfMvFrame2.style.visibility == 'visible' )
  {
    closeUserMvFrame( cfMvFrameId2, inputObj, hiddenUidObj );
  }
}

function toggleFtWhFrame( cfMvFrameId, inputObjId )  // FtWh = FreeTextWithHint
{
  var cfMvFrame = document.getElementById(cfMvFrameId);
  var inputObj  = document.getElementById(inputObjId);
  if ( cfMvFrame.style.visibility == 'visible' ) closeFrameById( cfMvFrameId );
  else
  {
    showCfMvFrame( cfMvFrame, inputObj );
    ++adjustiFrameMaxZIndex;
    cfMvFrame.style.zIndex = adjustiFrameMaxZIndex;
  }
}
function closeFrameById( cfMvFrameId )  // FtWh = FreeTextWithHint
{
  var cfMvFrame = $(cfMvFrameId);
  cfMvFrame.style.visibility = 'hidden'; 
  cfMvFrame.style.display = 'none';
  adjustiFrame( cfMvFrame );
}
function selectFtWhFrame( cfMvFrameId, inputObjId, newValue )  // FtWh = FreeTextWithHint
{
  $( inputObjId ).value = newValue;
  closeFrameById( cfMvFrameId );
}

function toggleCfCcFrame( cfMvFrameId, displayObjId )  // CfCc = CustomFieldColorCode
{
  if ( $(cfMvFrameId).style.visibility == 'visible' ) closeFrameById( cfMvFrameId );
  else                                                showCfMvFrame( $(cfMvFrameId), $(displayObjId) );
}
function selectCfCcFrame( cfMvFrameId, displayObjId, valueObjId, newValue )  // CfCc = CustomFieldColorCode
{
  $( displayObjId ).innerHTML = newValue;
  $( valueObjId ).value = newValue;

  closeFrameById( cfMvFrameId );
}
function togglePhoneFrame( cfMvFrameId, inputObjId, formName )
{
  var cfMvFrame = document.getElementById(cfMvFrameId);
  var inputObj  = document.getElementById(inputObjId);
  if ( cfMvFrame.style.visibility == 'visible' ) hidePhoneFrame( cfMvFrameId, inputObjId, formName );
  else                                           showCfMvFrameScroll( cfMvFrame, inputObj, 100 );
}
function hidePhoneFrame( cfMvFrameId, inputObjId, formName )
{
  closeFrameById( cfMvFrameId );

  var elList =  document.getElementsByTagName("INPUT");
  var rowNum = '0';
  for (var i = 0; i < elList.length; i++)
  {
    if ( elList[i].name == 'ahsPhbk_'+inputObjId+'_IDENTIFYING_ROW' )
      rowNum = elList[i].value;
  }

  var nb  = document.forms[formName].elements['ahsPhbk_'+inputObjId+'_'+rowNum+'_NB'].value;
  var ex  = document.forms[formName].elements['ahsPhbk_'+inputObjId+'_'+rowNum+'_EX'].value;
  var formatPhone = "";
  formatPhone = formatPhone + nb;
  if ( ex != '' ) formatPhone = formatPhone + ' x' + ex;
  $(inputObjId).value=formatPhone;
}

function toggleEmailFrame( cfMvFrameId, inputObjId, formName )
{
  var cfMvFrame = document.getElementById(cfMvFrameId);
  var inputObj  = document.getElementById(inputObjId);
  if ( cfMvFrame.style.visibility == 'visible' ) hideEmailFrame( cfMvFrameId, inputObjId, formName );
  else                                           showCfMvFrameScroll( cfMvFrame, inputObj, 100 );
}
function hideEmailFrame( cfMvFrameId, inputObjId, formName )
{
  closeFrameById( cfMvFrameId );

  var elList =  document.getElementsByTagName("INPUT");
  var rowNum = '0';
  for (var i = 0; i < elList.length; i++)
  {
    if ( elList[i].name == 'ahsEmbk_'+inputObjId+'_IDENTIFYING_ROW' )
      rowNum = elList[i].value;
  }

  $(inputObjId).value=document.forms[formName].elements['ahsEmbk_'+inputObjId+'_'+rowNum+'_EMAIL'].value;
}

function showCfMvFrame( cfMvFrame, inputObj )
{
  var maxHeight = 200;
  if (cfMvFrame.offsetHeight < maxHeight)
  {
    cfMvFrame.style.overflow = 'hidden';
  }
  else if (browser.isNS)
  {
    cfMvFrame.style.maxHeight = '200px';
    cfMvFrame.style.overflow = '-moz-scrollbars-vertical';
  }
  else
  {
    cfMvFrame.style.height = '200px';
    cfMvFrame.style.overflowY = 'auto';
  }

  cfMvFrame.scrollTop = 0;

  if ( browser.isIE )
  {
    var divParent = getDivContainer( cfMvFrame );
    if ( divParent != null && ( divParent.style.overflow == 'auto' || divParent.style.overflow == 'scroll' ) )
    {
      cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight-getAbsElementY(divParent)) + "px";
      cfMvFrame.style.left  = (getAbsElementX(inputObj)                      -getAbsElementX(divParent)) + "px";
    }
    else
    {
      cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight) + "px";
      cfMvFrame.style.left  = (getAbsElementX(inputObj)                      ) + "px";
    }
  }
  else
  {
    try {
      var inputObjId = inputObj.getAttribute('id');
      if ( inputObjId.substring(0,4) == 'ajax' )
      {
        var divParent = getDivContainer( cfMvFrame );
        cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight-getAbsElementY(divParent)) + "px";
        cfMvFrame.style.left  = (getAbsElementX(inputObj)                      -getAbsElementX(divParent)) + "px";
      }
      else
      {
        cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight) + "px";
        cfMvFrame.style.left  = (getAbsElementX(inputObj)                      ) + "px";
      }
    }
    catch (Exception)
    {
      cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight) + "px";
      cfMvFrame.style.left  = (getAbsElementX(inputObj)                      ) + "px";
    };
  }

  if ( inputObj.offsetWidth < 80 ) cfMvFrame.style.width = "100px";
  else                             cfMvFrame.style.width = (inputObj.offsetWidth+17) + "px";

  cfMvFrame.style.visibility = 'visible';
  cfMvFrame.style.display = 'block';
  adjustiFrame( cfMvFrame );
}

function showCfMvFrameScroll( cfMvFrame, inputObj, adjustWidth )
{
  var maxHeight = 200;
  cfMvFrame.scrollTop = 0;

  // Start playing
  cfMvFrame.style.top   = (getAbsElementY(inputObj)+inputObj.offsetHeight+1) + "px";
  cfMvFrame.style.left  = getAbsElementX(inputObj) + "px";
  cfMvFrame.style.width = (inputObj.offsetWidth+67+adjustWidth) + "px";

  cfMvFrame.style.visibility = 'visible';
  cfMvFrame.style.display = 'block';
  adjustiFrame( cfMvFrame );
}


                
var tipwidth='240px'; //default tooltip width
var tipbgcolor='#DDEEFF';  //tooltip bgcolor
var disappeardelay=250;  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px"; //horizontal offset of tooltip from anchor link
var horizontal_offset="-3px"; //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6)
  document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype)
{
  var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
  var parentEl=what.offsetParent;
  while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
  }
  return totaloffset;
}


  function showhide(obj, e, visible, hidden, tipwidth)
  {
    if (ie4||ns6)
      dropmenuobj.style.left=dropmenuobj.style.top=-500
    if (tipwidth!=""){
      dropmenuobj.widthobj=dropmenuobj.style
      dropmenuobj.widthobj.width=tipwidth
    }
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
      obj.visibility=visible
    else if (e.type=="click")
      obj.visibility=hidden
  }

  function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  }

  function clearbrowseredge(obj, whichedge){
    var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
    if (whichedge=="rightedge"){
      var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
      dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
      if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }
    else{
      var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
      dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
      if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    }
    return edgeoffset
  }

  function fixedtooltip(menucontents, obj, e, tipwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
      clearhidetip()
    dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
    dropmenuobj.innerHTML=unescape(menucontents);

    if (ie4||ns6){
      showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
      dropmenuobj.x=getposOffset(obj, "left")
      dropmenuobj.y=getposOffset(obj, "top")
      dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
      dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
  }
  function fixedtooltipadv(p1, p2, p3, p4, obj, e, tipwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
      clearhidetip()
    dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
    dropmenuobj.innerHTML=unescape( fixedtooltipadv_getcontent(p1, p2, p3, p4, obj) );

    if (ie4||ns6){
      showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
      dropmenuobj.x=getposOffset(obj, "left")
      dropmenuobj.y=getposOffset(obj, "top")
      dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
      dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
  }
  function fixedtooltipAdjust(menucontents, obj, e, tipwidth){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
      clearhidetip()
    dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
    dropmenuobj.innerHTML=unescape(menucontents);

    if (ie4||ns6){
      showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
      dropmenuobj.x=getposOffset(obj, "left")
      dropmenuobj.y=getposOffset(obj, "top")

      // 06/22/2006
      {
        var objparent = getDivContainer( obj );
        if ( objparent != null )
        {
          dropmenuobj.x = dropmenuobj.x - objparent.scrollLeft;
          dropmenuobj.y = dropmenuobj.y - objparent.scrollTop;
        }
      }

      dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
      dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
  }

  function hidetip(e){
    if (typeof dropmenuobj!="undefined"){
      if (ie4||ns6)
        dropmenuobj.style.visibility="hidden"
    }
  }

  function delayhidetip(){
    if (ie4||ns6)
      delayhide=setTimeout("hidetip()",disappeardelay)
  }

  function longdelayhidetip(){
    if (ie4||ns6)
      delayhide=setTimeout("hidetip()",2000)
  }

  function clearhidetip(){
    if (typeof delayhide!="undefined")
    clearTimeout(delayhide)
  }


function incbar_selectTab( tabId )
{
  document.getElementById('incbar_mortgage_calc').style.display="none";
  document.getElementById('incbar_post_it').style.display="none";
  document.getElementById( tabId ).style.display="block";
  return;
}

function incbar_mortgageCalcDoSum() { 
  var mi = document.incbar_mortgageCalc.IR.value / 1200;
  var base = 1;
  var mbase = 1 + mi;
  for (i=0; i<document.incbar_mortgageCalc.YR.value * 12; i++)
  {
    base = base * mbase; 
  }
  document.incbar_mortgageCalc.PI.value = floor(document.incbar_mortgageCalc.LA.value * mi / ( 1 - (1/base))); 
  document.incbar_mortgageCalc.MT.value = floor(document.incbar_mortgageCalc.AT.value / 12); 
  document.incbar_mortgageCalc.MI.value = floor(document.incbar_mortgageCalc.AI.value / 12); 
  var dasum = document.incbar_mortgageCalc.LA.value * mi / ( 1 - (1/base)) +        document.incbar_mortgageCalc.AT.value / 12 +         document.incbar_mortgageCalc.AI.value / 12;  document.incbar_mortgageCalc.MP.value = floor(dasum);
}

function overlaycloseall( divid )
{
    if ( divid != 'divbar_new' )  overlayclose('divbar_new');
    if ( divid != 'divbar_bookmarks' )  overlayclose('divbar_bookmarks');
    if ( divid != 'divbar_hotlist' ) overlayclose('divbar_hotlist');
    if ( divid != 'divbar_recent_items' ) overlayclose('divbar_recent_items');
    if ( divid != 'divbar_tools' ) overlayclose('divbar_tools');
    if ( divid != 'divbar_jumpto' ) overlayclose('divbar_jumpto');
}

function allincbar_overlay_bookmark( in_responseText, in_param )      { $('divbar_bookmarks').innerHTML = in_responseText; }
function allincbar_overlay_hotlist( in_responseText, in_param )       { $('divbar_hotlist').innerHTML = in_responseText; }
function allincbar_overlay_recent_items( in_responseText, in_param )  { $('divbar_recent_items').innerHTML = in_responseText; }
function allincbar_overlay_recent_tools( in_responseText, in_param )  { $('divbar_tools').innerHTML = in_responseText; }
function overlay(curobj, subobjid)
{
  var subobj=document.getElementById(subobjid);
  subobj.style.left=getposOffset(curobj, "left")+"px";
  subobj.style.top=(getposOffset(curobj, "top")+16)+"px";
  var visible=(subobj.style.display!="none");
  if (visible) subobj.style.display="none";
  else         subobj.style.display="block";
  ++adjustiFrameMaxZIndex;
  subobj.style.zIndex = adjustiFrameMaxZIndex;

  if ( subobjid == 'divbar_bookmarks' )
  {
    SimpleAJAXCall ( 'xhpCmnGetData.jsp'+genappend_submiturl+'&type=ALLINCBAR_BOOKMARK', allincbar_overlay_bookmark, 'POST', '' );
  }
  if ( subobjid == 'divbar_hotlist' )
  {
    SimpleAJAXCall ( 'xhpCmnGetData.jsp'+genappend_submiturl+'&type=ALLINCBAR_HOTLIST', allincbar_overlay_hotlist, 'POST', '' );
  }
  if ( subobjid == 'divbar_recent_items' )
  {
    SimpleAJAXCall ( 'xhpCmnGetData.jsp'+genappend_submiturl+'&type=ALLINCBAR_RECENT_ITEMS', allincbar_overlay_recent_items, 'POST', '' );
  }
  if ( subobjid == 'divbar_tools' )
  {
    SimpleAJAXCall ( 'xhpCmnGetData.jsp'+genappend_submiturl+'&type=ALLINCBAR_TOOLS', allincbar_overlay_recent_tools, 'POST', '' );
  }
  
  
  return false;
}

  function overlayAdjust(curobj, subobj)
  {
    if (document.getElementById)
    {
      var subobj=document.getElementById(subobj)
      subobj.style.left=getAbsElementX(curobj)+"px";
      subobj.style.top=(getAbsElementY(curobj)+16)+"px";
      var visible=(subobj.style.display!="none");
      if (visible) subobj.style.display="none";
      else         subobj.style.display="block";
      return false;
    }
    else
      return true;
  }

  function overlayclose(subobj){
    var o = document.getElementById(subobj);
    if ( o!=null )
      o.style.display="none"
  }


//added by janet 2005.12.9--begin
function jumpChart(submitUrl,portId,obj)
{ 
  submitUrl = submitUrl+'&param='+obj.options[obj.selectedIndex].value+"&portId="+portId;
  postXmlHttp( submitUrl, 'refreshChart('+portId+')');;
}
function refreshChart(portId)
{
  var div="chart_"+portId;
  var chart = document.getElementById(div);
  if ( chart != null )
     chart.innerHTML = _xmlHttpRequestObj.responseText; 
}
function jumpChart2(submitUrl,portId,param)
{ 
  var all=document.getElementById("portlet_"+portId+"_all");
  var open=document.getElementById("portlet_"+portId+"_open");
  if(param=="ALL"){
    open.removeAttribute("bgColor");
    all.setAttribute("bgColor","#ccccdd");
  }else{
    all.removeAttribute("bgColor");
    open.setAttribute("bgColor","#ccccdd");
  }
  
  submitUrl = submitUrl+'&param='+param+"&portId="+portId
  postXmlHttp( submitUrl, 'refreshChart('+portId+')');;
}
//added by janet 2005.12.9--end



// Mouse Over Script Start
ajax_mouseover_timerid = -1;
ajax_mouseover_objtype = '';
ajax_mouseover_objid   = '';
ajax_mouseover_repeatid = ''; // added by siva
ajax_mouseover_inprogress = 0;
currMouseX = 0;
currMouseY = 0;
var ajaxCurrMouseX = 0;
var ajaxCurrMouseY = 0;
function ajax_mouseover( ajaxMouseOverObjType, ajaxMouseOverObjId )
{
  
  if ( ajax_mouseover_snapshot_yesno == 'N' )
    return;

  ajaxCurrMouseX = window.event.clientX+document.body.scrollLeft;
  ajaxCurrMouseY = window.event.clientY+document.body.scrollTop;
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  
  if ( ajax_mouseover_inprogress == 0 )
  {
    ajax_mouseover_objtype = ajaxMouseOverObjType;
    ajax_mouseover_objid   = ajaxMouseOverObjId;

    ajax_mouseover_timerid = setTimeout( 'ajax_mouseover_action()', 1000 );
  }
}

function ajax_mouseoverrepeat( ajaxMouseOverObjType, ajaxMouseOverObjId, ajaxRepeatId )       // Added by siva to pass the RepeatId for Non-Master(Recurring) Appts.
{
  if ( ajax_mouseover_snapshot_yesno == 'N' )
    return;

  ajaxCurrMouseX = window.event.clientX+document.body.scrollLeft;
  ajaxCurrMouseY = window.event.clientY+document.body.scrollTop;
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }

  if ( ajax_mouseover_inprogress == 0 )
  {
    ajax_mouseover_objtype = ajaxMouseOverObjType;
    ajax_mouseover_objid   = ajaxMouseOverObjId;
    ajax_mouseover_repeatid = ajaxRepeatId;

    ajax_mouseover_timerid = setTimeout( 'ajax_mouseover_action1()', 1000 );
  }
}

function ajax_mouseout( ajaxMouseOverObjType, ajaxMouseOverObjId )
{
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  
  if ( ajax_mouseover_snapshot_hide != 'NEVER' )
  {
    if ( $('ajax_mouseover_snapshot_div') != null )
      setTimeout( 'ajax_mouseover_hidenapshot()', ajax_mouseover_snapshot_hide*1.0 );
  }
}

function ajax_mouseover_action()
{
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  ajax_mouseover_inprogress = 1;
  submitUrl = ajax_mouseover_submiturl + '&objtype=' + ajax_mouseover_objtype + '&objid=' + escape(ajax_mouseover_objid);
  try {
    if ( ajax_mouseover_email_contactid > 0 )
      submitUrl = submitUrl + '&eml_contactid=' + ajax_mouseover_email_contactid;
  }
  catch ( e ) {};
  postXmlHttp( submitUrl, 'ajax_mouseover_showsnapshot()' );
}

function ajax_mouseover_action1()          // Added by siva to pass the RepeatId for Non-Master(Recurring) Appts.
{
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  ajax_mouseover_inprogress = 1;
  submitUrl = ajax_mouseover_submiturl + '&objtype=' + ajax_mouseover_objtype + '&objid=' + escape(ajax_mouseover_objid) + '&repeatid=' + ajax_mouseover_repeatid ;
  try {
    if ( ajax_mouseover_email_contactid > 0 )
      submitUrl = submitUrl + '&eml_contactid=' + ajax_mouseover_email_contactid;
  }
  catch ( e ) {};
  postXmlHttp( submitUrl, 'ajax_mouseover_showsnapshot()' );
}

function ajax_mouseover2( ajaxMouseOverObjType, ajaxMouseOverObjId )
{
  ajaxCurrMouseX = window.event.clientX+document.body.scrollLeft;
  ajaxCurrMouseY = window.event.clientY+document.body.scrollTop;
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  
  if ( ajax_mouseover_inprogress == 0 )
  {
    ajax_mouseover_objtype = ajaxMouseOverObjType;
    ajax_mouseover_objid   = ajaxMouseOverObjId;
    ajax_mouseover_timerid = setTimeout( 'ajax_mouseover_action2()', 3000 );
  }
}
function ajax_mouseover_action2()
{
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  ajax_mouseover_inprogress = 1;
  submitUrl = ajax_mouseover_submiturl + '&objtype=' + ajax_mouseover_objtype + '&objid=' + escape(ajax_mouseover_objid) ;
  SimpleAJAXCall ( submitUrl, ajax_mouseover_showsnapshot2, 'POST', '' );
}
function ajax_mouseout2( ajaxMouseOverObjType, ajaxMouseOverObjId )
{
  if ( ajax_mouseover_timerid != -1 )
  {
    clearTimeout(ajax_mouseover_timerid);
    ajax_mouseover_timerid = -1;
  }
  if ( $('ajax_mouseover_snapshot_div') != null )
    ajax_mouseover_timerid = setTimeout( 'ajax_mouseover_hidenapshot()', 3000 );
}
function ajax_mouseover_showsnapshot2( in_responseText, in_param )
{
  var snapshot_div = document.getElementById('ajax_mouseover_snapshot_div');
  if ( snapshot_div != null )
  {
    snapshot_div.innerHTML = in_responseText; 

    snapshot_div.style.position = "absolute";
    snapshot_div.style.width = "540px";
    snapshot_div.style.overflow = 'scroll';

    if ( ajaxCurrMouseX + 525 > getBrowserSizeX() )
      snapshot_div.style.left  = ( getBrowserSizeX()-540 ) + "px";
    else
      snapshot_div.style.left  = (ajaxCurrMouseX+5) + "px";

    snapshot_div.style.top   = (ajaxCurrMouseY+1) + "px";
    snapshot_div.style.visibility = 'visible';
    snapshot_div.style.display = "block";
    ++adjustiFrameMaxZIndex;
    snapshot_div.style.zIndex = adjustiFrameMaxZIndex;
    adjustiFrame( snapshot_div );
    ajax_mouseover_inprogress = 0;
  }
}
function ajax_donothing( in_responseText, in_param )
{
}

function ajax_mouseover_showsnapshot()
{
  var snapshot_div = document.getElementById('ajax_mouseover_snapshot_div');
  if ( snapshot_div != null )
  {
    snapshot_div.innerHTML = _xmlHttpRequestObj.responseText; 

    snapshot_div.style.position = "absolute";
    snapshot_div.style.width = "360px";
    
    if ( ajaxCurrMouseX + 365 > getBrowserSizeX() )
      snapshot_div.style.left  = ( getBrowserSizeX()-380 ) + "px";
    else
      snapshot_div.style.left  = (ajaxCurrMouseX+5) + "px";

    snapshot_div.style.top   = (ajaxCurrMouseY+1) + "px";
    snapshot_div.style.visibility = 'visible';
    snapshot_div.style.display = "block";
    adjustiFrame( snapshot_div );
    ajax_mouseover_inprogress = 0;
  }
}
function ajax_mouseover_hidenapshot()
{
  if ( ajax_mouseover_inprogress == 1 )
    return;
  var snapshot_div = document.getElementById('ajax_mouseover_snapshot_div');
  if ( snapshot_div != null )
  {
    snapshot_div.style.display = "none";
    snapshot_div.style.visibility = "hidden";
    adjustiFrame( snapshot_div );
    ajax_mouseover_inprogress = 0;
  }
}
// Mouse Over Script End

//this fuctions is added by Janet 2006.2.22

function set_radio_value ( formName, elemName, selectedValue)
{
  var inputs = document.getElementsByTagName ('input');
  if (inputs)
  {
    for (var i = 0; i < inputs.length; ++i)
    {
      if (inputs[i].type == 'radio' && inputs[i].name == elemName && inputs[i].value == selectedValue )
      {
        inputs[i].checked = true;
        break;
      }
    }
  }
}

function set_select_value ( formName, elemName, selectedValue)
{
 var elem= document.forms[formName].elements[elemName].options;
 for ( var i=0; i< elem.length; i++)
 {
   if ( elem[i].value == selectedValue )
   {
     elem[i].selected = true ;
     break;
   }
 }
}

function cf_hour_min_onchange( formName, fieldName )
{
  var s1 = $( formName + '_' + fieldName + '_HH' ).value;
  var s2 = $( formName + '_' + fieldName + '_MM' ).value;
  var s3 = $( formName + '_' + fieldName + '_AP' ).value;
  if ( s1 == 'NA' || s2 == 'NA' || s3 == 'NA' )
    $( formName + '_' + fieldName ).value = '';
  else
    $( formName + '_' + fieldName ).value = s1 + ':' + s2 + ' ' + s3;
}

function search_select_all_all( formName, fieldPrefix )
{
  if ( document.forms[formName].select_all_all_flag.value=='N' )
  {
    document.forms[formName].select_all_all_flag.value = 'Y';
    ToggleSet('select_all_all_msg','block');
    var elList =  document.getElementsByTagName("INPUT");
    for (var i = 0; i < elList.length; i++)
    {
      if ( elList[i].name.substr(0,fieldPrefix.length)==fieldPrefix )
      {
        elList[i].checked = true;
        elList[i].disabled = true;
      }
    }
  }
  else
  {
    document.forms[formName].select_all_all_flag.value = 'N';
    ToggleSet('select_all_all_msg','none');
    var elList =  document.getElementsByTagName("INPUT");
    for (var i = 0; i < elList.length; i++)
    {
      if ( elList[i].name.substr(0,fieldPrefix.length)==fieldPrefix )
      {
        elList[i].checked = false;
        elList[i].disabled = false;
      }
    }
  }
  return false;
}


function cf_sms_phn_onchange( txtField, uniqK )
{
  var s1 = txtField.value;
  var s2 = $( uniqK+'_car' ).value;
  if ( s1.indexOf(' ') >= 0 || s1.indexOf('-')>=0 || s1.indexOf('(')>=0 || s1.indexOf(')')>=0 )
    alert( 'Please use number only. Please avoid [SPACE], - ( ) ... ' );
  if ( s1 == '' )
  {
    $( uniqK+'_display' ).innerHTML = '';
    $( uniqK+'_k' ).value = '';
  }
  else
  {
    $( uniqK+'_display' ).innerHTML = s1 + '@' + s2;
    $( uniqK+'_k' ).value = s1 + '@' + s2;
  }
}

function cf_sms_car_onchange( selField, uniqK )
{
  var s1 = $( uniqK+'_phn' ).value;
  var s2 = selField.value;
  if ( s2 == '' )
  {
    $( uniqK+'_display' ).innerHTML = '';
    $( uniqK+'_k' ).value = '';
  }
  else
  {
    $( uniqK+'_display' ).innerHTML = s1 + '@' + s2;
    $( uniqK+'_k' ).value = s1 + '@' + s2;
  }
}
/*
  function mobileCarrierOnChange( selObj )
  {
    var selValue = selObj.options[selObj.selectedIndex].value;  
    if ( selValue != '' )
    {
      document.TblActionForm.email.value = document.TblActionForm.phone1.value+document.TblActionForm.phone2.value+document.TblActionForm.phone3.value+'@'+selValue;
    }
  }
  
  function phoneOnChange()
  {
    var selObj = document.TblActionForm.mobileCarrier;
    var selValue = selObj.options[selObj.selectedIndex].value;  
    if ( selValue != '' )
    {
      document.TblActionForm.email.value = document.TblActionForm.phone1.value+document.TblActionForm.phone2.value+document.TblActionForm.phone3.value+'@'+selValue;
    }
  }
*/
  
var _gPpolSidebarShow= '';  // this is used in summary pages, so that when minimized, a single click would change url
var _gPpolSidebarDisplaying = '';
var _gPpolSidebarDisplayingId = '';
function ppolMinimizePpolSidebar( cat, pageCat )  // cat = 'ORG', 'PSN', 'OPP'
{
  _gPpolSidebarShow = 'N';
  
  if ( cat == 'ORG' )
    SimpleAJAXCall ( 'xhpCustomerNew.jsp'+genappend_submiturl+'&minSB=Y&pc='+pageCat, ppolMinimizePpolSidebarRefresh, 'POST', '' );

  if ( cat == 'PSN' )
    SimpleAJAXCall ( 'xhpContactNew.jsp'+genappend_submiturl+'&minSB=Y&pc='+pageCat, ppolMinimizePpolSidebarRefresh, 'POST', '' );
  
  if ( cat == 'OPP' )
    SimpleAJAXCall ( 'xhpOppNew.jsp'+genappend_submiturl+'&minSB=Y&pc='+pageCat, ppolMinimizePpolSidebarRefresh, 'POST', '' );
}
function ppolMinimizePpolSidebarRefresh(  in_responseText, in_param )
{
  $( 'ppolSidebarDiv' ).innerHTML = in_responseText;
}

function ppolMaxmizePpolSidebar( cat, pageCat )
{
  _gPpolSidebarShow = 'Y';

  if ( cat == 'ORG' )
    SimpleAJAXCall ( 'xhpCustomerNew.jsp'+genappend_submiturl+'&maxSB=Y&pc='+pageCat+'&dispCat='+_gPpolSidebarDisplaying+'&dispId='+_gPpolSidebarDisplayingId, ppolMinimizePpolSidebarRefresh, 'POST', '' );

  if ( cat == 'PSN' )
    SimpleAJAXCall ( 'xhpContactNew.jsp'+genappend_submiturl+'&maxSB=Y&pc='+pageCat+'&dispCat='+_gPpolSidebarDisplaying+'&dispId='+_gPpolSidebarDisplayingId, ppolMinimizePpolSidebarRefresh, 'POST', '' );
  
  if ( cat == 'OPP' )
    SimpleAJAXCall ( 'xhpOppNew.jsp'+genappend_submiturl+'&maxSB=Y&pc='+pageCat+'&dispCat='+_gPpolSidebarDisplaying+'&dispId='+_gPpolSidebarDisplayingId, ppolMinimizePpolSidebarRefresh, 'POST', '' );
}

function LTrim(VALUE)
{
  var v_length = VALUE.length;
  if(v_length < 1)
    return"";

  var strTemp = "";

  var iTemp = 0;
  while(iTemp < v_length)
  {
    //if(VALUE.charAt(iTemp) == w_space || VALUE.charAt(iTemp)==w_enter || VALUE.charAt(iTemp)==w_back || VALUE.charAt(iTemp)==w_newline)
    if(VALUE.charCodeAt(iTemp)==32 || VALUE.charCodeAt(iTemp)==13 || VALUE.charCodeAt(iTemp)==10)
    {
    }
    else
    {
      strTemp = VALUE.substring(iTemp,v_length);
      break;
    }
    iTemp = iTemp + 1;
  } //End While
  return strTemp;
}

function RTrim(VALUE)
{
  var v_length = VALUE.length;
  if(v_length < 1)
    return"";

  var strTemp = "";
  var iTemp = v_length -1;
  while(iTemp > -1)
  {
    //if(VALUE.charAt(iTemp) == w_space || VALUE.charAt(iTemp)==w_enter || VALUE.charAt(iTemp)==w_back || VALUE.charAt(iTemp)==w_newline)
    if(VALUE.charCodeAt(iTemp)==32 || VALUE.charCodeAt(iTemp)==13 || VALUE.charCodeAt(iTemp)==10)
    {
    }
    else
    {
      strTemp = VALUE.substring(0,iTemp +1);
      break;
    }
    iTemp = iTemp-1;
  } //End While
  return strTemp;
} //End Function

function ALLTrim(VALUE)
{
  return RTrim(LTrim(VALUE));
}

/**
  * Function Name: tbl_TRMouseOver
  * Function: It updates the backgroud-color of '<tr>' tag when mouse overing.
  *           So it can be different from others. 
  *
  * @param    id       ID of <tr> tag
  *           oldId    ID of Clicked <tr> tag
  *           colorId  Log the tag bgcolor before update
  *           bgcolor  Backgroud-Color to Set
  *
  * @author   qmLiang
  * @since    2006-8-18 16:08:19
  * @version  1.0
  */
function tbl_TRMouseOver(id,oldId,colorId,bgcolor)
{
  id = ALLTrim(id);
  oldId = ALLTrim(oldId);
  colorId = ALLTrim(colorId);
  bgcolor = ALLTrim(bgcolor);
  //this row has be clicked,then do nothing
  if(oldId != '' && id == document.getElementById(oldId).value)
    return;
  if(bgcolor == '')
    bgcolor = "#FFFFFF";
    
  //log the original bgcolor of this row
  document.getElementById(colorId).value = document.getElementById(id).style.backgroundColor;
  //update the bgcolor of this row
  document.getElementById(id).style.backgroundColor=bgcolor;
}//End Function

/**
  * Function Name: tbl_TRMouseOut
  * Function: It updates the backgroud-color of '<tr>' tag to original when mouse outed.
  *
  * @param    id       ID of <tr> tag
  *           oldId    ID of Clicked <tr> tag
  *           colorId  Original bgcolor of the tag
  *
  * @author   qmLiang
  * @since    2006-8-18 16:09:19
  * @version  1.0
  */
function tbl_TRMouseOut(id,oldId,colorId)
{
  id = ALLTrim(id);
  oldId = ALLTrim(oldId);
  colorId = ALLTrim(colorId);
  //this row has be clicked,then do nothing
  if(oldId != '' && id == document.getElementById(oldId).value)
    return;
    
  var bgcolor = "#FFFFFF";
  //get the original bgcolor of this row
  if(colorId != '' && document.getElementById(colorId).value != '')
    bgcolor = document.getElementById(colorId).value;
  //update the bgcolor of this row to original
  document.getElementById(id).style.backgroundColor=bgcolor;
}//End Function

/**
  * Function Name: tbl_TRClick
  * Function: It updates the backgroud-color of clicked tag last time to original when mouse click.
  *           Then log the tag id replace the old one.
  *
  * @param    id          ID of <tr> tag
  *           oldId       ID of Clicked <tr> tag
  *           oldColorId  Original bgcolor of clicked tag
  *           curColorId  Original bgcolor of clicking tag
  *
  * @author   qmLiang
  * @since    2006-8-18 16:11:19
  * @version  1.0
  */
function tbl_TRClick(id,oldId,oldColorId,curColorId)
{
  id = ALLTrim(id);
  oldId = ALLTrim(oldId);
  oldColorId = ALLTrim(oldColorId);
  curColorId = ALLTrim(curColorId);
  //this row has be clicked,then do nothing
  if(oldId != '' && id == document.getElementById(oldId).value)
    return;
    
  var bgcolor = "#FFFFFF";
  //get the original bgcolor of clicked row
  if(oldColorId != '' && document.getElementById(oldColorId).value != '')
    bgcolor = document.getElementById(oldColorId).value;
  //update the bgcolor of clicked row to original
  if(oldId != '' && document.getElementById(oldId).value != ''){
    var oldTag = document.getElementById(oldId).value;
    document.getElementById(oldTag).style.backgroundColor=bgcolor;
  }
  //log the original bgcolor of clicking row
  document.getElementById(oldColorId).value = document.getElementById(curColorId).value;
  //log the id of clicking row
  document.getElementById(oldId).value = id;
}//End Function

/**
  * Function Name: selectCBAllGeneric
  * Function: Select all checkbox.
  *
  * @param    name    Name of Checkbox
  *           allObj  Event Target Object
  *
  * @author   qmLiang
  * @since    2006-8-22 15:10:19
  * @version  1.0
  */
function selectCBAllGeneric(name,allObj)
{
  var elList =  document.getElementsByTagName("INPUT");
  for (var i = 0; i < elList.length; i++)
  {
    if (elList[i].name.substr(0,name.length)==name)
      elList[i].checked = allObj.checked;
  }//end for i
}//End Function

function newSidebarAdjustHeight()
{
  if ( $('NEWSIDEBAR_Y') != null )
  {
    var newSidebarHeightDivH = getBrowserSizeY()-getAbsElementY($('NEWSIDEBAR_Y'));
    if (!browser.isIE) newSidebarHeightDivH = newSidebarHeightDivH-20;
    else               newSidebarHeightDivH = newSidebarHeightDivH-2;
    if ( newSidebarHeightDivH < 200 ) newSidebarHeightDivH = 200;
    $('NEWSIDEBAR_Y').style.height = "" + newSidebarHeightDivH + "px";
  }
}



function showHideExtraMenu()
{
    currMouseX = window.event.clientX+document.body.scrollLeft;
    currMouseY = window.event.clientY+document.body.scrollTop;

    $('xtraAppMenu').style.width = "600px";
    $('xtraAppMenu').style.top   = (currMouseY+2) + "px";
    $('xtraAppMenu').style.left  = ( getBrowserSizeX()-600 ) / 2  + "px";

    Toggle( 'xtraAppMenu' );
    adjustiFrameMaxZIndex = adjustiFrameMaxZIndex + 1;
    $('xtraAppMenu').style.zIndex = adjustiFrameMaxZIndex;
}


function chatOp_MonitorLiveChat()
{
  SimpleAJAXCall ( ajax_livechat_monitor_url+'&opMonitorLiveChat=Y', chatOp_MonitorLiveChatRefresh, 'POST', '' )
//  postXmlHttp( ajax_livechat_monitor_url+'&opMonitorLiveChat=Y', 'chatOp_MonitorLiveChatRefresh()' );
}
function chatOp_MonitorLiveChatRefresh( in_responseText, in_param  )
{
  var returnHtml = ALLTrim( in_responseText );
  if ( returnHtml.length>5 )
  {
    var inQueueDiv = document.getElementById('ajax_popup_notify_div');
    if ( inQueueDiv != null )
    {
      inQueueDiv.innerHTML = _xmlHttpRequestObj.responseText; 
      inQueueDiv.style.width = "600px";
      inQueueDiv.style.height = "40px";
      inQueueDiv.position = "relative";
      inQueueDiv.style.visibility = 'visible';
      inQueueDiv.style.display = "block";
      inQueueDiv.style.top   = "0px";
      inQueueDiv.style.left  = "0px";
      inQueueDiv.style.zIndex = 1000000;
      
      document.all.sound.src = 'alert.wav';
    }
  }
  else
  {
    var inQueueDiv = document.getElementById('ajax_popup_notify_div');
    if ( inQueueDiv != null )
    {
      inQueueDiv.style.display = "none";
    }  
  }
}
function chatOp_MonitorLiveChatAction( additionalParam )
{
  postXmlHttp( ajax_livechat_monitor_url+'&opMonitorLiveChat=Y&'+additionalParam, 'chatOp_MonitorLiveChatActionRefresh()' );
}
function chatOp_MonitorLiveChatActionRefresh()
{
  var inQueueDiv = document.getElementById('ajax_popup_notify_div');
  if ( inQueueDiv != null )
  {
    inQueueDiv.style.display = "none";
  }  
}

function gen_display_self_closing_msg( msg )
{
  var gen_ui_helper_div = document.getElementById('gen_ui_helper_div');
  if ( gen_ui_helper_div != null )
  {
    gen_ui_helper_div.innerHTML = '<BR><table width=300 height=80 cellspacing=0 cellpadding=0 border=0 align=center><tr><td class="normalSmallBold borderA tsPad6" align=center>'+msg+'</td></tr></table>'; 
    gen_ui_helper_div.style.visibility = 'visible';
    gen_ui_helper_div.style.display = "block";
    gen_ui_helper_div.style.top   = document.body.offsetHeight / 2 + "px";
    gen_ui_helper_div.style.left  = ( document.body.offsetWidth / 2 - 200 ) + "px";
    gen_ui_helper_div.style.width = "300px";
    gen_ui_helper_div.style.width = "80px";
    adjustiFrame( gen_ui_helper_div );
  }
  
  setTimeout( gen_display_self_closing_msg_close, 2000 );
}

function gen_display_self_closing_msg_close()
{
  var gen_ui_helper_div = document.getElementById('gen_ui_helper_div');
  if ( gen_ui_helper_div != null )
  {
    gen_ui_helper_div.style.visibility = 'hidden';
    gen_ui_helper_div.style.display = "none";
    adjustiFrame( gen_ui_helper_div );
  }
}

function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }

  return elements;
}


var $v = function( divElmtId ) {
  return $(divElmtId)==null?'':$(divElmtId).value;
}


String.prototype.ltrim = function() {
	return this.replace(/^\s\s*/, '');
}
String.prototype.rtrim = function() {
	return this.replace(/\s\s*$/, '');
}
String.prototype.trim = function() {
	return this.ltrim().rtrim();
}

