mainUrl= "http://comm.portailsmm.com/index.html";
mainTitle= "--==[ Might and Magic - The Tome of Knowledge ]==--";
baseUrl= "http://comm.portailsmm.com/";
portalSubject= "Might and Magic";

// ***************************************************************************
// ***                             Images Functions                        ***
// ***************************************************************************
function showCover (image, title, width, height)
{
  showImage ("pics/" + image + ".jpg", width, height, title + " - Cover ", 'common.css');
} // END showCover ()


// ***************************************************************************
// ***                          Communty Leveling                          ***
// ***************************************************************************
function levelToDays (level)
{
   n= (level - level%10)/10 + 1;
   return (n*(n + 1)*5) - ((n*10 - level)*n);
} // END levelToDays ()

function daysToLevel (days)
{
  conDays= 0;
  cnt= 0;

  while (conDays < days)
  {
    cnt++;
    conDays= conDays + (cnt - cnt%10)/10 + 1;
  }
  return cnt;
} // END daysToLevel ()

function test_it (entry) 
{
  if (entry.value != null && entry.value.length != 0) 
  {
    var toto= entry.value * 1;
    entry.value= isFinite(toto) ? entry.value : "";
  }
   computeForm(entry.form);
} // END test_it ()

function computeForm (form) 
{
  if (form.level.value == null || form.level.value.length == 0) 
  {
    form.level.value= 0;
  }
  if (form.days.value == null || form.days.value.length == 0) 
  {
    form.days.value= 0;
  }

  var i= form.level.value;
  var j= form.days.value;
  form.daysSpend.value= levelToDays(i);
  form.bestLevel.value= daysToLevel(j);
} // END computeForm ()

function reset_it (form) 
{
  form.level.value="";
  form.daysSpend.value="";
  form.days.value="";
  form.bestLevel.value="";
} // END reset_it ()

