// JavaScript Document


// Navigation
//window.onload = init;
 
 function init() {
	   // DROPDOWNS CURRENTLY HANDLED VIA SPRY
	   //var one = $('subLiOne'); //Dropdown under 'Industrial'
	   //var two = $('subLiTwo'); //Dropdown under 'Residential'
	   //runDropDowns(one);
	   //runDropDowns(two);
		
 }

// Assign functions

/* Placement of ULs and visibility are controlled by whether they contain class name 'activeUL'
or 'inactiveUL' */
function runDropDowns(tgt) {
	var p = tgt.up(0); // Get the parent of the target drop down
	p.observe('mouseenter',watchDrop); 
	
}


function watchDrop() {
	if(!this.hasClassName('dropDownIsOpen')) {
		this.addClassName('dropDownIsOpen');
		showDropDown(this.down(0));
		this.observe('mouseleave',function() {
				this.removeClassName('dropDownIsOpen');
				hideDropDown(this.down(0));
			});
	}
}

function showDropDown(t) {
	t.removeClassName('inactiveUL');
	t.addClassName('activeUL');	
}
// t = dropped down UL
function hideDropDown(t) {
	//alert(t.up(0).inspect());
	t.removeClassName('activeUL');
	t.addClassName('inactiveUL');
	t.up(0).observe('mouseenter',watchDrop);
}




