// Content Values

votesufficiency = 10;

maxmain       = 5;
mainname      = new Array();
mainvalue     = new Array();

mainname[1]   = "gamereviews";
mainvalue[1]  = "30";
mainname[2]   = "gamescreenshots";
mainvalue[2]  = "391";
mainname[3]   = "gamevideos";
mainvalue[3]  = "32";
mainname[4]   = "playergameratings";
mainvalue[4]  = "1004";
mainname[5]   = "playergameexperiences";
mainvalue[5]  = "30";

// Games Values

maxgames      = 24;
gamename      = new Array();
gamerating    = new Array();
gameratplayer = new Array();
gamevotes     = new Array();

gamename[1]       = "redlightcenter";
gamerating[1]     = "8.4";
gameratplayer[1]  = "5.6";
gamevotes[1]      = "75";

gamename[2]       = "sociolotron";
gamerating[2]     = "8.2";
gameratplayer[2]  = "7.3";
gamevotes[2]      = "144";

gamename[3]       = "secondlife";
gamerating[3]     = "7.7";
gameratplayer[3]  = "6.0";
gamevotes[3]      = "42";

gamename[4]       = "xoxcityseducity";
gamerating[4]     = "4.8";
gameratplayer[4]  = "4.7";
gamevotes[4]      = "72";

gamename[5]       = "3dsexvilla2";
gamerating[5]     = "8.7";
gameratplayer[5]  = "8.0";
gamevotes[5]      = "80";

gamename[6]       = "hentai3d2";
gamerating[6]     = "8.3";
gameratplayer[6]  = "NA";
gamevotes[6]      = "0";

gamename[7]       = "bonetown";
gamerating[7]     = "8.1";
gameratplayer[7]  = "9.2";
gamevotes[7]      = "15";

gamename[8]       = "thevelvetexpress";
gamerating[8]     = "7.8";
gameratplayer[8]  = "6.9";
gamevotes[8]      = "15";

gamename[9]       = "virtualhottie2";
gamerating[9]     = "7.8";
gameratplayer[9]  = "NA";
gamevotes[9]      = "0";

gamename[10]      = "cherrydolls";
gamerating[10]    = "7.5";
gameratplayer[10] = "NA";
gamevotes[10]     = "0";

gamename[11]      = "nemoswhores";
gamerating[11]    = "7.5";
gameratplayer[11] = "6.5";
gamevotes[11]     = "24";

gamename[12]      = "3dsexvilla";
gamerating[12]    = "7.3";
gameratplayer[12] = "NA";
gamevotes[12]     = "0";

gamename[13]      = "playsexgame";
gamerating[13]    = "7.2";
gameratplayer[13] = "4.3";
gamevotes[13]     = "108";

gamename[14]      = "digamour";
gamerating[14]    = "6.7";
gameratplayer[14] = "NA";
gamevotes[14]     = "0";

gamename[15]      = "virtuallyjenna";
gamerating[15]    = "6.9";
gameratplayer[15] = "NA";
gamevotes[15]     = "0";

gamename[16]      = "3dplaything";
gamerating[16]    = "6.6";
//gameratplayer[16] = "NA";
//gamevotes[16]     = "0";
gameratplayer[16] = "5.0";
gamevotes[16]     = "30";

gamename[17]      = "activedolls";
gamerating[17]    = "6.6";
gameratplayer[17] = "NA";
gamevotes[17]     = "0";

gamename[18]      = "beauty3d";
gamerating[18]    = "6.6";
gameratplayer[18] = "NA";
gamevotes[18]     = "0";

gamename[19]      = "playboythemansion";
gamerating[19]    = "6.2";
gameratplayer[19] = "NA";
gamevotes[19]     = "0";

gamename[20]      = "lovechess";
gamerating[20]    = "6.1";
gameratplayer[20] = "NA";
gamevotes[20]     = "0";

gamename[21]      = "lula3d";
gamerating[21]    = "6.0";
gameratplayer[21] = "4.7";
gamevotes[21]     = "30";

gamename[22]      = "sexstation7";
gamerating[22]    = "3.5";
gameratplayer[22] = "2.3";
gamevotes[22]     = "15";

gamename[23]      = "morcreasuniversalaxis";
gamerating[23]    = "NA";
gameratplayer[23] = "NA";
gamevotes[23]     = "0";

gamename[24]      = "zoomtang";
gamerating[24]    = "NA";
gameratplayer[24] = "NA";
gamevotes[24]     = "0";

// -------
// CHECKER
// -------

function checkInput () {
  if (document.slform.gamerating.value == "NA")
  {
    alert("No Rating Score defined!\nPlease use the Slider to define one.");
    return false;
  }
  return true;
}
function checkInputIFORM () {
  substring = document.slform.gamename.value.substring(1,0);

  if (substring == "-")
  {
    alert("No Game selected!\nPlease select one.");
    return false;
  }
  if (document.slform.gamerating.value == "NA")
  {
    alert("No Rating Score defined!\nPlease use the Slider to define one.");
    return false;
  }
  if (document.slform.playername.value == "")
  {
    alert("No Username defined!\nPlease define one.");
    return false;
  }
  return true;
}


// ------
// GETTER
// ------

function getMainValue(p_valuename) {
  valvar = "0";
  for (i = 1; i <= maxmain; i++) {
    if (mainname[i] == p_valuename) 
      valvar = mainvalue[i];
  }
  return valvar;
}
function getRatingValue(p_gamename,p_ratinggroup) {
  valvar = "0.0";
  for (i = 1; i <= maxgames; i++) {
    if (gamename[i] == p_gamename)
      if (p_ratinggroup == "team")
        valvar = gamerating[i];
      else
        valvar = gameratplayer[i];
  }
  return valvar;
}
function getVotesValue(p_gamename) {
  valvar = "0";
  for (i = 1; i <= maxgames; i++) {
    if (gamename[i] == p_gamename) 
      valvar = gamevotes[i];
  }
  return valvar;
}
function getRatingName(p_value) {

  if (p_value == "NA")
    return p_value;

  if (p_value < 1) {
    valvar = "WTF?";
  } else if (p_value < 2) {
    valvar = "Abysmal";
  } else if (p_value < 3) {
    valvar = "Terrible";
  } else if (p_value < 4) {
    valvar = "Bad";
  } else if (p_value < 5) {
    valvar = "Poor";
  } else if (p_value < 6) {
    valvar = "Passable";
  } else if (p_value < 7) {
    valvar = "Decent";
  } else if (p_value < 8) {
    valvar = "Good";
  } else if (p_value < 9) {
    valvar = "Great";
  } else if (p_value < 10) {
    valvar = "Outstanding";
  } else if (p_value = 10) {
    valvar = "Masterful";
  } else {
    valvar = "NA";
  }

  return valvar;
}

// ---------
// FORMATTER
// ---------

function formatRatingValueGAMEBOX (p_value) {
  document.write('<div id="ratingvalueGAMEBOX" align="center">' + p_value + '</div>');
}
function formatVotesValueGAMEBOX (p_votes) {
  //if (parseInt(p_votes) >= votesufficiency )
  //  document.write('<font size="1" color="#00FF00">' + p_votes + '</font>');
}
function formatRatingValueOSG (p_value) {
  // (dark green)
  document.write('<div id="ratingvalue" align="right">' + p_value + '</div>');
}
function formatRatingValueOSGTOP (p_value) {
  document.write('<font face="Arial Black" size="3" color="#008000">' + valvar + '</font>');
}
function formatRatingValueLG (p_value) {
  // (light green)
  document.write('<div id="ratingvalueLG" align="left">' + p_value + '</div>');
}
function formatRatingValue (p_value) {
  // (light green)
  document.write('<font size="1" color="#00FF00">' + p_value + '</font>');
}
function formatRatingName (p_ratingname) {
  document.write('<font size="1" color="#00FF00">' + p_ratingname + '</font>');
}
function formatPlayerStringGAMEBOX (p_ratingname,p_votes) {
  if (parseInt(p_votes) < votesufficiency)
  {
    document.write('<font size="1" color="#00FF00">Insufficient votes</font>');
  }
  else
  {
    document.write('<font size="1" color="#00FF00">' + p_ratingname +' ('+ p_votes +')</font>');
  }
}

// ------
// DRAWER
// ------

function drawRatingBar (p_value) {
  if (p_value == "NA")
    p_value = "0.0";

  y=p_value.split(".");  
  document.write('<div id="ratingbackimg">');
  document.write('<div id="ratingbar" style="width:' + y[0] + y[1] + '%;">');
  document.write('</div></div>');
}

function drawRatingBarTOP (p_value) {
  if (p_value == "NA")
    p_value = "0.0";

  y=p_value.split(".");  
  document.write('<div id="ratingbackimgTOP">');
  document.write('<div id="ratingbarTOP" style="width:' + y[0] + y[1] + '%;">');
  document.write('</div></div>');
}

// -------
// COMBINE
// -------

function combineSGL (p_value) {
  drawRatingBar(p_value);
  formatRatingValueLG(p_value);
}
function combineGAMEXP (p_value) {
  document.write('<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" height="7">');
  document.write('<tr><td width="34%" height="7">');
  drawRatingBar(p_value);
  document.write('</td><td width="12%" height="7">');
  formatRatingValue(p_value);
  document.write('</td><td width="54%" valign="top" height="7">');
  //formatRatingName(getRatingName(p_value));  
  if (p_value == "10.0")
    document.write('<font size="1" color="#00FF00">&nbsp;' + getRatingName(p_value) + '</font>');
  else
    document.write('<font size="1" color="#00FF00">' + getRatingName(p_value) + '</font>');
  document.write('</td></tr></table>');
}