function HoverStar(starnum, movieid)
{
    for(x = 1; x <= 5; x++)//5 star total rating
    {
        var s = "star";//Setup the variable to start with the id name
        s = s + x;//Star Number
        s = s + movieid;//Star Movie ID
        if(x <= starnum)//If we are hovering at a star less than 5, show it
            document.getElementById(s).style.backgroundPosition = "0px -60px";
        else
            document.getElementById(s).style.backgroundPosition = "0px -100px";//If we make it here, then we are hovering less than 5, show the non selected version
    }
}

function ClickStar(starnum, movieid)
{
    s = "rating=";
    s = s + starnum;//Star Number
    s = s + "&movieid=";
    s = s + movieid;//Star Movie ID
    $.ajax({
        type: 'POST',
        url: 'setrating.php',
        data: s
/*        success: function(msg){
            alert(msg);
        }*/
    });

    for(x = 1; x <= 5; x++)
    {
        
        s = "star";//Setup the variable to start with the id name
        s = s + x;//Star Number
        s = s + movieid;//Star Movie ID
        if(x <= starnum)
            document.getElementById(s).style.backgroundPosition = "0px -60px";//Draw yellow star
        else
            document.getElementById(s).style.backgroundPosition = "0px -100px";//Draw unused star
            
        document.getElementById(s).value = starnum;
    }
}

function LeaveStar(starnum, movieid, value)
{
    for(x = 1; x <= 5; x++)//5 star total rating
    {
        var s = "star";//Setup the variable to start with the id name
        s = s + x;//Star Number
        s = s + movieid;//Star Movie ID
        
        if(x <= value.value)
            document.getElementById(s).style.backgroundPosition = "0px -60px";//Draw yellow star
        else
            document.getElementById(s).style.backgroundPosition = "0px -100px";//Draw unused star
    }
}
