
var theWeddingParty = {
   bridesmaids : {
      hiromi : {
         name : "Romy Nakajima",
         pic : "images/NikHiromi2.jpg",
         title : "Bridesmaid",
         home : "Tokyo, Japan",
         info : "Romy and Nikki met in Tokyo while working for a dot-com. They've spent many Sundays together shopping and eating at their favorite gyoza joint. Nikki was also a bridesmaid in Romy's wedding in the summer of 2007. "
      },
      nana : {
         name : "Annie Tram",
         pic : "images/annie.jpg",
         title : "Bridesmaid / Sister of the Bride",
         home : "El Monte, California",
         info : "Annie is Nikki's middle sister.  She's great with dogs, and she'll need to be - she's in charge of making sure than Kobe doesn't eat the bride's bouquet."         
      },
      winnie : {
         name : "Winnie Ying",
         pic : "",
         title : "Bridesmaid",
         home : "San Francisco, California",
         info : "Winnie and Nikki met while studying abroad in Taiwan.  They've been friends ever since despite rarely living on the same continent."         
      },
      sam : {
         name : "Samantha Buhler",
         pic : "images/NikSam.jpg",
         title : "Bridesmaid",
         home : "San Francisco, California",
         info : "Sam and Nikki met while working for IBM Software Group in Somers, NY. Sam knew early on that she and Nikki would be kindred spirits. Nikki was also a bridesmaid in Sam's wedding in September, 2006. "         
      },
      julie : {
         name : "Julie Tram",
         pic : "images/Julie.jpg",
         title : "Bridesmaid / Sister of the Bride",
         home : "El Monte, California",
         info : "Julie is Nikki's youngest sister.  Her sisters think she's the troublemaker in the family."         
      },
      kobe : {
         name : "Kobe (as himself)",
         pic : "images/kobe.jpg",
         title : "Ring Bearer",
         home : "New Rochelle, NY",
         info : "Kobe is a little terror who views it as his job to ensure that the ceremony has enough comedy and to make sure that no bits of lobster that fall to the floor go to waste."         
      }
   },
   groomsmen : {
      adrian : {
         name : "Adrian K. Johnson",
         pic : "images/adrian.jpg",
         title : "Best Man",
         home : "Pittsburgh, Pennsylvania",
         info : "Ben and Adrian met while at Cornell. They were roommates for 8 years and share a love for taekwondo, rock climbing, snowboarding, and travel."         
      },
      dave : {
         name : "David Watrous",
         pic : "images/davesnowboarding.jpg", //Dave.jpg",
         title : "Groomsman / Brother of the Groom",
         home : "Rochester, New York",
         info : "Brother of the Groom. Ben and Dave spent many years setting up booby traps for each other as kids."         
      },
      jeff : {
         name : "Jeffrey Hoke",
         pic : "images/hoke.jpg",
         title : "Groomsman",
         home : "York, Pennsylvania",
         info : "Jeff, Ben and Adrian shared an apartment together in Ithaca. Some of Ben's favorite memories of the apartment were of the parties, where Jeff met his now wife, Fanny."         
      },
      shag : {
         name : 'David "Shaggy" Hoeweler',
         pic : "images/shaggy.jpg",
         title : "Groomsman",
         home : "Cambridge, Massachusetts",
         info : 'Shag and Ben both love to rock climb and are frequent visitors at the Gunks in New Paltz, NY. They were roommates in Boston and both love the kitchen. Adrian, Ben and Shag spent 3 months on a climbing road-trip across the USA in a beat-up Ford Econoline van that they bought from "some Italian-guy" in Long Island.'         
      },
      shaown : {
         name : "Shaown Nandi",
         pic : "images/shaown.jpg",
         title : "Groomsman",
         home : "Greenwich, Connecticut",
         info : "Shaown and Ben met at Cornell during their senior year and Shaown is given most of the credit for setting up Nikki and Ben. Shaown has lived with Nikki for the past 3 years and now also lives with Ben. Ben and Shaown clicked over their affinity for sci-fi novels and frequent debates (over anything)."         
      }
   }
};

function buildRow( table, person ) {
   var row = document.createElement( "div" );
   row.className = "partyPerson";
   var pic = document.createElement( "img" );
   pic.className = "partyPic";
   pic.src = person.pic;
   var description = document.createElement( "div" );
   description.className = "partyPersonInfo";

   var header = document.createElement( "div" );
   header.className = "headerTable";
   
   var name = document.createElement( "div" );
   name.className = "nameCell";
   name.appendChild( document.createTextNode( person.name ));
   header.appendChild( name );

   var title = document.createElement( "div" );
   title.className = "titleCell";
   title.appendChild( document.createTextNode( person.title ));
   header.appendChild( title );

   var home = document.createElement( "div" );
   home.className = "homeCell";
   home.appendChild( document.createTextNode( person.home ));
   header.appendChild( home );

   var info = document.createElement( "div" );
   info.className = "infoCell";
   info.appendChild( document.createTextNode( person.info ));

   description.appendChild( header );
   var divider = document.createElement( "hr" );
   divider.style.clear = "both";
   description.appendChild( divider );
   description.appendChild( info );
   row.appendChild( pic );
   row.appendChild( description );
   return row;
}

function buildTable() {
   var container = dojo.byId( "weddingParty" );
   var bridesmaidTable = document.createElement( "div" );
   bridesmaidTable.className = "bridesmaidsTable";
   // For now just use one table...
   var groomsmenTable = bridesmaidTable;

   for( var maid in theWeddingParty.bridesmaids ) {
      var row = buildRow( bridesmaidTable, theWeddingParty.bridesmaids[ maid ] );
      bridesmaidTable.appendChild( row );
   };

   for( var groomsman in theWeddingParty.groomsmen ) {
      var row = buildRow( groomsmenTable, theWeddingParty.groomsmen[ groomsman ] );
      groomsmenTable.appendChild( row );
   };

   container.appendChild( bridesmaidTable );
   container.appendChild( groomsmenTable );
}

