// JavaScript Document


// ***Menu****

  function highlight(inObj){
    var theRow = inObj;
    theRow.className = "topbarcellon";
	PopulateSubMenu(theRow.id);
  }
  function noHighlight(inObj){
    var theRow = inObj;
    theRow.className = "topbarcelloff";	
  }

function PopulateSubMenu(SubID)
{		
	switch(SubID)
	{
	case "nav-home":
		ClearMenus();
	  break    
	case "nav-aboutus":
		ClearMenus();
		ChangeSubMenu('1','benefits.php','Environmental Benefits');
		ChangeSubMenu('2','aboutus.php','About Us');
		ShowMenus();
	  break
	case "nav-stone":
		ClearMenus();
		ChangeSubMenu('1','flagging.php','Natural Edge Flagging');
		ChangeSubMenu('2','stonesteps.php','Natural Stone Steps');
		ChangeSubMenu('3','crushedstone.php','Stone Mulch');
		ChangeSubMenu('4','wallstone.php','Wall Stone');
		ChangeSubMenu('5','slatestairtreads.php','Slate Stair Treads');
		ChangeSubMenu('6','cobbledslatepavers.php','Cobbled Edge Slate Pavers');
		ChangeSubMenu('7','repeatingslatepavers.php','Repeating Pattern Slate Pavers');
		ChangeSubMenu('8','naturalslabs.php','Natural Slabs');
		ChangeSubMenu('9','gardenbenches.php','Garden Benches and Spires');
		ChangeSubMenu('9','thinwallstone.php','Steppers/Coping/Thin Wall Stone');
	    ShowMenus();	
	  break
	case "nav-contact":
		ClearMenus();
		
	  break
	case "nav-gallery":
	 	ClearMenus();
	  break
	 
	default:
	  
	}
}
function ChangeSubMenu(itemNUM,LinkTO,CurText)
{	
			if (document.getElementById){
				x = document.getElementById('submenuinner');			
			}
			else if (document.all){
				x = document.all['submenuinner'];		
			}
			else if (document.layers){
				x = document.layers['submenuinner'];			
			}
			if (x.innerHTML == ""){
				x.innerHTML = "<div class=\"submenustyle\" id=\"submenitem" + itemNUM + "\" onclick=\"location.replace('" + LinkTO + "')\"><a href=\"" + LinkTO + "\"" + ">" + CurText + "</a></div>";
			}
			else{
				x.innerHTML = x.innerHTML + "<div class=\"submenustyle\" id=\"submenitem" + itemNUM + "\" onclick=\"location.replace('" + LinkTO + "')\"><a href=\"" + LinkTO + "\"" + ">" + CurText + "</a></div>";
			}
}
function ClearMenus()
{	
			if (document.getElementById){
				x = document.getElementById('submenuinner');
				document.getElementById('submenutable').style.visibility = "hidden";
			}
			else if (document.all){
				x = document.all['submenuinner'];
				document.all['submenutable'].style.visibility = "hidden";
			}
			else if (document.layers){
				x = document.layers['submenuinner'];
				document.layers['submenutable'].style.visibility = "hidden";
			}
			x.innerHTML = "";
}
function ShowMenus()
{	
			if (document.getElementById){
				document.getElementById('submenutable').style.visibility = "visible";
			}
			else if (document.all){		
				document.all['submenutable'].style.visibility = "visible";
			}
			else if (document.layers){
				document.layers['submenutable'].style.visibility = "visible";
			}
			
			
			

}


function inputin(inObj){
    inObj.className = "inputhover"
  }
function inputout(inObj){
    inObj.className = "inputhoverout"
  }
  
 function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function setLyr(obj,lyr){
	var coors = findPos(obj);
		
	if (document.getElementById){
			var x = document.getElementById(lyr)
	}
	else if (document.all){
			var x = document.all[lyr]	
	}
	else if (document.layers){
			var x = document.layers[lyr]	
	}
	x.style.top = coors[1]+24 + 'px';
	x.style.left = coors[0] + 'px';
	x.style.width = '150px';
	x.style.height = '150px';
}
