//Geht durch jeden Knoten des DOM Dokuments
//als Filter dient func
var walk_DOM = function walk(node, func){
func(node);
node = node.firstChild;
	while (node){
		walk(node,func);
		node = node.nextSibling;
	}
};

/* alle Namen der Knoten werden angezeigt
walk_DOM(document.body,function(node){
	document.writeln('Name: ',node.nodeName);
}); */

//alle Knoten mit einem Bestimmten Attribut+Wert werden angezeigt
var getElementsByAttribute= function(att,value){
	var result =[];
	walk_DOM(document.body, function (node){
		var actual = node.nodeType === 1 && node.getAttribute(att);
		if (typeof actual === 'string' &&
			(actual === value||typeof value !== 'string')){
			result.push(node);
			}
		});
		return result;
	};


var getElementsByClass= function(mclass){
	var result =[];
	walk_DOM(document.body, function (node){
		if (node.className === mclass){
			result.push(node);
			}
		});
		return result;
	};


//fügt zu den in einem array gespeicheten dokumentnodes events hinzu
var add_handlers_lines =function(nodes){
	var i;
	for (i = 0;i<nodes.length;i += 1){
		nodes[i].onmouseover = function(i){
			return function(e){
				nodes[i].style.backgroundColor='#ffffff';
			};
		}(i);
		nodes[i].onmouseout = function(i){
			return function(e){
				nodes[i].style.backgroundColor='#e1dcd6';
			};
		}(i);
	}
};

function set_events(){
	var mnode=getElementsByClass("lines");
	add_handlers_lines(mnode);
}





