/* 
Paul Sowden's JavaScript switcher as detailed on:
http://www.alistapart.com/articles/alternate/
*/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);



/***********************************************
* 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 POWYS LHB
var menu1=new Array()
menu1[0]='<a href="http://www.wales.nhs.uk/sites3/home.cfm?orgid=501">- Home</a>'
menu1[1]='<a href="http://www.wales.nhs.uk/sites3/page.cfm?orgid=501&pid=7874">- Agenda for Change</a>'
menu1[2]='<a href="mailto:gillian.todd@powyslhb.wales.nhs.uk">- Email Gill Todd</a>'

//Contents for menu 2 FINANCIAL
var menu2=new Array()
menu2[0]='<a href="http://www.cahoot.com">- Cahoot</a>'
menu2[1]='<a href="http://www.halifax.co.uk">- Halifax</a>'
menu2[2]='<a href="http://www.hsbc.co.uk">- HSBC</a>'
menu2[3]='<a href="http://www.lloydstsb.co.uk">- Lloyds</a>'
menu2[4]='<a href="http://www.natwest.com">- Natwest</a>'
menu2[5]='<a href="http://www.barclays.co.uk">- Barclays</a>'
menu2[6]='<a href="http://www.nhspa.gov.uk/">- Pensions</a>'
menu2[7]='<a href="http://www.nsandi.com/products/pb/index.jsp">- Premium Bonds</a>'

//Contents for menu 3 MAIL + INTERNET SERVICE PROVIDERS
var menu3=new Array()
menu3[0]='<a href="http://webmail.streamlinenet.co.uk/mail/">- Prescriptions</a>'
menu3[1]='<a href="http://www.aol.co.uk/">- AOL</a>'
menu3[2]='<a href="http://edit.europe.yahoo.com/config/mail?.intl=uk">- Yahoo Mail</a>'
menu3[3]='<a href="https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl">- Google Mail</a>'
menu3[4]='<a href="http://www.bt.com">- BT</a>'
menu3[5]='<a href="http://www.streamlinenet.co.uk/">- StreamlineNet</a>'
menu3[6]='<a href="http://www.statcounter.com/">- Site Statistics</a>'
menu3[7]='<a href="http://www.freeparking.co.uk/default.asp">- Free Parking</a>'
menu3[8]='<a href="http://www.hotmail.com">- Hotmail</a>'
menu3[9]='<a href="http://www.yac.com">- YAC</a>'
menu3[10]='<a href="http://www.royalmail.com">- Royal Mail</a>'
menu3[11]='<a href="http://www.bt.com/directory-enquiries/dq_home.jsp?BV_SessionID=@@@@0646929349.1064153068@@@@&BV_EngineID=ccceadcjgmiekgicflgcefkdffndfgn.0&obsOID=13936&obsPage=/resonline/home.jsp&vStore=1356&obsType=LINK&obsNoSee=true">- 118</a>'
menu3[12]='<a href="https://www.google.com/accounts/ServiceLogin?service=cl&passive=true&nui=1&continue=http%3A%2F%2Fwww.google.com%2Fcalendar%2Frender&followup=http%3A%2F%2Fwww.google.com%2Fcalendar%2Frender">- Calendar</a>'

//Contents for menu 4 TOREX
var menu4=new Array()
menu4[0]='<a href="http://www.gp-training.net/synergy/index.htm">- Training 1</a>'
menu4[1]='<a href="http://www.gp-training.net/synergy/starting.htm">- Training 2</a>'
menu4[2]='<a href="http://www.torexhealth.co.uk/prod/premiere_synergy.htm">- Isoft</a>'

//Contents for menu 5 APPRAISAL
var menu5=new Array()
menu5[0]='<a href="http://gp.cardiff.ac.uk/">- Cardiff</a>'
menu5[1]='<a href="http://www.bmjlearning.com/planrecord/index.jsp">- BMJ Learning</a>'		
menu5[2]='<a href="https://medic.cardiff.ac.uk/myportfolio">- Med Student (new)</a>'
menu5[3]='<a href="https://medic.cardiff.ac.uk/eportfolio/login.aspx">- Med Student (old)</a>'

//Contents for menu 6 CONTRACT
var menu6=new Array()
menu6[0]='<a href="http://www.prodigy.nhs.uk/guidance.asp?gt=Smoking cessation">- Smoking Cessation</a>'
menu6[1]='<a href="http://www.prodigy.nhs.uk/guidance.asp?gt=Preconceptual counselling">- Preconception</a>'

//Contents for menu 7 JOURNALS
var menu7=new Array()
menu7[0]='<a href="http://bmj.bmjjournals.com/">- BMJ</a>'
menu7[1]='<a href="http://www.thelancet.com/">- Lancet</a>'
menu7[2]='<a href="http://www.jr2.ox.ac.uk/Bandolier/">- Bandolier</a>'
menu7[3]='<a href="http://jama.ama-assn.org/">- JAMA</a>'
menu7[4]='<a href="http://www.bnf.org/bnf/">- BNF</a>'
menu7[5]='<a href="http://www.spib.axl.co.uk/">- Toxbase</a>'

//Contents for menu 8 GUIDELINES
var menu8=new Array()
menu8[0]='<a href="http://www.gro.gov.uk/Images/B0521%20ONS%20DCAG%20Certifiers%20guidance%20as%20at%2018%20August%2008_tcm69-69976.pdf">- Death Certificates</a>'
menu8[1]='<a href="http://www.sign.ac.uk/guidelines/index.html">- SIGN</a>'
menu8[2]='<a href="http://www.nice.org.uk/">- NICE</a>'
menu8[3]='<a href="http://www.dh.gov.uk/PolicyAndGuidance/HealthAndSocialCareTopics/HealthAndSocialCareArticle/fs/en?CONTENT_ID=4070951&chk=W3ar/W">- "NSF"</a>'
menu8[4]='<a href="http://www.dvla.gov.uk/at_a_glance/content.htm">- Fit to Drive?</a>'
menu8[5]='<a href="http://bmj.bmjjournals.com/cgi/content/full/328/7440/634?ecoll">- BHS</a>'
menu8[6]='<a href="http://www.screeningservices.org.uk/btw/index_eng.asp">- Breast Test Wales</a>'
menu8[7]='<a href="http://cks.library.nhs.uk/pre_conception_advice_and_management/in_summary">- Preconception</a>'
menu8[8]='<a href="http://www.childline.org.uk/Publications.asp">- ChildLine</a>'
menu8[9]='<a href="http://www.awcpp.org.uk/areasofwork/safeguardingchildren/awcpprg/index.html">- Child Protection</a>'
menu8[10]='<a href="http://www.builthsurgery.co.uk/downloads/DomesticAbuseProtocol-Final51109.pdf">- Domestic Abuse </a>'

//Contents for menu 9 SHOPPING
var menu9=new Array()
menu9[0]='<a href="http://www.ebay.co.uk/">- Ebay</a>'
menu9[1]='<a href="http://www.amazon.co.uk">- Amazon</a>'
menu9[2]='<a href="http://www.pricerunner.co.uk/">- Price Runner</a>'
menu9[3]='<a href="http://www.kelkoo.co.uk/">- Kelkoo</a>'
menu9[4]='<a href="http://www.argos.co.uk/static/Home.htm">- Argos</a>'
menu9[5]='<a href="http://www.johnlewis.com/">- John Lewis</a>'
menu9[6]='<a href="http://www.empiredirect.co.uk/">- Empire Direct</a>'
menu9[7]='<a href="http://www.screwfix.com/app/sfd/cat/home-main.jsp?screwfixHomeTab=screfixHome&ts=57121">- Screwfix</a>'
menu9[8]='<a href="http://www.focusdiy.co.uk/page/home">- Focus</a>'
menu9[9]='<a href="http://www.marksandspencer.com/IWCatMainPageView.process?portal=decide">- M&S</a>'
menu9[10]='<a href="http://www.currys.co.uk">- Currys</a>'
menu9[11]='<a href="http://www.pcworld.co.uk">- PC World</a>'
menu9[12]='<a href="http://www.lastminute.com">- Last Minute</a>'

//Contents for menu 10 EMAIL ADDRESSES
var menu10=new Array()
menu10[0]='<a href="mailto:docril@aol.com">- Martin home</a>'
menu10[1]='<a href="mailto:Robbie.Gibbins@gp-w96007.wales.nhs.uk">- Robbie</a>'
menu10[2]='<a href="mailto:rbwfly@aol.com">- Richard home</a>'
menu10[3]='<a href="mailto:chrisandalison@aol.com">- Alison home</a>'
menu10[4]='<a href="mailto:howard.christley@gp-w96007.wales.nhs.uk">- Howard work</a>'
menu10[5]='<a href="mailto:Jane.Stephens@gp-w96007.wales.nhs.uk">- Jane</a>'
menu10[6]='<a href="mailto:Gaynor.Hooper@gp-w96007.wales.nhs.uk">- Gaynor</a>'
menu10[7]='<a href="mailto:Pat.Jones@gp-w96007.wales.nhs.uk">- Pat</a>'
menu10[8]='<a href="mailto:Sarah.Bowen@gp-w96007.wales.nhs.uk">- Sarah</a>'
menu10[9]='<a href="mailto:Amanda.Price@gp-w96007.wales.nhs.uk">- Amanda</a>'
menu10[10]='<a href="mailto:Jenny.Roberts@gp-w96007.wales.nhs.uk">- Jenny</a>'
menu10[11]='<a href="mailto:Annie.Price@gp-w96007.wales.nhs.uk">- Annie</a>'
menu10[12]='<a href="mailto:Gill.Hodgetts@gp-w96007.wales.nhs.uk">- Gill</a>'
menu10[13]='<a href="mailto:Jo.Jones@gp-w96007.wales.nhs.uk">- Jo</a>'
menu10[14]='<a href="mailto:Sandra.Davies@gp-w96007.wales.nhs.uk">- Sandra</a>'

//Contents for menu 11 ENTERTAINMENT
var menu11=new Array()
menu11[0]='<a href="http://www.arcadevillage.com/olgquarter/si/si.php3?nosound=y">- Space Invaders</a>'
menu11[1]='<a href="http://www.bargainholidays.com/home/home.asp">- Holiday Bargains</a>'
menu11[2]='<a href="http://www.latedeals.com/">- Late Deals</a>'
menu11[3]='<a href="http://www.coral.co.uk/thisislondon/login.html">- Coral</a>'
menu11[4]='<a href="http://www.bbc.co.uk/food/">- Recipes</a>'
menu11[5]='<a href="http://www.bbc.co.uk/news/">- News</a>'
menu11[6]='<a href="http://www.meto.gov.uk/">- Weather</a>'


//Contents for menu 12 HOSPITALS
var menu12=new Array()
menu12[0]='<a href="http://nww.herefordshire.nhs.uk/clinical_info/tabid/546/Default.aspx">- Hereford</a>'
menu12[1]='<a href="http://www.wales.nhs.uk/sites3/page.cfm?orgid=79&pid=725">- Nevill Hall</a>'
menu12[2]='<a href="http://www.cardiffandvale.wales.nhs.uk/portal/page?_pageid=33,482279,33_482283&_dad=portal&_schema=PORTAL">- UHW</a>'
menu12[3]='<a href="http://www.nglam-tr.wales.nhs.uk/">- Prince Charles</a>'
menu12[4]='<a href="http://www.swansea-tr.wales.nhs.uk/morriston.htm">- Morriston</a>'
menu12[5]='<a href="http://www.sath.nhs.uk/">- Royal Shrewsbury</a>'
menu12[6]='<a href="http://www.wales.nhs.uk/sites3/page.cfm?orgid=49&pid=4004">- Bronglais</a>'

//Contents for menu 13 LOCAL
var menu13=new Array()
menu13[0]='<a href="http://www.builth-wells.co.uk/">- Builth Wells</a>'
menu13[1]='<a href="http://news.bbc.co.uk/1/hi/wales/mid/">- BBC Mid Wales</a>'
menu13[2]='<a href="http://www.wyeside.co.uk/">- Wyeside</a>'
menu13[3]='<a href="http://www.njguns.co.uk/">- NJ Guns</a>'
menu13[4]='<a href="http://www.rwas.co.uk">- RWAS</a>'
menu13[5]='<a href="http://www.builthcs.co.uk">- Comm Supp</a>'
menu13[6]='<a href="http://www.fascin8.biz">- Fascin8</a>'

//Contents for menu 14 !
var menu14=new Array()
menu14[0]='<a href="http://bmj.bmjjournals.com/">- BMJ</a>'
menu14[1]='<a href="http://www.thelancet.com/">- Lancet</a>'
menu14[2]='<a href="http://www.jr2.ox.ac.uk/Bandolier/">- Bandolier</a>'
menu14[3]='<a href="http://jama.ama-assn.org/">- JAMA</a>'
menu14[4]='<a href="http://www.bnf.org/bnf/">- BNF</a>'
menu14[5]='<a href="http://www.spib.axl.co.uk/">- Toxbase</a>'

//Contents for menu 15 SHROPDOC
var menu15=new Array()
menu15[0]='<a href="http://www.shropdoc.net/">- Bookings</a>'
menu15[1]='<a href="https://hms.shropdoc.nhs.uk/hms/history.jsp?starttime=2008-01-01%2000:00:00.000&endtime=2008-01-01%2000:00:00.000">- FLAG</a>'


var menuwidth='165px' //default menu width
var menubgcolor='#FFFFFF'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //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=-500
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")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

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))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->



/***********************************************
statcounter 
***********************************************/
<!-- Start of StatCounter Code -->
var sc_project=1975740; 
var sc_invisible=0; 
var sc_partition=18; 
var sc_security="89c1beb5"; 
<!-- End of StatCounter Code -->
//-->



//from www.a1javascripts.com IMAGE PRELOADER
<!--//
//pre loader
newimage0 = new Image();
newimage0.src = "../image/Lmenubackyellow.gif";
newimage1 = new Image();
newimage1.src = "../image/Lmenubackgreen.gif";
//-->


//To open up pop up to play drs voice
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
