function event_attach( event , func )
{
	if ( window.attachEvent ){
		window.attachEvent( event , func );
	}else
	{
		if ( ( typeof( func ) ).toLowerCase() != 'function' ){
			return;
		}
		if ( ( typeof( document.event_handlers ) ).toLowerCase() == 'undefined' ){
			document.event_handlers = new Array();
		}
		if ( ( typeof( document.event_handlers[ event ] ) ).toLowerCase() == 'undefined' ){
			document.event_handlers[ event ] = new Array();
		}
		if ( ( typeof( eval( 'window.' + event ) ) ).toLowerCase() != 'function' ){
			eval( 'window.' + event + ' = function () { if ( ( typeof( document.event_handlers[ \'' + event + '\' ] ) ).toLowerCase() != \'undefined\' ) { for ( i = document.event_handlers[ \'' + event + '\' ].length - 1 ; i >= 0  ; i-- ) { document.event_handlers[ \'' + event + '\' ][ i ](); } } } ' );
		}
		document.event_handlers[ event ][ document.event_handlers[ event ].length ] = func;
	}
}		

sfFocus = function() {
	var sfEls = document.getElementsByTagName("A");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(/sffocus/,'');
		}
	}
}

function trigger() {
 sfFocus();
 sfHover();
}		

sfHover = function() {
	if (document.getElementById("nav")){
			var sfEls = document.getElementById("nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}
			}
	}
}

/*für Keyboardnavigation*/
sfKeys = function(node) {
	if (document.getElementById("nav")){
					var sfEls = document.getElementById("nav").getElementsByTagName("A");
						for (var i=0; i<sfEls.length; i++) {
							/* auch zuklappen beim verlassen einer Liste*/
							if ( sfEls[i].nextSibling && sfEls[i].nextSibling.nextSibling && sfEls[i].nextSibling.nextSibling.hasChildNodes() ){
										arr_li=sfEls[i].nextSibling.nextSibling.getElementsByTagName('LI');
											for (var j=0; j<arr_li.length; j++){
												if (arr_li[j].className.match(/last/)){
										 			arr_li[j].onkeypress=function(e) {
														if (window.event){ e = window.event; }
														if (e.keyCode){
															code2 = e.keyCode;
														}else if(e.which){
															code2 = e.which;
														}
															if(code2 == 9){
																var parentobj = this.parentNode.parentNode;
																var res2=parentobj.className.match(/sfhover/);
																	if(res2){
																				parentobj.className=parentobj.className.replace(/sfhover/,'');
																	}
															
															}
													}
												}
												
											}
						}
						
						/*original verhalten*/	
						if(sfEls[i].nextSibling && sfEls[i].nextSibling.nextSibling){
							if(sfEls[i].nextSibling.nextSibling.nodeName == 'UL'){
								sfEls[i].onkeypress=function(e) {
									if (window.event){ e = window.event; }
									if (e.keyCode){
										code = e.keyCode;
									}else if(e.which){
										code = e.which;
									}
									
									if(code != 9){
										var parentobj = this.parentNode;
										var sfEls = parentobj.parentNode.getElementsByTagName("LI");
										for (var i=0; i<sfEls.length; i++) {
											if(sfEls[i] != parentobj){
												var res=sfEls[i].className.match(/sfhover/);
												if(res){
													sfEls[i].className=sfEls[i].className.replace(/sfhover/,'');
												}
											}
										} 
										
										var res2=parentobj.className.match(/sfhover/);
										if(res2){
													parentobj.className=parentobj.className.replace(/sfhover/,'');
										} else{
											parentobj.className+=" sfhover";
										}
									} 
								}
							}
						}
					} 
		}			
}