﻿    var currentp = 'p0';
//    var p = new Array('p0','p1','p2','p3','p4','p5');
//    var p = new Array('p0');
    var lastp = '';
    var firstp = '';
// 
function toggle ( eleid , onindicator ) {
    if (onindicator == null)
    {
      onindicator = 'off';
    }
    currentp = 'p0';
    clearpages();
    document.getElementById(currentp).style.display = 'block';
    if  (document.getElementById('leftarrow'))
     {
        document.getElementById('leftarrow').src = 'images/Leftoff.gif';
        if ( p.length == 1)
        {
         document.getElementById('rightarrow').src = 'images/nobutton.gif';
         document.getElementById('leftarrow').src = 'images/nobutton.gif';
        }
        else
        {
          document.getElementById('rightarrow').src = 'images/Righton.gif';
        }
     }
     if (document.getElementById(eleid).className == 'infobox displayon')
       {
          document.getElementById(eleid).className = 'infobox displayoff';
       }
        else
       {
          document.getElementById(eleid).className = 'infobox displayon';
    }
    if (onindicator == 'on'  ) 
    {
       document.getElementById(eleid).className = 'infobox displayon';
    }
 } 
function clearpages(){
   for (var i=0;i<p.length;i++ )
   {
      document.getElementById(p[i]).style.display = 'none';
   }
 }
function displaytoggle( eleid )
{
 var currmode = document.getElementById( eleid ).style.display;
 if (currmode == 'none')  { document.getElementById( eleid ).style.display = 'block'; }
 if (currmode == 'block') { document.getElementById( eleid ).style.display = 'none';  } 
 if (currmode == 'inline'){ document.getElementById( eleid ).style.display = 'none';  } 
}
function findelement( str )
{
  idx = 0;
 for ( var i = 0;i< p.length;i++)
 {
  if (p[i] == str) 
  {
    return i;
  }
 }
}
function pageforward() {
    clearpages();
   //
   currentidx = findelement( currentp);

   if (currentidx < p.length-1) 
   {
     currentidx ++;
     currentp = 'p' + currentidx;
   }
   if (currentidx < (p.length -1))
   {
     document.getElementById('rightarrow').src = 'images/Righton.gif';
     document.getElementById('leftarrow').src = 'images/Lefton.gif';
   }
   if (currentidx == (p.length -1))
   {
     document.getElementById('rightarrow').src = 'images/Rightoff.gif';
     document.getElementById('leftarrow' ).src = 'images/Lefton.gif';
   }
   if (p.length == 1)
   {
     document.getElementById('rightarrow').src = 'images/nobutton.gif';
     document.getElementById('leftarrow' ).src = 'images/nobutton.gif';   
   } 
    document.getElementById(currentp).style.display = 'block';
 }
function pageback() {
    clearpages();
    currentidx = findelement( currentp);
    if ( currentidx > 0) 
    {
      currentidx -- ;
      currentp = 'p' + currentidx;
    }
    if (currentidx == 0)
    {
      document.getElementById('leftarrow').src = 'images/Leftoff.gif';
      document.getElementById('rightarrow').src = 'images/Righton.gif';
    } else
    {
      document.getElementById('rightarrow').src = 'images/Righton.gif';
      document.getElementById('leftarrow').src = 'images/Lefton.gif';
    }    
   if (p.length == 1)
   {
     document.getElementById('rightarrow').src = 'images/nobutton.gif';
     document.getElementById('leftarrow' ).src = 'images/nobutton.gif';   
   } 

    document.getElementById(currentp).style.display = 'block';
 }
