/*************************\
 * Quiz Helper Functions *
\*************************/

// This function gives the paths to pictures. Change if needed.
function getPic(n)
{
  for(i=1;i<=252;i++)
      if(Number(Pokemoni[i][0])==n)
          break;
  if(n < 152) return "/Pokedex/RBY1/" + Pokemoni[i][0] + "..." + Pokemoni[i][1] + ".gif";
  return "/Pokedex/GS1/" + Pokemoni[i][0] + ".gif";
}

// This function gives the arrays of shadows that are done. Add new ones to ShadowDoneGS.
ShadowRBY = true;
ShadowGS = true;
ShadowDoneRBY = new Array(12,14,19,26,32,34,35,52,53,56,67,69,70,92,115,129,130,133,149,150,151)
ShadowDoneGS = new Array()

// This function gives the paths to the shadow pictures.
function getShadow(n)
{
	for(i=1;i<=252;i++)
		if(Number(Pokemoni[i][0])==n)
			break;
	if(n < 152)
		return "/Pokedex/RBY1Siluety/"+Pokemoni[i][0]+".png"
	return "/Pokedex/GS1Siluety/"+Pokemoni[i][0]+".gif"
}

// DexNumber -> Alphabetical No.
function toNum(pnum)
{
    if(pnum && !Number(pnum).NaN)
    {
        for(i = 1; Pokemoni[i][0] != ""; i++)
            if(Number(Pokemoni[i][0]) == pnum)
                return i;
    }
	else
	    return 0;
}

// Draw 'em balls!
function doBonuses()
{
	bonustext=""
	if(bonusNo>6)bonusNo=6;
	for(bnow=0;bnow<bonusNo;bnow++)
		bonustext+="<img src='bonon.gif'>"
	for(;bnow<6;bnow++)
		bonustext+="<img src='bonoff.gif'>"
	GetElement("bonuses").innerHTML=bonustext;
}

// Chroma helper
function PicReady()
{
	pic.style.visibility="visible"
	pic.filters.blendTrans.play()
	alert(a)
	pic.onload = ""
}


//Can they breed?
function canBreed(p1,p2)
{
	////////////////////////////////////////////////////// Zero-Types
	if(Breed[p1][1]==0||Breed[p2][1]==0)
		return 0;
	////////////////////////////////////////////////////// Ditto-Breeds
	if(Breed[p1][1]==15||Breed[p2][1]==15)
		return 1;
	////////////////////////////////////////////////////// Unknown gender
	if(Breed[p1][1]==1 || Breed[p2][1]==1)
		return 0;
	////////////////////////////////////////////////////// Same PKMN
	if(p1==p2)////Same PKMN
		return 1;
	////////////////////////////////////////////////////// That's all the Special cases...
	return HaveCommonClass(p1,p2)
}
function HaveCommonClass(p1,p2)
{
	for(i1 in Breed[p1])
		for(i2 in Breed[p2])
			if(i1!=0&&i2!=0)
				if(Breed[p1][i1]==Breed[p2][i2])
					return 1
	return 0
}

