////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
//Change only the things in this area

//Submenu width as percentage of root menu width
var submenupct = .9;

//Width of all content
var fullwidth = 750;

//Menuitem font padding in pixels
var padleft = 10;
var padright = 10;

//Main navigation IDs
var menuRoots = new Array();
function MenuRoots()
{ menuRoots = 
  [ document.getElementById("menuBar1"),
    document.getElementById("menuBar2"),
    document.getElementById("menuBar3"),
    document.getElementById("menuBar4"),
    document.getElementById("menuBar5"),
    document.getElementById("menuBar6")
  ];
  return;
}

//End changes
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////

function loadContent()
{ var mydate = new Date();
  setMYMenus();
  writeCalendar(mydate.getFullYear(),mydate.getMonth());
  MenuRoots();
  NavCells();
  var menuBars = menuRoots;
  for(var k=0; k<menuBars.length; k++)
  { var bar = new Array();
    bar = condenseIdArray(menuBars[k].childNodes);
    for(var i=0; i<bar.length; i++) 
    { if(getCmdAttr(bar[i]) != null)
      { bar[i].onclick = new Function("Do('"+getCmdAttr(bar[i])+"')");
      }
      if(getMenuAttr(bar[i]) != null)
      { var menu = document.getElementById(getMenuAttr(bar[i]));
        menu.style.visibility = "hidden";
        menu.style.width = Math.ceil(getNavCellWidth(menu)*submenupct)+"px";
        menu.style.top = "0px";
        menu.style.left = "0px";
        bar[i].onmouseover = new Function("ShowMenu('"+bar[i].id+"'); if(getCmdAttr(this)!=null){window.status=getCmdAttr(this);}else{window.status='';}");
        bar[i].onmouseout = new Function("window.status=''");
        var Items = condenseIdArray(menu.childNodes);
        for(var j=0; j<Items.length; j++)
        { var menuItem = document.getElementById(Items[j].id);
          menuItem.style.width = Math.ceil(getNavCellWidth(menuItem)*submenupct)+"px";
          if(Math.ceil(getNavCellWidth(menuItem)*submenupct) != menuItem.offsetWidth)
          { menuItem.style.width = Math.ceil(getNavCellWidth(menuItem)*submenupct) - (padleft + padright) + "px";
          }
          if(getMenuAttr(menuItem) != null)
          { if(menuItem.innerHTML.indexOf("&gt;") == -1 && menuItem.innerHTML.indexOf("&lt;") == -1)
            { if(getNavCellsIndex(menuItem) == navCells.length-2)
              { menuItem.innerHTML += "&nbsp;<font size='-2'><<</font>";
              } else
                { menuItem.innerHTML += "&nbsp;<font size='-2'>>></font>";
                }
            }
            FindSubMenu(getMenuAttr(menuItem));
          }
          if(getCmdAttr(menuItem) != null)
          { menuItem.onclick = new Function("Do('"+getCmdAttr(menuItem)+"')");
          }
          menuItem.onmouseover = new Function("highlight('"+Items[j].id+"'); if(getCmdAttr(this)!=null){window.status=getCmdAttr(this);}else{window.status='';}");
          menuItem.onmouseout = new Function("window.status=''");
        }
      } else
        { bar[i].onmouseover = new Function("HideAllMenus(); this.className='barHighlight'; if(getCmdAttr(this)!=null){window.status=getCmdAttr(this);}else{window.status='';}");
          bar[i].onmouseout = new Function("window.status=''");
        }
    }
  }
  var mouseoffcontent = document.getElementById("mouseoffcontent");
  var pagecontent = document.getElementById("pagecontent");
  var windowwidth = mouseoffcontent.offsetWidth;
  if(windowwidth > 750)
  { pagecontent.style.left = Math.ceil((windowwidth - fullwidth)/2)+"px";
    document.getElementById("bgcontent").style.left = pagecontent.style.left;
  }
  if(findPos(document.getElementById("monthoptions"))[0] != findPos(document.getElementById("selectedmonth"))[0])
  { document.getElementById("monthoptions").style.left = findPos(document.getElementById("selectedmonth"))[0]+"px";
    document.getElementById("yearoptions").style.left = findPos(document.getElementById("selectedyear"))[0]+"px";
  }
  var headheight = document.getElementById("logo").offsetHeight;
  var navheight = document.getElementById("navcell").offsetHeight;
  mouseoffcontent.style.height = Math.max(pagecontent.offsetHeight, mouseoffcontent.offsetHeight)+"px";
  document.getElementById("mainandfoot").style.height = mouseoffcontent.offsetHeight-headheight-navheight+"px";
  document.getElementById("headbg").style.height = headheight+"px";
  document.getElementById("navbgimg").style.height = navheight+"px";
  document.getElementById("leftcontent").style.width = document.getElementById("leftcontent").offsetWidth+"px";
  document.getElementById("leftholder").style.width = document.getElementById("leftcontent").offsetWidth+"px";
  document.body.style.backgroundImage = "url(/images/marble.jpg)";
  document.body.style.visibility = "visible";
}

var mapdiv;
var loading;
var map;
var geocoder;
var icon;
var place;
var badaddress = false;
var markers = new Object();
var geocodingdone = 0;
var lattotal = 0;
var longtotal = 0;
var selectaddressnum;

function loadMap()
{ if(window.location.href.indexOf("sgroup.shtml")!=-1)
  { loading = document.getElementById("loading");
    if(GBrowserIsCompatible())
    { icon = new GIcon();
      icon.image = "/images/redmarker.png";
      icon.shadow = "/images/markershadow.png";
      icon.iconSize = new GSize(12, 20);
      icon.shadowSize = new GSize(22, 20);
      icon.iconAnchor = new GPoint(6, 20);
      icon.infoWindowAnchor = new GPoint(5, 1);
      geocoder = new GClientGeocoder();
      for(var i=0; i<addresses.length; i++)
      { geocoder.getLocations(addresses[i][0], showSGAddress);
      }
      sgMap();
    } else
      { loading.innerHTML = "Sorry, your browser is not compatible with Google Maps.";
      }
  }
}

function showSGAddress(response)
{ if(!response || response.Status.code!=200)
  { badaddress = true;
  }
  else
  { place = response.Placemark[0];
    if(place.AddressDetails==null)
    { badaddress = true;
    }
    else if(place.AddressDetails.Accuracy==1)
    { addToSGMap(0);
    }
    else if(place.AddressDetails.Country==null || place.AddressDetails.Country.AdministrativeArea==null)
    { badaddress = true;
    }
    else if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea==null)
    {  if(place.AddressDetails.Country.AdministrativeArea.Locality==null ||
           place.AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare==null ||
           place.AddressDetails.Country.AdministrativeArea.Locality.PostalCode==null)
       { badaddress = true;
       }
       else
       { addToSGMap(2);
       }
    }
    else if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality==null ||
        place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare==null ||
        place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode==null)
    { badaddress = true;
    }
    else
    { addToSGMap(1);
    }
  }
}

function sgMap()
{ if(geocodingdone == addresses.length)
  { if(badaddress)
    { loading.innerHTML = "Sorry, an error occurred in loading the map.";
    } else
      { loading.style.display = "none";
        mapdiv = document.getElementById("mapdiv");
        mapdiv.style.height = "350px";
        map = new GMap2(mapdiv);
        var bounds = new GLatLngBounds();
        for(var eachmarker in markers)
        { bounds.extend(markers[eachmarker].getLatLng());
        }
        map.setCenter(new GLatLng(lattotal/geocodingdone, longtotal/geocodingdone), map.getBoundsZoomLevel(bounds));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        for(var eachmarker in markers)
        { map.addOverlay(markers[eachmarker]);
        }
        mapdiv.style.visibility = "visible";
        document.getElementById("mapnote").style.display = "block";
        document.getElementById("mouseoffcontent").style.height = document.getElementById("pagecontent").offsetHeight+"px";
      }
  } else
    { if(badaddress)
      { loading.innerHTML = "Sorry, an error occurred in loading the map.";
      } else
        { var t = setTimeout("sgMap()", 250);
        }
    }
}

function sgLocationFocus(addressnum)
{ selectaddressnum = addressnum;
  geocoder.getLocations(addresses[selectaddressnum][0],
    function(response)
    { var coordinates = addresses[selectaddressnum][0].split(",");
      if(coordinates.length==2 && !isNaN(coordinates[0]) && !isNaN(coordinates[1]))
      { place = response.Placemark[0];
        var lat = place.Point.coordinates[1];
        var long = place.Point.coordinates[0];
        var formattedaddress = addresses[selectaddressnum][1] + "<br><br>" +
            "Need <a href='http://maps.google.com/maps?f=d&daddr="+lat+","+long+"' target='_blank'>directions</a>?";
        var marker = markers[lat+","+long]
        GEvent.clearListeners(marker, "click");
        GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(formattedaddress);});
        GEvent.trigger(marker, "click");
      }
      else
      { GEvent.trigger(markers[response.Placemark[0].address],"click");
      }
    }
  );
}

function addToSGMap(addresstype) //addresstype: 0=None, 1=HasSubAdministrativeArea, 2=NoSubAdministrativeArea
{ var lat = place.Point.coordinates[1];
  var long = place.Point.coordinates[0];
  lattotal = lattotal + lat;
  longtotal = longtotal + long;
  var point = new GLatLng(lat,long);
  var marker = new GMarker(point,icon);
  var formattedaddress;
  if(addresstype == 0)
  { formattedaddress = "";
  }
  else if(addresstype == 1)
  { formattedaddress = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName+"<br>"+
      place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName+", "+
      place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName+" "+
      place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber+"<br><br>"+
          "Need <a href='http://maps.google.com/maps?f=d&daddr="+place.address+"' target='_blank'>directions</a>?";
  }
  else
  { formattedaddress = place.AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare.ThoroughfareName+"<br>"+
      place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName+", "+
      place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName+" "+
      place.AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber+"<br><br>"+
          "Need <a href='http://maps.google.com/maps?f=d&daddr="+place.address+"' target='_blank'>directions</a>?";
  }
  GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(formattedaddress);});
  if(addresstype == 0)
  { markers[lat+","+long] = marker;
  }
  else
  { markers[place.address] = marker;
  }
  geocodingdone++;
}

var maploaded = false;
var mapbutton;
var maparea;

function contactMap(address)
{ mapbutton = document.getElementById("mapbutton");
  maparea = document.getElementById("maparea");
  if(mapbutton.innerHTML=="Show Map")
  { if(!maploaded)
    { mapdiv = document.getElementById("mapdiv");
      loading = document.getElementById("loading");
      maparea.style.display = "block";
      if(GBrowserIsCompatible())
      { geocoder = new GClientGeocoder();
        geocoder.getLocations(address, showContactAddress);
      }
      else
      { maparea.style.display = "block";
        loading.innerHTML = "Sorry, your browser is not compatible with Google Maps.";
        document.getElementById("mouseoffcontent").style.height = document.getElementById("pagecontent").offsetHeight+"px";
        window.location="#map";
        mapbutton.innerHTML = "Hide Map";
        maploaded = true;
      }
    }
    else
    { maparea.style.display = "block";
      document.getElementById("mouseoffcontent").style.height = document.getElementById("pagecontent").offsetHeight+"px";
      window.location="#map";
      mapbutton.innerHTML = "Hide Map";
    }
  }
  else
  { var pagecontent = document.getElementById("pagecontent");
    var mouseoffcontent = document.getElementById("mouseoffcontent");
    var mainandfoot = document.getElementById("mainandfoot");
    maparea.style.display = "none";
    mouseoffcontent.style.height = "1px";
    mainandfoot.style.height = "1px";
    mouseoffcontent.style.height = "100%";
    mouseoffcontent.style.height = Math.max(document.getElementById('pagecontent').offsetHeight, mouseoffcontent.offsetHeight) + "px";
    mainandfoot.style.height = mouseoffcontent.offsetHeight - document.getElementById("logo").offsetHeight
                                                            - document.getElementById("navcell").offsetHeight + "px";
    mapbutton.innerHTML = "Show Map";
  }
}

function showContactAddress(response)
{ if(!response || response.Status.code!=200)
  { mapError();
  }
  else
  { place = response.Placemark[0];
    if(place.AddressDetails==null || place.AddressDetails.Country==null || place.AddressDetails.Country.AdministrativeArea==null)
    { mapError();
    }
    else if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea==null)
    {  if(place.AddressDetails.Country.AdministrativeArea.Locality==null ||
           place.AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare==null ||
           place.AddressDetails.Country.AdministrativeArea.Locality.PostalCode==null)
       { mapError();
       }
       else
       { showMap(0);
       }
    }
    else if(place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality==null ||
        place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare==null ||
        place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode==null)
    { mapError();
    }
    else
    { showMap(1);
    }
  }
}

function mapError()
{ loading.innerHTML = "Sorry, an error occurred in loading the map.";
  window.location="#map";
  mapbutton.innerHTML = "Hide Map";
  maploaded = true;
}

function showMap(hasSubAdminArea)
{ icon = new GIcon();
  icon.image = "/images/redmarker.png";
  icon.shadow = "/images/markershadow.png";
  icon.iconSize = new GSize(12, 20);
  icon.shadowSize = new GSize(22, 20);
  icon.iconAnchor = new GPoint(6, 20);
  icon.infoWindowAnchor = new GPoint(5, 1);
  var point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
  var marker = new GMarker(point,icon);
  var formattedaddress;
  if(hasSubAdminArea)
  { formattedaddress = place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName+"<br>"+
      place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName+", "+
      place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName+" "+
      place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber+"<br><br>"+
      "Need <a href='http://maps.google.com/maps?f=d&daddr="+place.address+"' target='_blank'>directions</a>?";
  }
  else
  { formattedaddress = place.AddressDetails.Country.AdministrativeArea.Locality.Thoroughfare.ThoroughfareName+"<br>"+
      place.AddressDetails.Country.AdministrativeArea.Locality.LocalityName+", "+
      place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName+" "+
      place.AddressDetails.Country.AdministrativeArea.Locality.PostalCode.PostalCodeNumber+"<br><br>"+
      "Need <a href='http://maps.google.com/maps?f=d&daddr="+place.address+"' target='_blank'>directions</a>?";
  }
  GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(formattedaddress);});
  mapdiv.style.display = "block";
  mapdiv.style.height = "350px";
  map = new GMap2(mapdiv);
  map.addMapType(G_PHYSICAL_MAP);
  map.addControl(new GLargeMapControl());
  map.addControl(new GMapTypeControl());
  map.setCenter(point, 13);
  map.addOverlay(marker);
  GEvent.trigger(marker, "click");
  loading.style.display = "none";
  document.getElementById("mapnote").style.display = "block";
  document.getElementById("mouseoffcontent").style.height = document.getElementById("pagecontent").offsetHeight+"px";
  window.location="#map";
  mapbutton.innerHTML = "Hide Map";
  maploaded = true;
}

function unLoadMap()
{ if(window.location.href.indexOf("sgroup.shtml")!=-1 || window.location.href.indexOf("/contacts/")!=-1)
  { GUnload();
  }
}

function resizeContent()
{ document.body.style.visibility="hidden";
  document.getElementById("pagecontent").style.left = "0px";
  document.getElementById("bgcontent").style.left = "0px";
  loadContent();
}

function FindSubMenu(subMenu)
{ var menu=document.getElementById(subMenu);
  menu.style.width = Math.ceil(getNavCellWidth(menu)*submenupct)+"px";
  menu.style.top = "0px";
  menu.style.left = "0px";
  menu.style.visibility = "hidden"
  var Items = condenseIdArray(menu.childNodes);
  for(var j=0; j<Items.length; j++)
  { var menuItem = document.getElementById(Items[j].id);
    menuItem.style.width = Math.ceil(getNavCellWidth(menuItem)*submenupct)+"px";
    if(Math.ceil(getNavCellWidth(menuItem)*submenupct) != menuItem.offsetWidth)
    { menuItem.style.width = Math.ceil(getNavCellWidth(menuItem)*submenupct) - (padleft + padright) + "px";
    }
    if(getMenuAttr(menuItem) != null)
    { if(menuItem.innerHTML.indexOf("&gt;") == -1 &&
           menuItem.innerHTML.indexOf("&lt;") == -1)
      { if(getNavCellsIndex(menuItem) == navCells.length-2)
        { menuItem.innerHTML += "&nbsp;<font size='-2'><<</font>";
        } else
          { menuItem.innerHTML += "&nbsp;<font size='-2'>>></font>";
          }
      }
      FindSubMenu(getMenuAttr(menuItem));
    }
    if(getCmdAttr(menuItem) != null)
    { menuItem.onclick = new Function("Do('"+getCmdAttr(menuItem)+"')");
    }
    menuItem.onmouseover = new Function("highlight('"+Items[j].id+"'); if(getCmdAttr(this)!=null){window.status=getCmdAttr(this);}else{window.status='';}");
    menuItem.onmouseout = new Function("window.status=''");
  }
} 

function ShowMenu(obj)
{ var menuBars = menuRoots;
  for(var k=0; k< menuBars.length; k++)
  { HideMenu(menuBars[k]);
    var bars = condenseIdArray(menuBars[k].childNodes);
    for(var j=0; j<bars.length; j++)
    { bars[j].className = "Bar";
    }
  }
  obj = document.getElementById(obj);
  var menu = document.getElementById(getMenuAttr(obj));
  menu.style.top = findPos(obj)[1]+obj.offsetHeight+"px";
  menu.style.left = findPos(obj)[0] + Math.ceil(getNavCellWidth(obj)*(1-submenupct)/2)+"px";
  var bar = document.getElementById(obj.id);
  bar.className="barHighlight";
  menu.style.visibility = "visible";
}

function findPos(obj)
{ var curleft = curtop = 0;
  if (obj.offsetParent)
  { curleft = obj.offsetLeft;
    curtop = obj.offsetTop;
    while (obj = obj.offsetParent)
    { curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
  }
  return [curleft,curtop];
}

function highlight(obj)
{ obj = document.getElementById(obj);
  var PElement = document.getElementById(obj.parentNode.id);
  var Elements = condenseIdArray(PElement.childNodes);
  for(var i=0;i<Elements.length;i++)
  { TE = document.getElementById(Elements[i].id);
    TE.className = "menuItem";
  }
  obj.className="ItemMouseOver";
  ShowSubMenu(obj);
}

function Do(cmd)
{ HideAllMenus();
  if(cmd.indexOf("ivgcf.rso.wisc.edu") == -1)
  { window.open(cmd,"newWindow");
  } else
    { window.location=cmd;
    }
}

function changeLocation(event,location)
{ if(event.keyCode == 13)
  { window.location = location;
    return;
  }
  if(event.keyCode == 9)
  { window.status = '';
    return;
  }
}

function HideMenu(obj)
{ if(obj.hasChildNodes()==true)
  { var child = condenseIdArray(obj.childNodes);
    for(var j=0;j<child.length;j++)
    { if(getMenuAttr(child[j]) != null)
      { var childMenu = document.getElementById(getMenuAttr(child[j]));
        HideMenu(childMenu);
        var childMenuItems = condenseIdArray(childMenu.childNodes);
        for(var i=0; i<childMenuItems.length; i++)
        { childMenuItems[i].className = "menuItem";
        }
        childMenu.style.visibility = "hidden";
        if(childMenu.innerHTML.toLowerCase().indexOf("<iframe") != -1)
        { childMenu.innerHTML = childMenu.innerHTML.substring(0,childMenu.innerHTML.toLowerCase().indexOf("<iframe"));
        }
      }
    }
  }
}

function HideAllMenus()
{ for(var i=0; i<menuRoots.length; i++)
  { HideMenu(menuRoots[i]);
    var bars = condenseIdArray(menuRoots[i].childNodes);
    for(var j=0; j<bars.length; j++)
    { bars[j].className = "Bar";
    }
  }
}

function ShowSubMenu(obj)
{ PMenu = document.getElementById(obj.parentNode.id);
  HideMenu(PMenu);
  if(getMenuAttr(obj) != null)
  { var menu = document.getElementById(getMenuAttr(obj));
    var pmenuitemleft = findPos(PMenu)[0];
    menu.style.top = findPos(obj)[1]+"px";
    var submenuwidth = Math.ceil(getNavCellWidth(obj)*submenupct);
    menu.style.left = pmenuitemleft + submenuwidth + 1 + "px";
    if(getNavCellsIndex(obj) == navCells.length-2)
    { menu.style.left = pmenuitemleft - submenuwidth - 1 + "px";
    }
    menu.style.visibility = "visible";
  }
}

function getNavCellWidth(obj)
{ var navcellsindex = getNavCellsIndex(obj);
  return findPos(navCells[navcellsindex+1])[0]-findPos(navCells[navcellsindex])[0];
}


function getNavCellsIndex(obj)
{ if(obj.id.indexOf("menuItem") != -1)
  { return 2*(parseFloat(obj.id.substr(8,1))-1);
  } else if(obj.id.indexOf("menu") != -1)
    { return 2*(parseFloat(obj.id.substr(4,1))-1);
    }
    else
    { return 2*(parseFloat(obj.id.substr(3,1))-1);
    }
}

var navCells = new Array();
function NavCells()
{ var temparray = document.getElementById("innernavrow").childNodes;
  for(var i=0,j=0; i<temparray.length; i++)
  { if(temparray[i].cellIndex != null)
    { navCells[j] = temparray[i];
      j++;
    }
  }
  return;
}

function condenseIdArray(arrayobj)
{ var temparray = new Array();
  var j=0;
  for(var i=0; i<arrayobj.length; i++)
  { if(arrayobj[i].id != null && arrayobj[i].id+"noId" != "noId")
    { temparray[j] = arrayobj[i];
      j++;
    }
  }
  return temparray;
}

function getMenuAttr(arrayobj)
{ if(arrayobj.attributes["menu"] != null)
  { return arrayobj.attributes["menu"].value;
  } else
    { for(var i=0; i<arrayobj.attributes.length; i++)
      { if(arrayobj.attributes[i].value.match("menu") != null &&
            arrayobj.attributes[i].value.match("menuItem") == null)
        { return arrayobj.attributes[i].value;
        }
      }
    }
  return null;
}

function getCmdAttr(arrayobj)
{ if(arrayobj.attributes["cmd"] != null)
  { return arrayobj.attributes["cmd"].value;
  } else
    { for(var i=0; i<arrayobj.attributes.length; i++)
      { if(arrayobj.attributes[i].value.match("http://") != null)
        { return arrayobj.attributes[i].value;
        }
      }
    }
  return null;
}