// JavaScript Document



/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a class="dropmenu" href="energy-performance-certificate-rdsap.html">Residential (RdSAP)</a>'
menu1[1]='<a class="dropmenu" href="energy-performance-certificate-sbem.html">Commercial (SBEM)</a>'
menu1[2]='<a class="dropmenu" href="energy-performance-certificate-decs.html">Public Buildings (DECs) </a>'
menu1[3]='<a class="dropmenu" href="energy-performance-certificate-sap-based-epc.html">New Builds (SAP-Based)</a>'
menu1[4]='<div align="right"><a class="topmenu2" href="survey-wizard.html" align="right">NOT SURE?<br>&nbsp;*Try our Survey Wizard*</a></div>'
menu1[5]='<div align="center"><a class="topmenu2" href="buy-online.html">--------- BUY ONLINE ---------</a></div>'

//Contents for menu 2, and so on
var menu2=new Array()
menu2[0]='<a class="dropmenu" href="property-surveys-valuation.html">S1. Valuation</a>'
menu2[1]='<a class="dropmenu" href="property-surveys-homebuyers.html">S2. Home Buyers</a>'
menu2[2]='<a class="dropmenu" href="property-surveys-full-structural-building-survey.html">S3. Full Structural Building</a>'
menu2[3]='<a class="dropmenu" href="property-surveys-developers-site-survey.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Developers Site Survey</a>'
menu2[4]='<a class="dropmenu" href="property-surveys-home-condition-report.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home Condition Report</a>'
menu2[4]='<a class="dropmenu" href="property-surveys-single-survey.html">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Single Survey - Scotland Only</a>'
menu2[5]='<div align="right"><a class="topmenu2" href="survey-wizard.html" align="right">NOT SURE?<br>&nbsp;*Try our Survey Wizard*</a></div>'
menu2[6]='<div align="center"><a class="topmenu2" href="buy-online.html">--------- BUY ONLINE ---------</a></div>'

var menu3=new Array()
menu3[0]='<a class="dropmenu" href="plans-and-drawings.html">Design and Plans</a>'
menu3[1]='<a class="dropmenu" href="project-management.html">Project Management</a>'
menu3[2]='<div align="center"><a class="topmenu2" href="get-a-quote.html">---- GET A QUOTE ----</a></div>'

var menu4=new Array()
menu4[0]='<a class="dropmenu" href="home-information-packs-what-is-a-hip.html">What is a HIP?</a>'
menu4[1]='<a class="dropmenu" href="home-information-packs-pack-contents.html">Pack contents</a>'
menu4[2]='<a class="dropmenu" href="home-information-packs-pack-basic-or-plus-personal-or-official.html">HIP Basic or HIP Plus?</a>'
menu4[3]='<div align="right"><a class="topmenu2" href="home-information-packs-for-home-seller.html">*Selling your Home?*</a></div>'
menu4[4]='<div align="right"><a class="topmenu2" href="home-information-packs-estate-agents-and-solicitors.html">*Estate Agent or Solicitor?*</div></a>'
menu4[5]='<div align="center"><a class="topmenu2" href="buy-online.html">--------- BUY ONLINE ---------</a></div>'

var menu5=new Array()
menu5[0]='<a class="dropmenu" href="property-searches-digital-maps.html">Digital Maps</a>'
menu5[1]='<a class="dropmenu" href="property-searches-water-and-drainage-searches.html">Drainage</a>'
menu5[2]='<a class="dropmenu" href="property-searches-environmental-searches.html">Environmental</a>'
menu5[3]='<a class="dropmenu" href="property-searches-flooding-searches.html">Flooding</a>'
menu5[4]='<a class="dropmenu" href="property-searches-land-registry-searches.html">Land Registry</a>'
menu5[5]='<a class="dropmenu" href="property-searches-local-authority-searches.html">Local Authority</a>'
menu5[6]='<a class="dropmenu" href="property-searches-mining-searches.html">Mining</a>'
menu5[7]='<a class="dropmenu" href="property-searches-planning-searches.html">Planning</a>'
menu5[8]='<div align="right"><a class="topmenu2" href="property-searches-for-solicitors.html">*Are you a Solictor?*</a></div>'
menu5[9]='<div align="center"><a class="topmenu2" href="buy-online.html">--- BUY ONLINE ---</a></div>'
		
var menuwidth='400px' //default menu width
var menubgcolor='#e0f0f0'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="no" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible

else if (e.type=="click")
	obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
	
if (window.event) 
{
	event.cancelBubble=true
	
}
else if (e.stopPropagation) e.stopPropagation()


clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")-7+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+5+obj.offsetHeight+"px"
resetTabGraphics();
 setTabGraphics(menucontents);
}

 
 

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){

	
if (ie4&&!dropmenuobj.contains(e.toElement))
{
	restoreTabGraphics();
delayhidemenu()

}
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
{restoreTabGraphics();
delayhidemenu()

}


}

function hidemenu(e){
	
	
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
{
restoreTabGraphics();
dropmenuobj.style.visibility="hidden"

}

}
}

function delayhidemenu(){
	
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)

}

function clearhidemenu(){
	
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

function resetTabGraphics(){
document.getElementById('p1').style.backgroundImage = "url(img/menu/s.gif)";
document.getElementById('p2').style.backgroundImage = "url(img/menu/e.gif)";
document.getElementById('p3').style.backgroundImage = "url(img/menu/e.gif)";
document.getElementById('p4').style.backgroundImage = "url(img/menu/e.gif)";
document.getElementById('p5').style.backgroundImage = "url(img/menu/e.gif)";
document.getElementById('p6').style.backgroundImage = "url(img/menu/e.gif)";
document.getElementById('p7').style.backgroundImage = "url(img/menu/e_e.gif)";

document.getElementById('t1').style.backgroundImage = "url(img/menu/m.gif)";
document.getElementById('t2').style.backgroundImage = "url(img/menu/m.gif)";
document.getElementById('t3').style.backgroundImage = "url(img/menu/m.gif)";
document.getElementById('t4').style.backgroundImage = "url(img/menu/m.gif)";
document.getElementById('t5').style.backgroundImage = "url(img/menu/m.gif)";
document.getElementById('t6').style.backgroundImage = "url(img/menu/m.gif)";

document.getElementById('p1').style.width = "11";
document.getElementById('p2').style.width = "13";
document.getElementById('p3').style.width = "13";
document.getElementById('p4').style.width = "13";
document.getElementById('p5').style.width = "13";
document.getElementById('p6').style.width = "13";
document.getElementById('p7').style.width = "12";
}




function setTabGraphics(num){
	
	var thisTAB = 6;
	
	if (num==menu1 || num==1)
		thisTAB = 1;
	else if (num==menu2 || num== 2)
		thisTAB = 2;
	else if (num==menu3 || num==3)
		thisTAB = 3;
	else if (num==menu4 || num==4)
		thisTAB = 4;
	else if (num==menu5 || num==5)
		thisTAB = 5;
	else thisTAB = 6;
	
	
	if (thisTAB==1)
	{
		document.getElementById('p1').style.backgroundImage = "url(img/menu/o_s_1.gif)";
		document.getElementById('t1').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p2').style.backgroundImage = "url(img/menu/o_e.gif)";
		document.getElementById('p1').style.width = "8";
		document.getElementById('p2').style.width = "18";
	}
	if (thisTAB==2)
	{
		document.getElementById('p2').style.backgroundImage = "url(img/menu/o_s_2.gif)";
		document.getElementById('t2').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p3').style.backgroundImage = "url(img/menu/o_e.gif)";
		document.getElementById('p2').style.width = "11";
		document.getElementById('p3').style.width = "18";
	}
	if (thisTAB==3)
	{
		document.getElementById('p3').style.backgroundImage = "url(img/menu/o_s_2.gif)";
		document.getElementById('t3').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p4').style.backgroundImage = "url(img/menu/o_e.gif)";
		document.getElementById('p3').style.width = "11";
		document.getElementById('p4').style.width = "18";
	}
	if (thisTAB==4)
	{
		document.getElementById('p4').style.backgroundImage = "url(img/menu/o_s_2.gif)";
		document.getElementById('t4').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p5').style.backgroundImage = "url(img/menu/o_e.gif)";
		document.getElementById('p4').style.width = "11";
		document.getElementById('p5').style.width = "18";
	}
	if (thisTAB==5)
	{
		document.getElementById('p5').style.backgroundImage = "url(img/menu/o_s_2.gif)";
		document.getElementById('t5').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p6').style.backgroundImage = "url(img/menu/o_e.gif)";
		document.getElementById('p5').style.width = "11";
		document.getElementById('p6').style.width = "18";
	}
	if (thisTAB==6)
	{
		document.getElementById('p6').style.backgroundImage = "url(img/menu/o_s_2.gif)";
		document.getElementById('t6').style.backgroundImage = "url(img/menu/o_m.gif)";
		document.getElementById('p7').style.backgroundImage = "url(img/menu/o_e_2.gif)";
		document.getElementById('p6').style.width = "11";
		document.getElementById('p7').style.width = "11";
	}
	
	
}



function restoreTabGraphics(){
	var myab1 = document.getElementById('thisPage').value;
	
		resetTabGraphics();
		setTabGraphics(myab1);
		
	
}





home_red = new Image();
home_red.src = "img/menu/home_red.gif";


LatestNews = new Image();
LatestNews.src = "img/icons/latest-news-over.gif";

PostcodeCoverage = new Image();
PostcodeCoverage.src = "img/icons/postcode-coverage-over.gif";

BuyOnline = new Image();
BuyOnline.src = "img/icons/buy-online-over.gif";

SurveyWizard = new Image();
SurveyWizard.src = "img/icons/survey-wizard-over.gif";




