 function addOverlays(entries){

 var coxBldg = new GPolygon([
    new GLatLng('42.364238','-71.069682'),
new GLatLng('42.364097','-71.069672'),
new GLatLng('42.364002','-71.068985'),
new GLatLng('42.364062','-71.068926'),
new GLatLng('42.364238','-71.069682')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(coxBldg);
  
   var warrenBldg = new GPolygon([
    new GLatLng('42.363966','-71.069811'),
new GLatLng('42.363812','-71.069865'),
new GLatLng('42.363764','-71.06943'),
new GLatLng('42.363907','-71.069355'),
new GLatLng('42.363966','-71.069811')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(warrenBldg);
  
  var ellisonBldg = new GPolygon([
    new GLatLng('42.363673','-71.069065 '),
new GLatLng('42.36363','-71.068904 '),
new GLatLng('42.363756','-71.068894 '),
new GLatLng('42.363931','-71.069146 '),
new GLatLng('42.363931','-71.069253 '),
new GLatLng('42.363784','-71.069334 '),
new GLatLng('42.363661','-71.069586 '),
new GLatLng('42.363233','-71.069655 '),
new GLatLng('42.363415','-71.069183 '),
new GLatLng('42.363673','-71.069065 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(ellisonBldg);

  var jacksonBldg = new GPolygon([
   new GLatLng('42.363915','-71.068234 '),
new GLatLng('42.363744','-71.068277 '),
new GLatLng('42.363649','-71.06774 '),
new GLatLng('42.363796','-71.067692 '),
new GLatLng('42.363915','-71.068234 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(jacksonBldg);
  
   var greyBldg = new GPolygon([
   new GLatLng('42.36397','-71.068625 '),
new GLatLng('42.363939','-71.068373 '),
new GLatLng('42.363554','-71.068454 '),
new GLatLng('42.363618','-71.068695 '),
new GLatLng('42.36397','-71.068625 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(greyBldg);
  
  var blakeBldg = new GPolygon([
   new GLatLng('42.363931','-71.06869 '),
new GLatLng('42.363966','-71.068947 '),
new GLatLng('42.363879','-71.069039 '),
new GLatLng('42.363673','-71.068899 '),
new GLatLng('42.363657','-71.068722 '),
new GLatLng('42.363931','-71.06869 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(blakeBldg);
  
  var whiteBldg = new GPolygon([
   new GLatLng('42.363376','-71.068904 '),
new GLatLng('42.363305','-71.068282 '),
new GLatLng('42.363122','-71.068347 '),
new GLatLng('42.36313','-71.068502 '),
new GLatLng('42.362983','-71.068561 '),
new GLatLng('42.363027','-71.068733 '),
new GLatLng('42.36319','-71.068717 '),
new GLatLng('42.363221','-71.068915 '),
new GLatLng('42.363376','-71.068904 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(whiteBldg);
  
 /* var vincentBldg = new GPolygon([
   new GLatLng('42.362813','-71.069559 '),
new GLatLng('42.362781','-71.069425 '),
new GLatLng('42.362964','-71.06936 '),
new GLatLng('42.362964','-71.069248 '),
new GLatLng('42.36309','-71.069232 '),
new GLatLng('42.363102','-71.06935 '),
new GLatLng('42.363182','-71.069328 '),
new GLatLng('42.363166','-71.069489 '),
new GLatLng('42.362813','-71.069559 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(vincentBldg);*/
  
  var bulfinchBldg = new GPolygon([
  new GLatLng('42.363491','-71.0684 '),
new GLatLng('42.363384','-71.067424 '),
new GLatLng('42.363538','-71.067386 '),
new GLatLng('42.363566','-71.067515 '),
new GLatLng('42.363693','-71.067461 '),
new GLatLng('42.363721','-71.067628 '),
new GLatLng('42.36359','-71.067654 '),
new GLatLng('42.363721','-71.068357 '),
new GLatLng('42.363491','-71.0684 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(bulfinchBldg);
  
  var edwardsBldg = new GPolygon([
  new GLatLng('42.363269','-71.067113 '),
new GLatLng('42.363265','-71.067258 '),
new GLatLng('42.363661','-71.067284 '),
new GLatLng('42.363669','-71.067134 '),
new GLatLng('42.363269','-71.067113 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(edwardsBldg);
  
   var theirBldg = new GPolygon([
  new GLatLng('42.362849','-71.06744 '),
new GLatLng('42.362857','-71.067156 '),
new GLatLng('42.363213','-71.067118 '),
new GLatLng('42.363213','-71.067429 '),
new GLatLng('42.362849','-71.06744 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(theirBldg);

  var bartlettBldg = new GPolygon([
  new GLatLng('42.362789','-71.067424 '),
new GLatLng('42.362793','-71.067134 '),
new GLatLng('42.362528','-71.067134 '),
new GLatLng('42.362496','-71.067418 '),
new GLatLng('42.362789','-71.067424 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(bartlettBldg);
  
  var wangBldg = new GPolygon([
  new GLatLng('42.363035','-71.068422 '),
new GLatLng('42.362944','-71.06803 '),
new GLatLng('42.362306','-71.068041 '),
new GLatLng('42.362341','-71.068491 '),
new GLatLng('42.363035','-71.068422 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(wangBldg);
  
 /* var clinicsBldg = new GPolygon([
  new GLatLng('42.362623','-71.069645 '),
new GLatLng('42.362496','-71.069639 '),
new GLatLng('42.36248','-71.068931 '),
new GLatLng('42.362912','-71.068883 '),
new GLatLng('42.362952','-71.069071 '),
new GLatLng('42.362658','-71.069087 '),
new GLatLng('42.362623','-71.069645 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(clinicsBldg);*/
  
  var yawkeyBldg = new GPolygon([
  new GLatLng('42.362381','-71.069913 '),
new GLatLng('42.362365','-71.069661 '),
new GLatLng('42.362127','-71.069661 '),
new GLatLng('42.362048','-71.069291 '),
new GLatLng('42.361537','-71.069317 '),
new GLatLng('42.36158','-71.070047 '),
new GLatLng('42.362131','-71.069956 '),
new GLatLng('42.362381','-71.069913 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(yawkeyBldg);

   var foundersBldg = new GPolygon([
  new GLatLng('42.363138','-71.069891 '),
new GLatLng('42.363194','-71.070138 '),
new GLatLng('42.363641','-71.069897 '),
new GLatLng('42.36357','-71.069693 '),
new GLatLng('42.363138','-71.069891 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(foundersBldg);
  
  var ruthBldg = new GPolygon([
    new GLatLng('42.362119','-71.06751 '),
new GLatLng('42.361941','-71.067531 '),
new GLatLng('42.361941','-71.067107 '),
new GLatLng('42.362111','-71.067097 '),
new GLatLng('42.362119','-71.06751 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(ruthBldg);
  
  var westBldg = new GPolygon([
   new GLatLng('42.361808','-71.067292 '),
new GLatLng('42.361584','-71.067292 '),
new GLatLng('42.361582','-71.067064 '),
new GLatLng('42.361812','-71.067072 '),
new GLatLng('42.361808','-71.067292 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
 map.addOverlay(westBldg);

 var lawrenceBldg = new GPolygon([
   new GLatLng('42.361325','-71.068588 '),
new GLatLng('42.361495','-71.068596 '),
new GLatLng('42.361515','-71.068558 '),
new GLatLng('42.361517','-71.06851 '),
new GLatLng('42.361491','-71.068467 '),
new GLatLng('42.361325','-71.068462 '),
new GLatLng('42.361325','-71.068588 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(lawrenceBldg);


var residentBldg = new GPolygon([
   new GLatLng('42.361422','-71.068856 '),
new GLatLng('42.361432','-71.069001 '),
new GLatLng('42.36135','-71.069012 '),
new GLatLng('42.36134','-71.068864 '),
new GLatLng('42.361422','-71.068856 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(residentBldg);


var burrBldg = new GPolygon([
   new GLatLng('42.362084','-71.069323 '),
new GLatLng('42.36207','-71.069572 '),
new GLatLng('42.362333','-71.069594 '),
new GLatLng('42.36231','-71.069285 '),
new GLatLng('42.362084','-71.069323 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(burrBldg);
 
var twoBldg = new GPolygon([
   new GLatLng('42.361273','-71.068403 '),
new GLatLng('42.361426','-71.068406 '),
new GLatLng('42.361432','-71.067958 '),
new GLatLng('42.361281','-71.067947 '),
new GLatLng('42.361273','-71.068403 ')
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(twoBldg);

  var fruitPkg = new GPolygon([
   new GLatLng('42.362329','-71.069183 '),
new GLatLng('42.361537','-71.069301 '),
new GLatLng('42.361497','-71.068888 '),
new GLatLng('42.362321','-71.068792 '),
new GLatLng('42.362329','-71.069183 ')
  ], "#72605c", 2, 1, "#aad9e1", .7);
 map.addOverlay(fruitPkg);
 
 var parkmanPkg = new GPolygon([
   new GLatLng('42.362096','-71.068422 '),
new GLatLng('42.362088','-71.068025 '),
new GLatLng('42.361529','-71.06795 '),
new GLatLng('42.361517','-71.0684 '),
new GLatLng('42.362096','-71.068422 ')
  ], "#72605c", 2, 1, "#aad9e1", .7);
 map.addOverlay(parkmanPkg);

  var thirdCentury = new GPolygon([
    new GLatLng('42.36317','-71.069473'),
new GLatLng('42.362789','-71.069553'),
new GLatLng('42.362524','-71.069586'),
new GLatLng('42.362516','-71.068899'),
new GLatLng('42.362936','-71.068872'),
new GLatLng('42.362976','-71.069071'),
new GLatLng('42.362643','-71.069108'),
new GLatLng('42.362647','-71.069419'),
new GLatLng('42.363154','-71.069301'),
new GLatLng('42.36317','-71.069473'),
  ], "#72605c", 2, 1, "#75a1ac", .7);
  map.addOverlay(thirdCentury);
  
   var onesixfiveBldg = new GPolygon([
   new GLatLng('42.36164','-71.065181'),
new GLatLng('42.361418','-71.065192'),
new GLatLng('42.361453','-71.064838'),
new GLatLng('42.361588','-71.064822'),
 new GLatLng('42.36164','-71.065181'),
  ], "#72605c", 2, 1, "#75a1ac", .7);
 map.addOverlay(onesixfiveBldg);

 
  var twentyFiveBldg = new GPolygon([
   new GLatLng('42.362147','-71.062059'),
new GLatLng('42.362361','-71.061711'),
new GLatLng('42.362143','-71.061378'),
new GLatLng('42.361921','-71.061743'),
new GLatLng('42.362147','-71.062059'),
  ], "#72605c", 2, 1, "#75a1ac", .7);
 map.addOverlay(twentyFiveBldg);
 
  var fiftyBldg = new GPolygon([
   new GLatLng('42.362809','-71.064897'),
new GLatLng('42.362635','-71.064119'),
new GLatLng('42.362397','-71.064189'),
new GLatLng('42.362555','-71.06501'),
new GLatLng('42.362809','-71.064897'),
  ], "#72605c", 2, 1, "#75a1ac", .7);
 map.addOverlay(fiftyBldg);
 
  var meeiBldg = new GPolygon([
   new GLatLng('42.362706','-71.070492'),
new GLatLng('42.363122','-71.070267'),
new GLatLng('42.363007','-71.069773'),
new GLatLng('42.362591','-71.069983'),
new GLatLng('42.362706','-71.070492'),
  ], "#72605c", 2, 1, "#75a1ac", .7);
 map.addOverlay(meeiBldg);
 
  // create array of infoWindows, to be assigned to these polygons
  var iwArr = new Array();
  for (j in entries) {  	
	  var iwNode = createElem("info-window");
	  for(var i=2; i< entries[j].textArray.length; i++)
	  {
	     iwNode.appendChild(createElem("iw-cell-"+i, entries[j].textArray[i]));
	     
	  }
	  
	  //Add Directions here
	  iwNode.appendChild(createElem("iw-cell-directions", addDirections(entries[j])));
	  
	  iwArr[j] = iwNode;
   }
   
   
 /*
  * snippet below doesn't work-
  * need to clone the iwArr objects in order to get this code to work.
 
 var bldgArr = new Array(coxBldg, warrenBldg, ellisonBldg, jacksonBldg, greyBldg, blakeBldg, whiteBldg, vincentBldg, bulfinchBldg, edwardsBldg, theirBldg, bartlettBldg, wangBldg, clinicsBldg, yawkeyBldg, foundersBldg, ruthBldg, westBldg, lawrenceBldg, residentBldg, burrBldg, twoBldg, fruitPkg, parkmanPkg);
 
 for (var i = 0;i< iwArr.length;i++)
 {
 	var iwNode = iwArr[i];
 	GEvent.addListener(bldgArr[i], 'click', function(point) {map.openInfoWindowHtml(point, iwArr[i]) }); 
 }
 
 */
   
   
	// assigns the polygons to the info windows
	GEvent.addListener(coxBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[8]) }); 
	GEvent.addListener(warrenBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[23])}); 
	GEvent.addListener(ellisonBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[10])}); 
	GEvent.addListener(jacksonBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[15])}); 
	GEvent.addListener(greyBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[14])}); 
	GEvent.addListener(blakeBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[5])}); 
	GEvent.addListener(whiteBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[25])}); 
	//GEvent.addListener(vincentBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[7])}); 
	GEvent.addListener(bulfinchBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[7])}); 
	GEvent.addListener(edwardsBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[9])}); 
	GEvent.addListener(theirBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[21])}); 
	GEvent.addListener(bartlettBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[4])}); 
	GEvent.addListener(wangBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[22])}); 
	//GEvent.addListener(clinicsBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[13])}); 
	GEvent.addListener(yawkeyBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[26])}); 
	GEvent.addListener(foundersBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[11])}); 
	GEvent.addListener(ruthBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[20])}); 
	GEvent.addListener(westBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[24])}); 
	GEvent.addListener(lawrenceBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[16])}); 
	GEvent.addListener(residentBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[19])}); 
	GEvent.addListener(burrBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[12])}); 
	GEvent.addListener(twoBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[2])}); 
	GEvent.addListener(fruitPkg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[13])}); 
	GEvent.addListener(parkmanPkg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[18])}); 
	GEvent.addListener(thirdCentury, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[6])}); 
	GEvent.addListener(onesixfiveBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[0])}); 
	GEvent.addListener(twentyFiveBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[1])}); 
	GEvent.addListener(fiftyBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[3])}); 
	GEvent.addListener(meeiBldg, 'click', function(point) {map.openInfoWindowHtml(point, iwArr[17])}); 
 
  }
  

