/*

	Nombre:			Presentador de Juegos Recientes.
	Descripcion:	BD y Funciones de Control
	Autor:			Leonardo Antezana P. TS.
	Copyright:		'J de Juegos - Todo Sobre Juegos' 07/2001
	Actualizado:	02/09/2001 - 13/Marzo/2008

*/

var limItemsRG = 20
var recentGamesV = new Array(20)

function nItem(jPath, jCat, jInfo, jAlt) {
	this.jp = jPath		//path del juego
	this.jc = jCat		//categoria
	this.ji = jInfo		//tipo de info
	this.ja = jAlt		//texto alternativo imagen
}

function iniItemsDBrecentGames(){
	recentGamesV[0]=new nItem("mercenaries2_worldinflames","A","P","Mercenaries 2: World in Flames")
	recentGamesV[1]=new nItem("shatteredhorizon","A","P","Shattered Horizon")
	recentGamesV[2]=new nItem("warhammer_online","R","P","Warhammer Online")
	recentGamesV[3]=new nItem("startrek_online","R","P","Star Trek Online")
	recentGamesV[4]=new nItem("jumpgate_evolution","R","P","JumpGate Evolution")
	recentGamesV[5]=new nItem("divinity2_egodraconis","R","P","Divinity II: Ego Draconis")
	recentGamesV[6]=new nItem("sacrifice","E","E","Sacrifice")
	recentGamesV[7]=new nItem("tankuniversal","A","D","Tank Universal")
	recentGamesV[8]=new nItem("deathtrack_resurrection","C","P","Death Track: Resurrection")
	recentGamesV[9]=new nItem("fallenearth","R","P","Fallen Earth")//*
	recentGamesV[10]=new nItem("singularity","A","P","Singularity")
	recentGamesV[11]=new nItem("section8","A","P","Section 8")
	recentGamesV[12]=new nItem("darkvoid","A","P","Dark Void")
	recentGamesV[13]=new nItem("thesims3","S","P","The Sims 3")
	recentGamesV[14]=new nItem("perimeter2_newearth","E","P","Perimeter 2: New Earth")
	recentGamesV[15]=new nItem("demigod","E","P","Demigod")
	recentGamesV[16]=new nItem("aim_racing","C","P","A.I.M. Racing")
	recentGamesV[17]=new nItem("blazingangels2","A","E","Blazing Angels 2: Secret Missions of WWII")
	recentGamesV[18]=new nItem("darksiders_wrathofwar","A","P","Darksiders: Wrath of War")
	recentGamesV[19]=new nItem("legendary","A","P","Legendary")
}

//lim = limite de conteo, dir = horizonal o vertical
function showRecentG(lim, dir) {
	var j = 0
	var d = new Date
	var auxStr = ""
	var posI = d.getSeconds()
	var numC = 5 //numero columnas

	if(dir == 2)
		{	posI = 0
			dir = 1
			numC = 4
		}
	else
		posI = (posI > (limItemsRG-1))?(posI % limItemsRG):posI

	auxStr = "<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH='96%' cols=" + ((dir==0)?1:lim) + ">"

	for(var i = posI; i < limItemsRG; i++) {
		if(j==lim) break;
		if((dir==0)||((d==1)&&(j==0))||(j%numC == 0))
			auxStr += "<TR>"
		auxStr += "<TD align='center'>"
		auxStr += "<a href='" + strCateg(recentGamesV[i].jc) + recentGamesV[i].jp + "/" + recentGamesV[i].jp + strInfo(recentGamesV[i].ji) + ".htm'>"
		auxStr += "<img src='" + strCateg(recentGamesV[i].jc) + recentGamesV[i].jp + "/" + recentGamesV[i].jp + "_top.jpg' "
		auxStr += "alt='" + recentGamesV[i].ja + "' VSPACE=3 NOSAVE BORDER=1 width=120 height=77>"
		auxStr += "</a>"
		auxStr += "</TD>"
		j++
		if((dir==0)||((d==1)&&(j==0))||(j%numC == 0))
			auxStr += "</TR>"

		if(i==(limItemsRG-1)) i=-1
	}
	auxStr += "</TABLE>"
	return(auxStr)
}

function strCateg(catL) {
	if(catL=="A") return("jaccion/")
	if(catL=="C") return("jcarrerasotros/")
	if(catL=="D") return("jdeportes/")
	if(catL=="E") return("jestrategia/")
	if(catL=="R") return("jrol/")
	if(catL=="S") return("jsimuladores/")
	if(catL=="V") return("javentura/")
}

function strInfo(infoL) {
	if(infoL=="P") return("_prview")
	if(infoL=="E") return("")
	if(infoL=="D") return("_demo")
}
