function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

var tabState = "collapsed"

function toggleTab_old()
{
    if(tabState == "expanded")
    {
        findObj("myAcctTop").style.display = "none";
        findObj("tabarrow").src = "images/tabarrow_down.gif"
        tabState = "collapsed";
    }
    else if(tabState == "collapsed")
    {
        findObj("myAcctTop").style.display = "block";
        findObj("tabarrow").src = "images/tabarrow_up.gif"
        tabState = "expanded";
    }
}

function toggleMyAcct(state)
{
    var oTop  = findObj("hdrItem_myAcct");
    var oBot  = findObj("cMyAcctLinks");
    var oArrow = findObj("toggleArrow");

    if(!state)
    {
        var state = (oTop.className == "hdrItem_on") ? "off" : "on";
    }
    
    var sBotState = (state == "on") ? "block" : "none";
    
    oTop.className = "hdrItem_" + state;
    oBot.style.display = sBotState;
    oArrow.src = "images/togglearrow_" + state + ".gif";
}

// Set a select control to the indicated value
function setSelect( selectObj, selectVal )
{
   if ( selectVal != "" )
   {
      for ( i=0; i<selectObj.length; i++ )
      {
         if ( selectObj.options[i].value == selectVal )
         {
            selectObj.selectedIndex = i;
            return;
         }
      }
   }
}


/*************************************************************************
  This code is from Dynamic Web Coding 
  at http://www.dyn-web.com/
  Copyright 2001-3 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  Permission granted to use this code 
  as long as this entire notice is included.
*************************************************************************/

var cur_lyr;	// holds id of currently visible layer

function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
