SkipLinks = function(obj) {
	this.DOMObject = document.getElementById(obj);
	this.anchors = this.DOMObject.getElementsByTagName("a");
	if (this.anchors.length == 0) return;
	var self = this;
	for(var i = 0; i < this.anchors.length; i++) {
		this.anchors[i].onfocus = function() { 
			addClass(this, "show");
		}
		this.anchors[i].onblur = function() { 
			removeClass(this, "show"); 
		}
		this.anchors[i].onclick = function() {
			return self.doFocus(this.href.split("#")[1]);
		}
	}
}
SkipLinks.prototype.doFocus = function(obj) {
	if (!obj) return true;
	var element = document.getElementById(obj);
	var u = element.nodeName.toLowerCase();
	if (u == "a" || u == "input" || u == "select" || u == "textarea" || u == "iframe") {
		element.focus();
		return false;
	}
	var target = document.createElement("a");
	target.className = "anchorStop";
	target.href = "#"; 
	target.name = obj;
	element.insertBefore(target,element.childNodes[0]);
	target.focus();
	target.onblur = function() {
		var self = this;
		setTimeout(function() {
			self.parentNode.removeChild(self)
		}, 50);
	}
	return false;
}
SkipLinks.prototype.destroy = function() {
	if (this.anchors.length == 0) return;
	for (var i = 0; i < this.anchors.length; i++) {
		this.anchors[i].onfocus = this.anchors[i].onblur = this.anchors[i].onclick = null;
	}
}
