﻿function agent(v)
     {
         return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0));
     }
     
function getX(e) 
{                          
    if(agent('msie'))
        return event.clientX+document.body.scrollLeft;
    else
        return e.pageX;
}
    
function getY(e)
{
    if(agent('msie'))
        return event.clientY+document.body.scrollTop;
    else
        return e.pageY;
}    
        
function starUpdate(e,activeStar,valueTitle) 
    {
         var v=parseInt($(valueTitle).innerHTML); 
         $(activeStar).title=v;
    }
    
function activeStar(e,star,activeStar,valueTitle,value) 
    {

        var eX=getX(e)-$(star).offsetLeft
        var eY=getY(e)-$(star).offsetTop;

        if(eX>=1 & eX<=84 & eY>=0 & eY<=19)
             {
                 $(activeStar).style.width=eX+'px';          
                 $(valueTitle).innerHTML=Math.round(eX/84*5);          
                 $(value).value = Math.round(eX/84*5);        
              }
    }


