<!--
var nbAnimations = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''];
var tabAnimations = ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''];
var nbTimer = false;

function LOAD( )
{
  document.getElementById('jswarning').style.display = 'none';
}

function returnCurrentID( ID )
{
  start = ID.lastIndexOf("b") + 1;
  return ID.substring(start);
}

function returnCurrentStep( ID )
{
  step = document.getElementById( ID ).style.backgroundImage;
  start = step.lastIndexOf("_step") + 5;
  end = step.lastIndexOf(".png");
  return step.substring(start, end);
}

function navUp( ID )
{
  button = returnCurrentID( ID );
  nbAnimations[ button ] = '+';
  
  if( !nbTimer ){  navStepper()  }
}

function navDown( ID )
{
  button = returnCurrentID( ID );
  nbAnimations[ button ] = '-';
  
  if( !nbTimer ){  navStepper()  }
}

function tabUp( ID )
{
  button = returnCurrentID( ID );
  tabAnimations[ button ] = "+";
  
  if( !nbTimer ){  navStepper()  }
}

function tabDown( ID )
{
  button = returnCurrentID( ID );
  tabAnimations[ button ] = "-";
  
  if( !nbTimer ){  navStepper()  }
}

function navStepper( )
{
  var doTimer = false;
  for( i=0; i<nbAnimations.length; i++ )
  {
    if( nbAnimations[i].length > 0 )
    {
      ID = 'nb' + i;
      
      step = returnCurrentStep( ID );
      if( nbAnimations[i] == '+' && step<5 ){  step++;  } if( step > 5 ){  step = 5;  }
      if( nbAnimations[i] == '-' && step>0 ){  step--;  } if( step < 0 ){  step = 0;  }
      
      if( !step ){  step = 0;  }
      
      document.getElementById(ID).style.backgroundImage = 'url(http://www.doradofilms.com/images/nav_step' + step + '.png)';
      
      if( step == 0 || step == 5 ){  nbAnimations[i] = '';  }
      else{  doTimer = true;  }
    }
  }
  for( i=0; i<tabAnimations.length; i++ )
  {
    if( tabAnimations[i].length > 0 )
    {
      ID = 'tb' + i;
      
      step = returnCurrentStep( ID );
      if( tabAnimations[i] == '+' && step<5 ){  step++;  } if( step > 5 ){  step = 5;  }
      if( tabAnimations[i] == '-' && step>0 ){  step--;  } if( step < 0 ){  step = 0;  }
      
      if( !step ){  step = 0;  }
      
      document.getElementById(ID).style.backgroundImage = 'url(http://www.doradofilms.com/images/tab_step' + step + '.png)';
      
      if( step == 0 || step == 5 ){  tabAnimations[i] = '';  }
      else{  doTimer = true;  }
    }
  }
  
  if( doTimer ){  nbTimer = setTimeout( "navStepper()", 20 );  }
  else{  nbTimer = false;  }
}


/* Home Screen Slides */
hss_current_slide = 1;
hss_hold = true;
hss_position = 0;
hss_timer = false;
function hss( )
{
  if( hss_hold )
  {
    hss_hold = false;
    hss_current_slide++;
    
    hss_timer = setTimeout( "hss()", 12000 );
  }
  else
  {
    goal = (hss_current_slide - 1) * 800;
    if( goal > hss_position ){  hss_position = hss_position + 80;  }
    else{  hss_position = hss_position - 80;  }
    
    document.getElementById('slides').scrollLeft = hss_position;
    
    
    marker1 = Math.round( hss_position / 25 );
    document.getElementById('hss_marker1').style.marginLeft = marker1 + "px";
    
    if( (marker1 + 32) > (hss_slides * 32) )
    {
      width1 = (hss_slides * 32) - marker1;
      width2 = 32 - width1;
      document.getElementById('hss_marker1').style.width = width1 + "px";
      document.getElementById('hss_marker2').style.width = width2 + "px";
    }
    
    
    if( hss_position == goal )
    {
      hss_hold = true;
      
      if( hss_current_slide > hss_slides )
      {
        hss_current_slide = 1;
        hss_position = 0;
        
        document.getElementById('hss_marker1').style.marginLeft = '0px';
        document.getElementById('hss_marker1').style.width = '32px';
        document.getElementById('hss_marker2').style.width = '1px';
      }
    }
    
    hss_timer = setTimeout( "hss()", 25 );
  }
}

function hss_goto( slide )
{
  clearTimeout( hss_timer );
  
  hss_hold = false;
  hss_current_slide = slide;
  hss();
}


window.onload = LOAD;
//-->

