function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
}

function startList() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("topmenu");
		for (i=0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

function movePageInit() {
	oScroller = $('main');
	oWrapper = $('pages');
	oBody = document.body;
	pageTween = new Tween(oScroller, 'scrollLeft','',0, 10,1,'');
	pageTween.func = Tween.strongEaseOut;

	var docUrl = self.document.location.hash;
	if(docUrl.charAt(0) == '#') {
		var pageId = unescape(docUrl.substring(1)).replace(new RegExp(/(^\/*)|(\/*$)/gi),"");
		moveToPage(pageId);
	}
}

function moveToPage(pageId) {
	oPage = $(pageId);
	oBody.id = pageId.substr(5);
	x = oPage.offsetLeft - oWrapper.offsetLeft;
	pageTween.continueTo(x, 0.5);
	//oScroller.scrollLeft = x;
}


function womOn(){
  window.onload = womGo;
}
function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}
function womAdd(func){
  woms[woms.length] = func;
}
var woms = new Array();


womAdd('externalLinks()');
womAdd('startList()');
womAdd('movePageInit()');
womOn();

