function SwitchTab( oEl )
{
   var aTds = oEl.parentNode.getElementsByTagName('td');

   for ( i=0; i<aTds.length; i++ )
   {
      nId = aTds[i].id.replace(/[^0-9]*/, "");

      var oSec = document.getElementById( 'tab_' + nId );
      if ( !oSec ) continue;

      if ( oEl.id == aTds[i].id )
      {
         removeClass( aTds[i], 'color_tab' );
         addClass( aTds[i], 'selected' );

         oSec.style.display = '';
      }
      else
      {
         removeClass( aTds[i], 'selected' );
         addClass( aTds[i], 'color_tab' );

         oSec.style.display = 'none';
      }
   }

   return false;
}

function hasClass( oTarget, theClass )
{
   var pattern = new RegExp("(^| )" + theClass + "( |$)");

   if ( pattern.test( oTarget.className ) )
   {
      return true;
   }

   return false;
}

function addClass( oTarget, theClass )
{
   if ( !hasClass( oTarget, theClass ) )
   {
      if ( oTarget.className == "" )
      {
         oTarget.className = theClass;
      }
      else
      {
         oTarget.className += " " + theClass;
      }
   }
}

function removeClass( oTarget, theClass )
{
   var pattern = new RegExp("(^| )" + theClass + "( |$)");

   oTarget.className = oTarget.className.replace(pattern, "$1");
   oTarget.className = oTarget.className.replace(/ $/, "");
}

function openWindow( sUrl )
{
   window.open( sUrl, 'myWindow', 'width=450,height=450' );
}

function openPicWindow( sUrl, nW, nH )
{
   window.open( sUrl, 'myPicWindow', 'width='+nW+',height='+nH );
}

