// JavaScript Document
function initiateSite(){
	$menu=$$("div#toolbar ul li");
	for($i=0; $i<$menu.length; $i++){
		$menu[$i].onmouseover=function(){
			for($x=0; $x<this.childNodes.length; $x++){
				if(this.childNodes[$x].tagName=="UL"){
					this.childNodes[$x].style.display="block";	
				}
			}
		}
		$menu[$i].onmouseout=function(){
			for($x=0; $x<this.childNodes.length; $x++){
				if(this.childNodes[$x].tagName=="UL"){
					this.childNodes[$x].style.display="none";	
				}
			}
		}
	}
	$submenu=$$("div#toolbar ul li ul li");
	for($i=0; $i<$submenu.length; $i++){
		$submenu[$i].onmouseover=function(){
			for($x=0; $x<this.childNodes.length; $x++){
				if(this.childNodes[$x].tagName=="UL"){
					this.childNodes[$x].style.display="block";	
				}
			}
			this.style.backgroundColor="#F99";
		}
		$submenu[$i].onmouseout=function(){
			for($x=0; $x<this.childNodes.length; $x++){
				if(this.childNodes[$x].tagName=="UL"){
					this.childNodes[$x].style.display="none";	
				}
			}
			this.style.backgroundColor="#FFCCCC";
		}
	}
	$buttons=$$("input.newItem");
	for($i=0; $i<$buttons.length; $i++){
		$buttons[$i].onclick=function(){
			window.location=this.id;
		}
	}
	
	$buttons=$$("input.deleteItem");
	for($i=0; $i<$buttons.length; $i++){
		$buttons[$i].onclick=function(){
			if(confirm("Are you sure you want to delete this item?\n\n  You will not be able to undo this action.")){
				window.location=this.id;
			}
		}
	}
}
initiateSite();