/* ------------------------------------------------------------------------------------------------------------------
 * mobulu.com Basic Javascripts
 * Author: Robert Hilbe
 * Version: 27 November 2006
* --------------------------------------------------------------------------------------------------------------------- */

// Assigns .hover to #navigation li ------------------------------------------------------------------------------------ //


HoverNav = function() {
	var sfEls = document.getElementById("navigation").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" hover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" hover\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", HoverNav);

// Keyboard Shortcuts: Use the same shortcuts as accesskeys ------------------------------------------------------------ //

if(document.captureEvents) {
    
    // non IE (NS 4, NS 6+, Mozilla 0.9+)
    if(Event.KEYUP) {
    	document.captureEvents(Event.KEYUP);
    }
}

// when a key is pressed, run the alertkey function
document.onkeyup = alertkey;

// process the event

function alertkey(e) {
    
	if(!e) {
		if(window.event) e = window.event;
		else return;
	}
    
    // check, if focus is on input element and stop if so
    
	if(document.all) target = e.srcElement;
	else target = e.target;
	if(target.tagName == "TEXTAREA" || target.tagName == "INPUT" || e.ctrlKey || e.altKey || e.shiftKey) return;
    
    if(typeof(e.which) == 'number') {
        
        //NS 4, NS 6+, Mozilla 0.9+, Opera
        e = e.which;
        
    } else if(typeof(e.keyCode) == 'number') {
        
        //IE, NS 6+, Mozilla 0.9+
        e = e.keyCode;
        
    } else if(typeof(e.charCode) == 'number') {
        
        //also NS 6+, Mozilla 0.9+
        e = e.charCode;
        
    } else return;
 		
	// h: Homepage
	if (e == 72) showPanel('0');

	// u: Über uns
	else if (e == 85) showPanel('1');

	// a: Agenda
	else if (e == 65) showPanel('2');

	// f: Frauen
	else if (e == 70) showPanel('3');

	// k: Kontakt
	else if (e == 75) showPanel('4');

	// l: Links
	else if (e == 76) showPanel('5');
}

// ScrollLinks: Set Up Scrolling Effect for Internal Links ------------------------------------------------------------------------------- //

/*
var ScrollLinks = {

	currentHash: false,

	start: function() {

		this.scroll = new fx.Scroll({duration: 1500, transition: fx.sineOut, onComplete: function(){this.end();}.bind(this)});

		this.allinks = $c(document.getElementsByTagName('a'));

		this.allinks.each(function(lnk) {

			if ((lnk.href && lnk.href.indexOf('#') != -1) && ( (lnk.pathname == location.pathname) 

				|| ('/'+lnk.pathname == location.pathname) ) && (lnk.search == location.search)) {

				lnk.onclick = function() {

					ScrollLinks.scroll.clearTimer();

					this.initialHref = this.href;

					this.initialHash = this.hash;

					this.href = "javascript:void(0)";

					setTimeout(function() {this.href = this.initialHref;}.bind(this), 200);

					ScrollLinks.go(this);

				}

			}

		});

	},



	go: function(link) {

		this.currentHash = link.initialHash.slice(1);

		if (this.currentHash) {

			this.allinks.each(function(lnk) {

				if (lnk.id == ScrollLinks.currentHash) {

					if (window.opera) lnk =  [lnk].find('parentNode');

					ScrollLinks.scroll.scrollTo(lnk);

					return;

				}

			});

		}

	},



	end: function() {

		if (!/Konqueror|Safari|KHTML/.test(navigator.userAgent)) window.location.hash = "#"+this.currentHash;

		this.currentHash = false;

	}

}

var Position = { cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return [valueL, valueT]; } }

*/

// Onload Behaviour ------------------------------------------------------------------------------- //

function onloadStarter() {
}

window.onload = onloadStarter;