

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="/allabout/maps/default.aspx">Map & Directions</a>'
menu1[1]='<a href="/allabout/visitingthehospital/default.aspx">Visit the Hospital</a>'
menu1[2]='<a href="http://westcampus.texaschildrens.org/">West Campus</a>'
menu1[3]='<a href="/allabout/international/default.aspx">International Services</a>'
menu1[4]='<a href="/allabout/careers/default.aspx">Careers</a>'
menu1[5]='<a href="/allabout/news/default.aspx">Newsroom</a>'
menu1[6]='<a href="/advocacy/default.aspx">Legislative Advocacy</a>'
menu1[7]='<a href="/allabout/sitemap.aspx">Site Map</a>'
menu1[8]='<a href="/allabout/vendors.aspx">For Vendors</a>'
menu1[9]='<a href="/allabout/visitingthehospital/contactus.aspx">Contact Us</a>'

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="/carecenters/directory.aspx">Directory</a>'
menu2[1]='<a href="/carecenters/cancer/default.aspx">Cancer Center</a>'
menu2[2]='<a href="/carecenters/fetalsurgery/default.aspx">Fetal Center</a>'
menu2[3]='<a href="/carecenters/heart/default.aspx">Heart Center</a>'
menu2[4]='<a href="/carecenters/maternity/default.aspx">Maternity Care</a>'
menu2[5]='<a href="/carecenters/neuro/neurology/Default.aspx">Neurology</a>'
menu2[6]='<a href="/carecenters/newborn/default.aspx">Newborn Center</a>'

//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="/parents/tips.aspx">Your Child&#39;s Health</a>'
menu3[1]='<a href="/parents/advice/palintro.aspx">Parent Advice Line</a>'
menu3[2]='<a href="/Parents/ParentsConnection/Default.aspx">Parents E-newsletter</a>'
menu3[3]='<a href="/parents/patientgreeting/default.aspx">Patient Greetings</a>'
menu3[4]='<a href="/toystore/default.aspx">Toy Store</a>'

//Contents for menu 4
var menu4=new Array()
menu4[0]='<a href="/professionals/refphysicians/default.aspx">Referring Physicians</a>'
menu4[1]='<a href="/professionals/nursing/default.aspx">Nursing</a>'
menu4[2]='<a href="/professionals/ProfessionalEducation/SimulationCenter/Default.aspx">Pediatric Simulation Center</a>'
menu4[3]='<a href="/professionals/physicianliaisons/default.aspx">Physician Liaison Program</a>'
menu4[4]='<a href="/professionals/professionaleducation/default.aspx">Professional Education</a>'
menu4[5]='<a href="/professionals/fellowshipsinternships/default.aspx">Fellowship & Residency</a>'
menu4[6]='<a href="/professionals/telehealth/default.aspx">TeleHealth</a>'
menu4[7]='<a href="/carecenters/kangaroocrew/default.aspx">Kangaroo Crew</a>'
menu4[8]='<a href="/allabout/careers/default.aspx">Careers</a>'

//Contents for menu 5
var menu5=new Array()
menu5[0]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=382&srcid=382">Donate</a>'
menu5[1]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=371&srcid=371">Get Involved</a>'
menu5[2]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=741">Heal Sick Children</a>'
menu5[3]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=1076">Shine Magazine</a>'
menu5[4]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=254&srcid=254">Contact Us</a>'
menu5[5]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=445&srcid=445">Children\'s Miracle Network </a>'

//Contents for menu 6
var menu6=new Array()
menu6[0]='<a href="/parents/FunRun/">Kids\' Fun Run</a>'
menu6[1]='<a href="/allabout/visitingthehospital/carepage.aspx">Patient Web Sites</a>'
menu6[2]='<a href="/allabout/international/default.aspx">International Services</a>'
menu6[3]='<a href="/parents/patientgreeting/default.aspx">Send a Patient Greeting</a>'
menu6[4]='<a href="http://www.texaschildrenspediatrics.org" target="_default">Texas Children\'s Pediatric Associates</a>'
menu6[5]='<a href="/Health-Centers/default.aspx">Texas Children\'s Health Centers</a>'
menu6[6]='<a href="http://www.texaschildrenshealthplan.org" target="_default">Texas Children\'s Health Plan</a>'
menu6[7]='<a href="http://vision2010.texaschildrens.org/" target="_default">Vision 2010</a>'
menu6[8]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=741">Heal Sick Children Campaign</a>'
menu6[9]='<a href="/AllAbout/News/WATCH/Winter_2009/Watch_Winter2009.aspx"><i>Watch</i> Magazine</a>'
menu6[10]='<a href="https://waystogive.texaschildrens.org/NetCommunity/Page.aspx?pid=1076"><i>Shine</i> Magazine</a>'

var menuwidth='120px' //default menu width
var menubgcolor='#D2D6D4' //menu bgcolor
var disappeardelay=50 //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="-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 Newdropdownmenu(asItemId, asMaxNbr)
{
  var asObject;
  var asObject2;
  var imgBefore = 0;
  var imgAfter = 0;
  var maxTabs = asMaxNbr;

  clearMenuOptions();

  asObject = document.getElementById('imgMain0000' + asItemId);
  asObject.src = asObject.lowsrc;
  
  if (asItemId != maxTabs)
  {
    asObject2 = document.getElementById('imgSub0000' + asItemId);
    asObject2.src = asObject2.lowsrc;
  }
  

  imgAfter = asItemId - 1;

  if ( asItemId != 1)
  {
    document.getElementById('imgSub0000' + imgAfter).src = document.getElementById('imgSub0000' + imgAfter).imgAfter;
  
    if (document.getElementById('imgSub0000' + imgAfter).imgMid)
      document.getElementById('imgSub0000' + imgAfter).src = document.getElementById('imgSub0000' + imgAfter).imgMid;
  }
  
}

function clearMenuOptions(asMaxNbr)
{
  var maxTabs = asMaxNbr;

  for (var i=1; i <= maxTabs; i++)
  {
    asObject = document.getElementById('imgMain0000' + i);
    asObject2 = document.getElementById('imgSub0000' + i);

    asObject.src = asObject.imgRolln;
    if (i != maxTabs)
    {
      asObject2.src = asObject2.imgRolln;
    }
  }
}

/*
Parameters:
asPriItemId - mouseover image
priImg1 - change To Image

asAltItemId - neighbor image
altImg1 - change To Image
*/
function dropDownImageChanger(asPriItemId, priImg1, asAltItemId, altImg1)
{
  var asPriObject;
  var asAltObject;
 
  if (document.getElementById('imgMain0000' + asPriItemId))
  {
    asPriObject = document.getElementById('imgMain0000' + asPriItemId);
    asPriObject.src = priImg1;
  }
  
  if (document.getElementById('imgMain0000' + asAltItemId))
  {
    asAltObject = document.getElementById('imgMain0000' + asAltItemId);
    asAltObject.src = altImg1;

  }
}

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 spanishRedirect(a)
{
  oh = 'texaschildrenshospital.org';
  tsh = 'es.texaschildrens.org/enes/';
  idx = location.href.indexOf(tsh);
  
  if (idx == -1)
  { 
    idx = location.href.indexOf(oh) + oh.length;
    hname = tsh;
  }
  else
  {
    idx = idx + tsh.length;
    hname = 'www.' + oh;
  }
  
  path = location.href.substring(idx);
  hend = hname.charAt(hname.length-1);
  pstart = path.charAt(0);
  
  if (hend == '/' && pstart == '/')
    path = path.substring(path.indexOf('/') + 1);
  
  if(hend != '/' && pstart != '/')
    path = '/' + path;
  
  
  location.href = location.protocol + '//' + hname + path;

  return false;
}*/

function spanishRedirect(a)
{
	oh=new Array();
	tsd=new Array();
	tsh='es.texaschildrens.org';
	
	oh[0]='waystogive.texaschildrens.org';
	
	tsd[0]='/enes/sdwaystogive/';
	
	oh[1]='texaschildrens.org';
	
	tsd[1]='/enes/';
	
	idx=location.href.indexOf(tsh);
	
	if(idx==-1)
	{
	  for (i=0;i<oh.length;i++)
	  {
	    idx=location.href.indexOf(oh[i]);
	    if(idx>-1) 
	      break;
	  }
	  
	  idx=idx+oh[i].length;
	  hname=tsh+tsd[i];
	}
	else
	{
	  for (i=0;i<tsd.length;i++)
	  {
	    idx=location.href.indexOf(tsd[i]);
	    if(idx>-1) 
	      break;
	  }
	  idx=idx+tsd[i].length;hname=oh[i];
	}
	
	path=location.href.substring(idx);
	hend=hname.charAt(hname.length-1);
	pstart=path.charAt(0);
	
	if(hend=='/' && pstart=='/')
	  path=path.substring(path.indexOf('/')+1);
	
	if(hend!='/' && pstart!='/')
	  path='/'+path;
	
	a.href=location.protocol+'//'+hname+path;
	
	return true;
}


