var CB = {
addEvent : function(element, event, action){
if(element.addEventListener){
element.addEventListener(event, action, false);
}
else{
element.attachEvent("on"+event, action);
}
},
getCSS : function(rule){
if(document.styleSheets[0].cssRules){
for(var i = 0;i < document.styleSheets.length;i++){
for(var x = 0;x < document.styleSheets[i].cssRules.length;x++){
if(document.styleSheets[i].cssRules[x].selectorText == rule){
return document.styleSheets[i].cssRules[x];
}
}
}
}else{
for(var i = 0;i < document.styleSheets.length;i++){
for(var x = 0;x < document.styleSheets[i].rules.length;x++){
if(document.styleSheets[i].rules[x].selectorText == rule){
return document.styleSheets[i].rules[x];
}
}
}
}
}
}
function showLogin(e){
var x = CB.getCSS("#rekt");
x.style.border="5px solid red";
}
function hideLogin(e){
var x = CB.getCSS("#rekt");
x.style.border="5px solid green";
}
var röd = document.getElementById('röd');
CB.addEvent(röd, "click", showLogin);
var grön = document.getElementById("grön");
CB.addEvent(grön, "click", hideLogin);