function openPopup (pic)
{
var myWin = window.open (pic,'pop','width=450,height=600,toolbar=no, location=no,status=yes,menubar=no,scrollbars=no,resizable=yes');
myWin.focus();
}

function makeCell (arr, picname, w, tdw, sf)
{
var myArray = arr;
var myPic = picname;
var myWidth = w;
var myLink = false;
var myTDwidth = tdw;
var isNew = false;
var displayGenre ="";
var subFolder ="/images/";

if (sf==0) subFolder = "/";
if (myArray[3]==1) myLink = true;
if (myArray[2]=="N") isNew = true;

document.write('<td width="'+myTDwidth+'" align="center" valign="bottom">');

if (isNew)
  {
  document.write('<font color="#FFCC66"><b>***NEW***</b></font><br>');
  }
else
  {
  document.write('<font color="#FFCC66">'+ myArray[7] + '</font><br>');
  }

if (myLink)
  {
  document.write('<a href="'+myArray[1]+'/index.htm">');
  }
  document.write('<img border="0" src="'+myArray[1]+ subFolder +myPic+'"  width="'+myWidth+'">');
  document.write('<br><font color="#C0C0C0">'+ myArray[0] +' ['+ myArray[9] +']</font><br>');

if (myLink)
  {
  document.write('</a>');
  }

  document.write('<font color="#C0C0C0" size="2"><i>-' + writeGenre(myArray[5])+ '-</i></font>');
  document.write('</td>');
}

function writeGenre (gen)
{
  var modelGenre  = gen;
  
  if (modelGenre=="A") displayGenre = "NudeArt";
  if (modelGenre=="P") displayGenre = "Playboy";
  if (modelGenre=="E") displayGenre = "Playboy";
  if (modelGenre=="T") displayGenre = "Playboy";
  
  return displayGenre;
}


function get_random(limit)
{
    var ranNum= Math.floor(Math.random()*limit);
    return ranNum;
}


// definisce l'ordine casuale con cui vedere le modelle
function giveRandomOrder (arr,n,l)
{

var tmpArray = new Array();
for (x=0;x<n;x++)
    {
    var myRand=get_random(l);
    
    while (arr[myRand][6]==0)
       myRand=get_random(l);

    tmpArray[x]=arr[myRand];
    arr[myRand][6]=0;
    }

return tmpArray;
}


function invertOrder (arr)
{
var y=0;
var l=arr.length-1;
var tmpArray = new Array();
for (x=l;x>=0;x--)
    {
    tmpArray[y]=arr[x];
    y++;
    }

return tmpArray;
}