﻿// JavaScript Document
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
thispage = location.href;

for (i=0; i<document.links.length; i++) {
	if (thispage.indexOf(document.links[i])!=-1) {
		document.links[i].className = "current";
		}
}
}

function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}

function settitle(title) {
	MM_setTextOfLayer('maptitle','','<h2>'+title+'</h2>')
}


function homeswap(title) {
	document.getElementById(title).src='im/but_'+title+'_2.gif';
	if (title=="workshops") { 
		document.getElementById('bannerimage').src='im/home_banner.jpg'; 
		document.getElementById('bannerlink').href='workshops.asp'; 
	}
	if (title=="conferences") { 
		document.getElementById('bannerimage').src='im/home_banner_2.jpg'; 
		document.getElementById('bannerlink').href='conferences.asp'; 
	}
	if (title=="expert") { 
		document.getElementById('bannerimage').src='im/home_banner_3.jpg'; 
		document.getElementById('bannerlink').href='ieemdirectory.asp'; 
	}
	
	//alert(document.getElementById('banner').src);
}
function homereset() {
	document.getElementById('workshops').src='im/but_workshops.gif';
	document.getElementById('conferences').src='im/but_conferences.gif';
	document.getElementById('expert').src='im/but_expert.gif';
		
}

function validatemember(theform) {
	msg="";
	if (theform.name.value=="") { msg=msg+" - name\n"; }
	if (theform.position.value=="") { msg=msg+" - position\n"; }
	if (theform.employer.value=="") { msg=msg+" - employer\n"; }
	if (theform.address.value=="") { msg=msg+" - address\n"; }
	if (theform.phone.value=="") { msg=msg+" - phone\n"; }
	if (theform.email.value=="") { msg=msg+" - email\n"; }
	if (theform.insurer.value=="") { msg=msg+" - insurer\n"; }
	if (theform.policynumber.value=="") { msg=msg+" - policy number\n"; }
	if (theform.policyrenewaldate.value=="") { msg=msg+" - policy renewal date\n"; }
	if (!theform.confirmcpd.checked) { msg=msg+" - CPD record confirmation\n"; }
	if (!theform.iagree.checked) { msg=msg+" - data protection statement\n"; }
	if (msg!="") {
		msg = "The following fields are required. Please correct and resubmit\n\n"+msg;
		alert(msg);
		return false
	}
	return true;
}
function replaceHtml(el, html) {
        var oldEl = (typeof el === "string" ? document.getElementById(el) : el);
        var newEl = document.createElement(oldEl.nodeName);
        // Preserve the element's id and class (other properties are lost)
        newEl.id = oldEl.id;
        newEl.className = oldEl.className;
        // Replace the old with the new
        newEl.innerHTML = html;
        oldEl.parentNode.replaceChild(newEl, oldEl);
        /* Since we just removed the old element from the DOM, return a reference
        to the new element, which can be used to restore variable references. */
        return newEl;
};
function setarea(ar){
	if(ar=='sc'){txt='<p><strong>Scotland</strong><br></p>'};
	if(ar=='ir'){txt='<p><strong>Ireland</strong><br></p>'};
	if(ar=='wa'){txt='<p><strong>Wales</strong><br></p>'};
	if(ar=='ne'){txt='<p><strong>North East England</strong><br>Darlingon<br> Durham<br> Gateshead<br> Hartlepool<br> Middlesbrough<br> Newcastle-upon-Tyne<br> North Tyneside<br> Northumberland<br> Redcar and Cleveland<br> South Tyneside<br> Sunderland<br> Stockton-on-Tees</p>'};
	if(ar=='yh'){txt='<p><strong>Yorkshire and the Humber</strong><br>Barnsley<br> Bradford<br> Calderdale<br> Doncaster<br> East Riding of Yorkshire<br> Kingston-upon Hull<br> Kirklees<br> Leeds<br> Northeast Lincolnshire<br> North Lincolnshire<br> North Yorkshire<br> Rotherham<br> Sheffield<br> York and Wakefield</p>'};
	if(ar=='nw'){txt='<p><strong>North West England</strong><br>Blackburn with Darwen<br> Blackpool<br> Bolton<br> Bury<br> Cheshire<br> Cumbria<br> Halton<br> Knowsley<br> Lancashire<br> Liverpool<br> Manchester<br> Oldham<br> Rochdale<br> Salford<br> Sefton<br> Stockport<br> St Helens<br> Tameside<br> Trafford<br> Warrington<br> Wigan<br> Wirral</p>'};
	if(ar=='em'){txt='<p><strong>East Midlands</strong><br>Derby<br> Derbyshire<br> Leicester<br> Leicestershire<br> Lincolnshire<br> Northamptonshire<br> Nottingham<br> Nottinghamshire<br> Rutland</p>'};
	if(ar=='wm'){txt='<p><strong>West Midlands</strong><br>Birmingham<br> Coventry<br> Dudley<br> Herefordshire<br> Sandwell<br> Shropshire<br> Solihull<br> Staffordshire<br> Stoke-on-Trent<br> Telford and Wrekin<br> Walsall<br> Warwickshire<br> Wolverhampton<br> Worcestershire</p>'};
	if(ar=='ee'){txt='<p><strong>East of England</strong><br>Bedfordshire<br> Cambridgeshire<br> Essex<br> Hertfordshire<br> Luton<br> Norfolk<br> Southend-on-Sea<br> Suffolk<br> Thurrock</p>'};
	if(ar=='se'){txt='<p><strong>South East England</strong><br>Bracknell Forest<br> Brighton and Hove<br> Buckinghamshire<br> East Sussex<br> Greater London<br> Hampshire<br> Isle of Wight<br> Kent<br> Medway<br> Milton Keynes<br> Oxfordshire<br> Portsmouth<br> Reading<br> Slough<br> Southampton<br> Surrey<br> West Berkshire<br> West Sussex<br> Windsor and Maidenhead<br> Wokingham</p>'};
	if(ar=='sw'){txt='<p><strong>South West England</strong><br>Bath and NE Somerset<br> Bournemouth<br> Bristol<br> Channel Islands<br> Cornwall<br> Devon<br> Dorset<br> Gloucestershire<br> Isles of Scilly<br> North Somerset<br> Plymouth<br> Poole<br> Somerset<br> South Gloucestershire<br> Swindon<br> Torbay<br> Wiltshire</p>'};
	
	replaceHtml('titles',txt);
	ar='';
//	tit=document.getElementById('titles');
//	tit.innerHTML=txt;
}
