// **************************************************************************
var $intro = new PAGE("$intro","intro.php","Introduction")
var $disclaimer = new PAGE("$disclaimer","disclaimer.php","Disclaimer")
var $maillist = new PAGE("$maillist","MailingList.php","Our Mailing List")
var $preferences = new PAGE("$preferences","preferences.php","User Preferences")
var $sitemap = new PAGE("$sitemap","sitemap.php","Site Map")
var $people = new PAGE("$people","people/","People")
var $places = new PAGE("$places","places/","Places")
var $things = new PAGE("$things","things/","Things")
var $history = new PAGE("$history","history/","History (2010)")

var $bellville = new PAGE("$bellville","bellville.php","Tour of Bellville, Texas")
var $directions = new PAGE("$directions","directions.php","Directions")
var $oktoberfest = new PAGE("$oktoberfest","Oktoberfest2006.php","Oktoberfest 2006")

var $larry = new PAGE("$larry","larry.php","Larry")
var $marsha = new PAGE("$marsha","marsha.php","Marsha")

var $house = new PAGE("$house","house/","Farm House")
var $htour = new PAGE("$htour","tour/","Tour")
var $entryhall = new PAGE("$entryhall","entry.php","Entry Hall")
var $living = new PAGE("$living","living.php","Living Room")
var $dining = new PAGE("$dining","dining.php","Dining Room")
var $kitchen = new PAGE("$kitchen","kitchen.php","Kitchen")
var $laundry = new PAGE("$laundry","laundry.php","Laundry Room")
var $powder = new PAGE("$powder","powder.php","Powder Room")
var $mstrbath = new PAGE("$mstrbath","mstrbath.php","Master Bath")
var $mstrbedroom = new PAGE("$mstrbedroom","mstrbedroom.php","Master Bedroom")
var $office = new PAGE("$office","office.php","Office")
var $studio = new PAGE("$studio","studio.php","Studio")
var $library = new PAGE("$library","library.php","Library")
var $bedroom2 = new PAGE("$bedroom2","bedroom2.php","Bedroom #2")
var $bedroom3 = new PAGE("$bedroom3","bedroom3.php","Bedroom #3")
var $guestbath = new PAGE("$guestbath","guestbath.php","Guest Bath")
var $hconst = new PAGE("$hconst","construction/","Construction History")
var $hconst0008 = new PAGE("$hconst0008","const0008.php","August, 2000")
var $hconst0009 = new PAGE("$hconst0009","const0009.php","September, 2000")
var $hconst0010 = new PAGE("$hconst0010","const0010.php","October, 2000")
var $hconst0011 = new PAGE("$hconst0011","const0011.php","November, 2000")
var $hconst0012 = new PAGE("$hconst0012","const0012.php","December, 2000")
var $hconst0101 = new PAGE("$hconst0101","const0101.php","January, 2001")
var $hconst0102 = new PAGE("$hconst0102","const0102.php","February, 2001")
var $hconst0103 = new PAGE("$hconst0103","const0103.php","March, 2001")
var $hconst0104 = new PAGE("$hconst0104","const0104.php","April, 2001")
var $hconst0105 = new PAGE("$hconst0105","const0105.php","May, 2001")
var $hconst0106 = new PAGE("$hconst0106","const0106.php","June, 2001")
var $hconst0107 = new PAGE("$hconst0107","const0107.php","July, 2001")

var $garage = new PAGE("$garage","garage/","Garage")
var $gplans = new PAGE("$gplans","plans.php","Plans")
var $gconst = new PAGE("$gconst","construction.php","Construction History")
var $gconst0008 = new PAGE("$gconst0008","const0008.php","August, 2000")
var $gconst0009 = new PAGE("$gconst0009","const0009.php","September, 2000")
var $gconst0010 = new PAGE("$gconst0010","const0010.php","October, 2000")
var $gconst0011 = new PAGE("$gconst0011","const0011.php","November, 2000")
var $gconst0012 = new PAGE("$gconst0012","const0012.php","December, 2000")
var $gconst0101 = new PAGE("$gconst0101","const0101.php","January, 2001")
var $gconst0102 = new PAGE("$gconst0102","const0102.php","February, 2001")
var $gconst0103 = new PAGE("$gconst0103","const0103.php","March, 2001")
var $gconst0104 = new PAGE("$gconst0104","const0104.php","April, 2001")
var $gconst0105 = new PAGE("$gconst0105","const0105.php","May, 2001")
var $gconst0106 = new PAGE("$gconst0106","const0106.php","June, 2001")
var $gconst0107 = new PAGE("$gconst0107","const0107.php","July, 2001")

var $station = new PAGE("$station","station/","Station")
var $stour = new PAGE("$stour","tour/","Tour")
var $splatform = new PAGE("$splatform","platform.php","Platform")
var $skitchen = new PAGE("$skitchen","kitchen.php","Kitchen")
var $sbrewery = new PAGE("$sbrewery","brewery.php","Brewery")
var $sbath = new PAGE("$sbath","bath.php","Bath")
var $sconst = new PAGE("$sconst","construction/","Construction History")
var $sconst0008 = new PAGE("$sconst0008","const0008.php","August, 2000")
var $sconst0009 = new PAGE("$sconst0009","const0009.php","September, 2000")
var $sconst0010 = new PAGE("$sconst0010","const0010.php","October, 2000")
var $sconst0011 = new PAGE("$sconst0011","const0011.php","November, 2000")
var $sconst0012 = new PAGE("$sconst0012","const0012.php","December, 2000")
var $sconst0101 = new PAGE("$sconst0101","const0101.php","January, 2001")
var $sconst0102 = new PAGE("$sconst0102","const0102.php","February, 2001")
var $sconst0103 = new PAGE("$sconst0103","const0103.php","March, 2001")
var $sconst0104 = new PAGE("$sconst0104","const0104.php","April, 2001")
var $sconst0105 = new PAGE("$sconst0105","const0105.php","May, 2001")
var $sconst0106 = new PAGE("$sconst0106","const0106.php","June, 2001")
var $sconst0107 = new PAGE("$sconst0107","const0107.php","July, 2001")

var $gardens = new PAGE("$gardens","gardens/","Gardens")
var $botanical = new PAGE("$botanical","botanical/","Botanical Garden")
var $memorial = new PAGE("$memorial","memorial/","Memorial Garden")
var $vegetable = new PAGE("$vegetable","vegetable/","Vegetable Garden")

var $brewery = new PAGE("$brewery","brewery/","Brewery")
var $ontap = new PAGE("$ontap","ontap/","On Tap")
var $process = new PAGE("$process","process/","Brewing Process")
var $malting = new PAGE("$malting","malting.php","Malting")
var $milling = new PAGE("$milling","milling.php","Milling")
var $mashing = new PAGE("$mashing","mashing.php","Mashing")
var $sparging = new PAGE("$sparging","sparging.php","Sparging")
var $boiling = new PAGE("$boiling","boiling.php","Boiling")
var $cooling = new PAGE("$cooling","cooling.php","Cooling")
var $spooging = new PAGE("$spooging","spooging.php","Spooging")
var $fermenting = new PAGE("$fermenting","fermenting.php","Fermenting")
var $conditioning = new PAGE("$conditioning","conditioning.php","Conditioning")
var $recipes = new PAGE("$recipes","recipes/","Recipes")
var $doubleluckESB = new PAGE("$doubleluckESB","DoubleLuckESB.php","Double Luck ESB")
var $doubleluckIPA = new PAGE("$doubleluckIPA","DoubleLuckIPA.php","Double Luck IPA")
var $doubleluckDoubleBock = new PAGE("$doubleluckDoubleBock","DoubleLuckDoubleBock.php","Double Luck Double Bock")
var $BouncedCzech = new PAGE("$BouncedCzech","BouncedCzech.php","Bounced Czech")
var $LagunaMadrePaleAle = new PAGE("$LagunaMadrePaleAle","LagunaMadrePaleAle.php","Laguna Madre Pale Ale")
var $PeculiarPeculier = new PAGE("$PeculiarPeculier","PeculiarPeculier.php","Peculiar Peculier")
var $LarrysBristolCream = new PAGE("$LarrysBristolCream","LarrysBristolCream.php","Larry&#39;s Bristol Cream")
var $MarshasOldBreweryPaleAle = new PAGE("$MarshasOldBreweryPaleAle","MarshasOldBreweryPaleAle.php","Marshas&#39;s Old Brewery Pale Ale")
var $RoyalCanadianKiltedYaksmen = new PAGE("$RoyalCanadianKiltedYaksmen","RoyalCanadianKiltedYaksmen.php","Royal Canadian Kilted Yaksmen Scotch Ale")
var $MuddyMudskipperMild = new PAGE("$MuddyMudskipperMild","MuddyMudskipperMild.php","Muddy Mudskipper Mild")
var $HappyHappyJoyJoy = new PAGE("$HappyHappyJoyJoy","HappyHappyJoyJoy.php","Happy Happy Joy Joy Stout")
var $HuntforRedOktoberfest = new PAGE("$HuntforRedOktoberfest","HuntforRedOktoberfest.php","The Hunt for Red Oktoberfest")
var $StarWorts = new PAGE("$StarWorts","StarWorts.php","Star Worts")
var $EmpireStrikesBock = new PAGE("$EmpireStrikedBock","EmpireStrikesBock.php","The Empire Strikes Bock")
var $ReturnoftheRedi = new PAGE("$ReturnoftheRedi","ReturnoftheRedi.php","Return of the Redi")
var $Chingaquedito = new PAGE("$Chingaquedito","Chingaquedito.php","Cerveza Chingaquedito con Chili")
var $BavarianWeizen = new PAGE("$BavarianWeizen","BavarianWeizen.php","Bavarian Weizen")
var $doubleluckCider = new PAGE("$doubleluckCider","DoubleLuckCider.php","Double Luck Sparkling Apple Cider")
var $doubleluckMead = new PAGE("$doubleluckMead","DoubleLuckMead.php","Double Luck Light Sparkling Mead")
var $Budmilloors = new PAGE("$Budmilloors","Budmilloors.php","Super Premium Fire Brewed Budmilloors Draught Lite")
var $HatefulBitch = new PAGE("$HatefulBitch","HatefulBitch.php","Hateful Bitch")
var $BeerXX = new PAGE("$BeerXX","Beer-XX.php","Beer XX")
var $glossary = new PAGE("$glossary","glossary.php","Brewing Glossary")
var $sessions = new PAGE("$sessions","sessions/","DoubleLuck/things/brewery/sessions")

var $rrgscale = new PAGE("$rrgscale","rr-gscale/","Railroad (G Division)")
var $rrnscale = new PAGE("$rrnscale","rr-nscale/","Railroad (N Division)")
var $crossroads = new PAGE("$crossroads","crossroads/","Crossroads")

var $hist2009 = new PAGE("$hist2009","2009.php","2009")
var $hist2008 = new PAGE("$hist2008","2008.php","2008")
var $hist2007 = new PAGE("$hist2007","2007.php","2007")
var $hist2006 = new PAGE("$hist2006","2006.php","2006")
var $hist2005 = new PAGE("$hist2005","2005.php","2005")
var $hist2004 = new PAGE("$hist2004","2004.php","2004")
var $hist2003 = new PAGE("$hist2003","2003.php","2003")
var $hist2002 = new PAGE("$hist2002","2002.php","2002")
var $hist2001 = new PAGE("$hist2001","2001.php","2001")
var $hist2000 = new PAGE("$hist2000","2000.php","2000")
var $hist1999 = new PAGE("$hist1999","1999.php","1999")
var $hist1998 = new PAGE("$hist1998","1998.php","1998")

var $icons = new PAGE("$icons","$icons/","DoubleLuck/@icons")
var $images = new PAGE("$images","$images/","DoubleLuck/$images")
var $logos = new PAGE("$logos","$logos/","DoubleLuck/$logos")
var $maps = new PAGE("$maps","$maps/","DoubleLuck/$maps")
var $menus = new PAGE("$menus","$menus/","DoubleLuck/$menus")
var $photos = new PAGE("$photos","$photos/","DoubleLuck/$photos")
var $tnails = new PAGE("$tnails","$tnails/","DoubleLuck/$tnails")

// **************************************************************************
$intro.setDependents($disclaimer,$people,$places,$things,$history,$maillist,$preferences)
  $people.setDependents($larry,$marsha)
  $places.setDependents($house,$garage,$station,$gardens)
    $house.setDependents($htour,$hconst)
      $htour.setDependents($entryhall,$living,$dining,$kitchen,$laundry,$powder,$mstrbath,$mstrbedroom,$office,$studio,$library,$bedroom2,$bedroom3,$guestbath)
      $hconst.setDependents($hconst0008,$hconst0009,$hconst0010,$hconst0011,$hconst0012,$hconst0101,$hconst0102,$hconst0103,$hconst0104,$hconst0105,$hconst0106,$hconst0107)
    $garage.setDependents($gplans,$gconst)
      $gconst.setDependents($gconst0008,$gconst0009,$gconst0010,$gconst0011,$gconst0012,$gconst0101,$gconst0102,$gconst0103,$gconst0104,$gconst0105,$gconst0106,$gconst0107)
    $station.setDependents($stour,$sconst)
      $stour.setDependents($splatform,$skitchen,$sbrewery,$sbath)
      $sconst.setDependents($sconst0008,$sconst0009,$sconst0010,$sconst0011,$sconst0012,$sconst0101,$sconst0102,$sconst0103,$sconst0104,$sconst0105,$sconst0106,$sconst0107)
    $gardens.setDependents($botanical,$memorial,$vegetable)
  $things.setDependents($brewery,$rrgscale,$rrnscale,$crossroads)
    $brewery.setDependents($ontap,$process,$recipes,$glossary)
      $process.setDependents(
              $malting,$milling,$mashing,$sparging,$boiling,$cooling,$spooging,$fermenting,$conditioning)
      $recipes.setDependents(
              $doubleluckESB,$doubleluckIPA,$doubleluckDoubleBock,$BouncedCzech,
              $LagunaMadrePaleAle,$PeculiarPeculier,$LarrysBristolCream,$MarshasOldBreweryPaleAle,
              $RoyalCanadianKiltedYaksmen,$HappyHappyJoyJoy,$MuddyMudskipperMild,
              $HuntforRedOktoberfest,$StarWorts,$EmpireStrikesBock,$ReturnoftheRedi,
              $Chingaquedito,$BavarianWeizen,$doubleluckCider,$doubleluckMead,$Budmilloors)
  $history.setDependents($hist2009,$hist2008,$hist2007,$hist2006,$hist2005,$hist2004,$hist2003,$hist2002,$hist2001,$hist2000,$hist1999,$hist1998)

// **************************************************************************
$intro.expand = 1
$bellville.parent = $intro
$bellville.level = 1
$directions.parent = $intro
$directions.level = 1
$oktoberfest.parent = $intro
$oktoberfest.level = 1
$sitemap.parent = $intro
$sitemap.level = 1
$icons.parent = $intro
$icons.level = 1
$images.parent = $intro
$images.level = 1
$logos.parent = $intro
$logos.level = 1
$maps.parent = $intro
$maps.level = 1
$menus.parent = $intro
$menus.level = 1
$photos.parent = $intro
$photos.level = 1
$tnails.parent = $intro
$tnails.level = 1
$sessions.parent = $brewery
$sessions.level = 3
$HatefulBitch.parent = $brewery
$HatefulBitch.level = 3
$BeerXX.parent = $brewery
$BeerXX.level = 3

// **************************************************************************
//      PAGE class Constructor
// **************************************************************************
function PAGE(name,href,title) {
    this.name = name
    this.href = href
    this.title = title
    this.level = 0
    this.next = this
    this.prev = this
    this.parent = this
    this.lastdep = 0
    this.expand = 0
    this.dependents = new Array()
    this.setDependents = setDependents
}

// **************************************************************************
//      Define PAGE dependents
// **************************************************************************
function setDependents() {
    this.dependents = arguments
    for (var i=0; i<arguments.length; i++) {
        var j = i + 1
        this.dependents[i].parent = this
        this.dependents[i].level = this.level+1
        this.dependents[i].next = (j < arguments.length) ? this.dependents[j] : this.next
        this.dependents[i].prev = i ? this.dependents[i-1] : this
    }
    var last = arguments.length - 1
    this.dependents[last].lastdep = 1
    this.next.prev = this.dependents[last]
    this.next = this.dependents[0]
}

// **************************************************************************
//      Set the current page and adjust the menu accordingly
// **************************************************************************
function setCurrent(page) {
    var $reload = 0
    if (top.$current == null) {
        top.$current = $intro
        top.fMenu.location.reload()
    }
    var $org = top.$current
    var $rep = page
    while ($org != $rep) {
        if ($org.level >= $rep.level) {
            if (($org.dependents.length) && ($org.expand))
                $reload |= !(--$org.expand)
            $org = $org.parent
        }
        if ($rep.level >= $org.level) {
            if ($rep.dependents.length)
                $reload |= !($rep.expand++)
            $rep = $rep.parent
        }
    }
    top.$current = page
    if (top.fMenu) top.fMenu.location.reload()
    if (top.fHead) top.fHead.location.reload()
    if (top.fFoot) top.fFoot.location.reload()
}

// **************************************************************************
//      Return the complete path to a specified page
// **************************************************************************
function genPath(page) {
    var $path = (page.level) ? genPath(page.parent) : "";
    return $path.substr(0,$path.lastIndexOf("/")+1) + page.href
}
