var xs=new Array();
xs["quienes_somos"]=210;
xs["rotulacion"]=660;
xs["serigrafia"]=1100;
xs["tampografia"]=1550;
xs["imprenta"]=2000;
xs["diseno_grafico"]=2450;
xs["donde_estamos"]=2880;
xs["portfolio"]=3310;
xs["contacto"]=3748;
xs["left"]=0;
var inte;
var step;
var substep;
var lastsc;
var positivo=true;
window.onload=function() {
	var as=document.getElementsByClassName("scrollto");
	var href;
	for(i=0;i<as.length;i++) {
		href=as[i].getAttribute("href").split("#");
		as[i].setAttribute("href","javascript:scrolla('"+href[1]+"');");
	}
	
	as=document.getElementsByClassName("scrollto_left");
	for(i=0;i<as.length;i++) {
		as[i].setAttribute("href","javascript:scrolla('left');");
	}
	
	if(sinit) scrolla(sinit);
}
function scrolla(q) {
	var pos=getScrollXY();
	step=0;
	substep=0;
	if(xs[q]>pos[0]) positivo=true; else positivo=false;
	//alert(positivo);
	clearInterval(inte);
	inte=setInterval(scrollright,10,xs[q]);
}
function scrollright(m) {
	var pos=getScrollXY();
	lastsc=pos[0];
	if((positivo&&pos[0]<m)||(!positivo&&pos[0]>m)) {
		if(substep%2==0) {
			if(positivo&&(pos[0]+104>=m&&step>1)) {
				step-=1;
			} else if(!positivo&&(pos[0]-104<=m&&step<0)) {
				step+=1;
			} else {
				if((positivo&&step<10)||(!positivo&&step>-10)) {
					if(positivo) step+=1; else step-=1;
				}
			}
		}
		substep++;
		window.scrollBy(step,0);
		pos=getScrollXY();
		if(pos[0]==lastsc) clearInterval(inte);
	} else {
		clearInterval(inte);
	}
}
function getScrollXY() {
    var x = 0, y = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
        // Netscape
        x = window.pageXOffset;
        y = window.pageYOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        // DOM
        x = document.body.scrollLeft;
        y = document.body.scrollTop;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        // IE6 standards compliant mode
        x = document.documentElement.scrollLeft;
        y = document.documentElement.scrollTop;
    }
    return [x, y];
}


document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++) {
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
/*@cc_on
(function(f){
 window.setTimeout =f(window.setTimeout);
 window.setInterval =f(window.setInterval);
})(function(f){return function(c,t){var a=[].slice.call(arguments,2);return f(function(){c.apply(this,a)},t)}});
@*/