var ief=false;
if (navigator.appVersion.indexOf("MSIE") != -1){
	version = parseFloat(navigator.appVersion.split("MSIE")[1]);
	ief = (version<7);
}
var textbox='<div id="mainText">';
function menushow(arr){
	var mn = menus[arr];
	if ( document.all ){
		document.all[mn].style.visibility = 'visible';
		document.all[mn].style.top = '1.8em';
		document.all[mn].style.left = '4px';
	}else{
		document.getElementById(mn).style.visibility ='visible';
}}
function menuhide(arr){
	var mn = menus[arr];
	if ( document.all ){
		document.all[mn].style.visibility = 'hidden';
	}else{
		document.getElementById(mn).style.visibility ='hidden';
}}
function menuClick(arr,e){
	var mn = menus[arr];
	if (e.button == 0){
	//alert(e.target);
		window.parent.location = e.target;
	} 
}
var menus= new Array("treesurgery","timber","work","about");
var menutext='<div class="menu"><a href="/" class="navbox">Home</a></div>';
menutext+='<div class="menu" onMouseOver="menushow(0);" onMouseOut="menuhide(0);" onMouseUp="menuClick(0,event);">';
menutext+='<a href="/treesurgery/index.html" class="navbox">Tree&nbsp;Surgery</a>';
menutext+='<div id="treesurgery" class="dropdown">';
menutext+='<a href="/treesurgery/treereports.html">Tree&nbsp;Reports</a>';
menutext+='<a href="/treesurgery/disease.html">Diseases</a>';
menutext+='<a href="/treesurgery/fungi.html">Fungi</a>';
menutext+='<a href="/treesurgery/technical.html">Technical</a>';
menutext+='</div></div>';
menutext+='<div class="menu" onMouseOver="menushow(2);" onMouseOut="menuhide(2);" onMouseUp="menuClick(2,event);">';	
menutext+='<a href="/work/index.html" class="navbox">Site&nbsp;Clearance</a>';
menutext+='<div id="work" class="dropdown">';
menutext+='<a href="/work/storm.html">Storm&nbsp;Damage</a>';
menutext+='<a href="/work/stumps.html">Stump&nbsp;Grinding</a>';
menutext+='<a href="/work/equipment.html">Equipment</a>';
menutext+='</div></div>';
menutext+='<div class="menu" onMouseOver="menushow(1);" onMouseOut="menuhide(1);" onMouseUp="menuClick(1,event);">';	
menutext+='<a href="/timber/index.html" class="navbox">Timber</a>';
menutext+='<div id="timber" class="dropdown">';
menutext+='<a href="/timber/merchanting.html">Merchanting</a>';
menutext+='<a href="/timber/haulage.html">Haulage</a>';
menutext+='</div></div>';
menutext+='<div class="menu" onMouseOver="menushow(3);" onMouseOut="menuhide(3);" onMouseUp="menuClick(3,event);">';
menutext+='<a href="/about/index.html" class="navbox">About...</a>';
menutext+='<div id="about" class="dropdown">';
menutext+='<a href="/about/contact.html">Contact Us</a>';
menutext+='<a href="/about/history.html">Our&nbsp;History</a>';
menutext+='<a href="/about/clientele.html">Clientele</a>';
menutext+='<a href="/about/staff.html">Our Staff</a>';
menutext+='<a href="/about/wildlife.html">Wildlife</a>';
menutext+='<a href="/about/affiliations.html">Affiliations</a>';
menutext+='<a href="/about/sitemap.html">Sitemap</a>';
menutext+='</div></div>';
function menuwrite(){
	document.write(menutext);
}
function climb(){
	var hgt="";
	var heit="";
	var mh="";
	var compCSS;
	if ( document.all ){
		hgt = document.all["bodyText"].clientHeight;
		document.all["climber"].style.height = hgt;
	}else{
		hgt = document.getElementById("bodyText").clientHeight;
		document.getElementById("climber").style.height = hgt;
		heit = parseInt(document.getElementById("mainText").clientHeight);
		compCSS=getComputedStyle(document.getElementById("mainText"),"");
		mh = parseInt(compCSS.getPropertyValue("max-height"));
		if (heit>mh){
		//max-height fix for Chrome
			document.getElementById("mainText").style.height = mh;
		}
	}
}
function climbPos(c,x,dir) {
if (ief){
  while( c.offsetParent ) {
    x -= c['offset'+dir];
    c = c.offsetParent;
  }
  x += document.documentElement['scroll'+dir] ? document.documentElement['scroll'+dir] : document.body['scroll'+dir];
  }else{
  	x=0;
  	}
  return x;
}
function footer(){
var footertxt='<div class="footer">';
	if (ief){
	footertxt+='<div id="BBTree"><a href="/"><img id="BB" src="/images/BB.gif"/></a></div>';
	}else{
	footertxt+='<div id="BBTree"><a href="/"><img id="BB" src="/images/BB.png"/></a></div>';
	}
	footertxt+='<span class="BBfooter">Benbow Brothers (Timber) Ltd.</span>';
	footertxt+='<span class="TMfooter">Timber Merchants and Tree Surgeons</span>';
	footertxt+='<span class="address">The Lodge, Lee Brockhurst, Shrewsbury, Shropshire, SY4 5SA</span>';
	footertxt+='<span class="address">Tel:-0800 5424121 Fax:-(01939) 200320</span>';
	footertxt+='<span class="copyright">&copy;2008-2010 Benbow Brothers Ltd.</span>';
	footertxt+='</div>';
document.write(footertxt);
}
function quotxt(){
var quotxt='<img src="/images/quote.';
	if (ief){
	quotxt+='gif';
	}else{
	quotxt+='png';}
quotxt+='"/>';
document.write(quotxt);	
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(climb);
