function get(d){ return document.getElementById(d); } var _t = []; var _int = false; function efecto(set){ if(set.id){set.obj = get(set.id);} var pos = _t.length; for(n = 0; n < _t.length; n++){ if(_t[n].obj == set.obj && _t[n].prop == set.prop){ pos = n; } } for(n = 1; n; n++){ if(set.valor.indexOf('$' + n) > -1){ var str = typeof(set["$" + n][1]) == "string"; set["$" + n][1] = Number(set["$" + n][1]); set["$" + n].push( set["$" + n][0] < set["$" + n][1] ); var vel = set["$" + n][2]; if( typeof(vel) == "string" ){ vel = (set["$" + n][3] ? set["$" + n][1] - set["$" + n][0] : set["$" + n][0] - set["$" + n][1]) / Number(vel) * 20; } if( typeof(vel) == "object" ){ vel[2] = vel[2] ? true : false; vel[3] = vel[3] ? vel[3] : 1; } set["$" + n][2] = vel; if(str){ set["$" + n][1] = String(set["$" + n][1]); } } else{ break; } } _t[pos] = set; } function aCEfectos(){ for(x = 0; x < _t.length; x++){ var valorN = _t[x].valor; var finish = true; for(n = 1; n; n++){ if(_t[x].valor.indexOf('$' + n) > -1){ var $ = _t[x]["$" + n]; var rnd = typeof($[1]) == "string"; if(rnd){ $[1] = Number($[1]); } if($[0] != $[1]){ if(typeof($[2]) == "number"){ $[0] += $[3] ? $[2] : 0 - $[2]; if(($[3] && $[0] > $[1]) || (!$[3] && $[0] < $[1])){ $[0] = $[1]; } } else{ if($[2][0]<=1){$[2][0]+=1;} if(!$[2][2]){ $[2][3] += $[2][1]; $[0] += !$[3] ? 0 - $[2][3] : $[2][3]; if(($[3] && $[0] > $[1]) || (!$[3] && $[0] < $[1])){ $[0] = $[1] + .1; $[2][3] = $[2][3] / (3 - $[2][0]); $[2][2] = true; if($[2][3] < ($[2][0] * $[2][1])){ $[0] = $[1]; } } } else if($[2][2]){ if($[2][3] > $[2][1]){ $[2][3] -= $[2][1]; $[0] += $[3] ? 0 - $[2][3] : $[2][3]; } else{ $[2][2] = false; } } } finish = false; } valorN = valorN.split("$" + n).join(rnd ? Math.round($[0]) : $[0]); if(rnd){ $[1] = String($[1]); } } else{ break; } } _t[x].obj.style[_t[x].prop.replace("style.","")] = valorN; if(finish){ var fn = _t[x].onFinish; var pr = _t[x].param; _t.splice(String(x), "1"); if(fn){ fn(pr); } } } } //*-*-*-*-*-*-*-*-*-*-*-*-*-*-* /* Esta funcion hace fadeIn en los divs que se pasan por argumanto. Ej : fadeIn("div1",0,"div2",0.3); De esta manera la opacidad del div1 va desde la actual a 0 y la del div2 a 0.3. */ //*-*-*-*-*-*-*-*-*-*-*-*-*-*-* function fadeIn(){ var array = fadeIn.arguments; // los ids a los que se va a hacer fade in for(a=0;a