(function(w){

    var cd = function(){

    },countDownClear=function(){
        timer && clearInterval(timer) ;
        },countDown=function(){
            outtime--;
            if( outtime < 0 ){
                callback && callback();
                countDownClear();
                return false ;
            }
            minutes = Math.floor(outtime / 60);
            seconds = Math.floor(outtime % 60);
            message = fill(minutes) + ' : ' + fill(seconds) ;
            document.getElementById(container).innerHTML = message;
        },
        fill=function(v){
            if(v<10) return '0'+v;
            return v;
        },
        seconds,
        message,
        minutes,
        container,
        interval = 1000,
        outtime = 0,
        callback,
        timer;

    cd.prototype.init = function(options){
        outtime = options.outtime;
        container = options.container ;
        callback = options.callback ;
        countDownClear();
        timer = setInterval(countDown,interval);
    }
    return w.countDown = new cd() ;
}(window))
