﻿function outputBall(num,last){
    num = num.toString();
    var count = num.length, re = "", color = "r", step = 1;
    if(num.length % 2 == 0){
        count = num.length / 2;
        step = 2;
        color = "r";
    }
    if(!last) last = 0;
    for(var i = 0; i < count; i++){
        if(count - i == last){
            color = "b";
        }
        re += '<div class="'+color+num.substr(i * step, step) +'"></div>';
    }
    document.write(re)
}

