js lpad

        function lpad(len,initstr,padstr)
        {
            var result="";
            for(var i=1;i<=len-initstr.toString().length;i++)
            {
                result += padstr;
            }
            result += initstr;
            return result;
        }