﻿
// ●○■□

//-----------------------------------------------------------------------------------------------
function LoadingInit ( steps, textcolor )
{
  var i;
  var c = "";

  c += "<DIV id='loading_id' style='color: " + textcolor + "; font-family: Verdana, Arial, sans-serif; font-size: 13pt; padding: 15px'>";
  c += "Seite wird geladen &nbsp;...&nbsp;&nbsp;";
  c += "<SPAN style='font-family: monospace' id='loading_progressbar_id'>";
  for ( i = 0; i < steps; i++ )
    c += "□";
  c += "</SPAN>";
  c += "&nbsp;<SPAN id='loading_progresspercent_id'>0%</SPAN>";
  c += "</DIV>";
  document.write ( c );
}
//-----------------------------------------------------------------------------------------------
function LoadingProgress ( )
{
  var pbel = document.getElementById ( "loading_progressbar_id" );
  var ppel = document.getElementById ( "loading_progresspercent_id" );
  var p;
  
  p = pbel.innerHTML.indexOf ( "□" );
  if ( p != -1 )
    {
      prc = ( p + 1 ) * 100 / pbel.innerHTML.length;
      pbel.innerHTML = pbel.innerHTML.substring ( 0, p ) + "■" + pbel.innerHTML.substring ( p + 1 );
    }
  else
    prc = 100;
    
  ppel.innerHTML = prc.toFixed ( 0 ) + "%";
}
//-----------------------------------------------------------------------------------------------
function LoadingDone ( )
{
  document.getElementById ( "loading_id" ).style.display = "none";
}
//-----------------------------------------------------------------------------------------------
