// JavaScript Document

/* Image RollOver */
function imgSwap(el){
	var imgContainer = document.getElementById(el);
	var imgAnchor = imgContainer.getElementsByTagName("a");
	for(var i=0; i<imgAnchor.length; i++){
		if(imgAnchor.item(i).className == "roll")
			imglist = imgAnchor.item(i);
		else
			continue;
		imglist.container = imgContainer;
		imglist.imgEl = imglist.getElementsByTagName("img").item(0);
		imglist.onmouseover = imglist.onblur = function imgSwapEvent(){
			current = this.container.current;
			if(current == this) return false;
			if(current){
				current.imgEl.src = current.imgEl.src.replace("on.gif", ".gif");
				if(current.imgEl){
					current.imgEl.src = current.imgEl.src.replace("on.gif", ".gif");
				}
			}
			if(this.imgEl){
				this.imgEl.src = this.imgEl.src.replace(".gif", "on.gif");
			} else {
				this.imgEl.src = this.imgEl.src.replace("on.gif", ".gif");
			}
			this.container.current = this;
			return false;
		}
	}
}


/* toggle Menu */
function toggleInit(el){
		
	var container = document.getElementById(el);
	var toggleAnchor = container.getElementsByTagName("a");
	var toggleView = container.getElementsByTagName("div");
	
	for(var i=0; i<toggleAnchor.length; i++){
		if(toggleAnchor.item(i).className == "toggle")
			togglemenu = toggleAnchor.item(i);
		else
			continue;
			
		togglemenu.targetContainer = container;
		togglemenu.targetEl = document.getElementById(toggleAnchor.item(i).href.split("#")[1]);
		togglemenu.targetEl.style.display = "none";
		togglemenu.onclick = togglemenu.onfocus = function toggleView(){
			current = this.targetContainer.current;
			
			if(this == current) return false;
			
			if(current){
				current.targetEl.style.display = "none";
				current.className = "";
				if(current.targetEl){
					current.targetEl.style.display = "none";
					current.className = current.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			
			if(this.targetEl){
				this.targetEl.style.display = "block";
				this.className = this.className.replace("", " on");
			} else {
				this.targetEl.style.display = "none";
				this.className = this.className.replace(" on", "");
			}
			
			this.targetContainer.current = this;
			return false;
		}
		if (!togglemenu.targetContainer.first)
			togglemenu.targetContainer.first = togglemenu;
	}
	if (container.first)
		container.first.onclick();
}




			
