function scrollVertical()
{
    this.box = new Array();
    this.link = new Array();
    this.time_out = null;
    this.pos_actual = null;
    this.pos_alcanzar = null;
    this.start = null;
    var _this = this;

    this.anyadirEvento = function(elemento,evento,funcion)
    {
	if(elemento.addEventListener)return elemento.addEventListener(evento,funcion,false);
        if(elemento.attachEvent)return elemento.attachEvent("on"+evento,funcion);
    }
    this.eliminarEvento = function(evento)
    {
        if(window.event){
            window.event.cancelBubble=true;
            window.event.returnValue=false;
            return
        }
        if(evento.preventDefault&&evento.stopPropagation){
            evento.preventDefault();
            evento.stopPropagation();
        }
    }
    this.scrollTop = function()
    {
        var body = document.body;
        var docu = document.documentElement;
        if(body && body.scrollTop) return body.scrollTop;
        if(docu && docu.scrollTop) return docu.scrollTop;
        if(window.pageYOffset) return window.pageYOffset;
        return 0
    }
    this.moverScroll = function()
    {
        _this.time_out = setTimeout(function(){
            if(!_this.nextStep()){
                clearTimeout(_this.time_out);
                _this.rellamada(1);
                return;
            }
            _this.rellamada(_this.nextStep());
            _this.moverScroll();
        },13)
    }
    this.init = function(){_this.anyadirEvento(window,"load",_this.load)}
    this.load = function()
    {
        var ie = false;
        if(navigator.appName != "Netscape"){
            var ieVer=/*@cc_on function(){ switch(@_jscript_version){ case 1.0:return 3; case 3.0:return 4; case 5.0:return 5;
                case 5.1:return 5; case 5.5:return 5.5; case 5.6:return 6; case 5.7:return 7; case 5.8:return 8; }}()||@*/0;
            if(/MSIE 7.0/i.test(navigator.userAgent)){ieVer=7;}
            if(ieVer <= 7){
                ie = true;
            }
        }
        _this.eliminarEvento(this);
        var nodes = document.body.childNodes;
        for(var i = 0; i < nodes.length-1; i++){
            if(nodes[i].nodeType == 1 && nodes[i].id != "preloader"){
                _this.box.push(nodes[i]);
            }
        }
        _this.link = document.getElementById('menu').getElementsByTagName('a');
        for(i = 0; i < _this.link.length; i++){
            _this.link[i].indice = i;
            _this.anyadirEvento(_this.link[i], "click", _this.eliminarEvento);
            _this.link[i].onclick = function(){
                _this.eliminarEvento(this);
                clearTimeout(_this.time_out);
                _this.pos_actual = _this.scrollTop();
                _this.pos_alcanzar = _this.box[this.indice].offsetTop;
                if(!ie){
                    _this.pos_alcanzar -= 20;
                }
                _this.start = new Date().getTime();
                _this.moverScroll();
            }
        }
    }
    this.rellamada = function(p)
    {
        var mov_scroll = _this.pos_actual + ((_this.pos_alcanzar - _this.pos_actual)*p);
        window.scrollTo(0, mov_scroll);
    }
    this.nextStep = function()
    {
        var now = new Date().getTime();
        if((now - _this.start)>1000){
            return false;
        }
        return _this.easing((now - _this.start+.001)/1000);
    }
    this.easing = function(p)
    {
        return (Math.pow((p-1), 3) +1);
    }
}
var scroll_vertical = new scrollVertical();
scroll_vertical.init();
scroll_vertical = null;
