danik.js,
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
div{ height : 50px ; width : 50px; margin : 1px; background-color : black; border-radius : 25px; border: solid 1px #000;text-align: center;}
</style>
<script type="text/javascript">
function plugin(s,b) {
b.push(b[1]);
Array.prototype.forEach.call(document.querySelectorAll(s), function(d,f){
var a = 0,
e = ["#008000", "#FFFF00", "#FF0000", "#FFFF00"],
c = function () {
d.style.backgroundColor = e[a] ;
window.setTimeout(c, 1E3 * b[a]);
a = ++a % 4
};
c()
})
};
</script>
<script type="text/javascript">
window.onload=function(){
plugin(".box",[8,2,8]);
plugin(".too",[2,2,2]);
}
</script>
<title></title>
</head>
<body>
<div class="box">is box</div>[8,2,8]
<div class="too">is too</div>[2,2,2]
</body>
</html>