//Functions to draw stars and allow them to be clicked and to update the appropriate form field
//Used in planet_people.js
function drawStars(numStars, fieldID, hiviz)
{   
    //Draws the stars.  The rating is between 1 and 5 but held as an integer between 1 and 10
    //1 star = 2 halves. Left half odd, right half even rating.
    //hiviz is an accessability graphic chooser.

    var result="";
    //Draw the "full" stars
    for(i=1;i<=numStars;i++)
    {  
        if(i%2==1) result+="<a href='javascript: void(0);' onClick='return drawStars("+(i+1)+","+fieldID+",\""+hiviz+"\")'>";
        
        if(i%2==1) result+= "<img src='theme/"+hiviz+"star_full_odd.png' />"; 
        if(i%2==0) result+= "<img src='theme/"+hiviz+"star_full_even.png' />";

        if(i%2==0) result+="</a>";
    }
    //Complete with "Empty" stars
    for(j=i;j<=10;j++)
    {
        if(j%2==1) result+="<a href='javascript: void(0);' onClick='return drawStars("+(j+1)+","+fieldID+",\""+hiviz+"\")'>";

        if(j%2==1) result+= "<img src='theme/"+hiviz+"star_empty_odd.png' />";
        if(j%2==0) result+= "<img src='theme/"+hiviz+"star_empty_even.png' />";

        if(j%2==0) result+="</a>";
    }

    $("star"+fieldID).innerHTML=result;  //Draw the Stars
    $("iF_"+fieldID).value=numStars; //Update the result 
    return false;  //Go nowhere
}

