function renderHomepageSidebar() {
  //order, whether displayed, to be determined here.
  document.write('<td id="sideBar" rowspan="2">');
  renderFeaturedInvestments();
  renderSponsors();
  renderFeaturedBio();
  renderThreeUpcomingEvents();
  document.write('</td>');
}

function openModule(name) {
  //depending on value of ltr or rtl the border will change
  document.write('<table cellspacing="0" class="sb_module" id="sb_portfolio">');
  document.write('<tr><td class="sB_title" style="border-right-width: 0px;">' + name + '</td></tr>');
  document.write('<tr><td class="sB_frame" style="border-right-width: 0px;">');
}

function closeModule() {
  document.write('</td></tr></table>');
}

function renderFeaturedInvestments() {
  var rFI_ModName = "RECENT INVESTMENTS";
  var rFI_Url;
  var rFI_Blurb;
  var rFI_Category;
  var rFI_Selector;
  rFI_Selector = Math.round(Math.random()*1000)%13;
  
  switch(rFI_Selector) {
    case 0:
      rFI_Url = "http://www.nogravity.com";
      rFI_Img = "nogravity.jpg";
      rFI_Blurb = "<b>Zero Gravity Corporation</b> (ZERO-G&reg;) is a privately held space entertainment and tourism company headquartered";
      rFI_Category = "default";
      break
    case 1:
      rFI_Url = "http://www.bioscale.com";
      rFI_Img = "bioscale.jpg";
      rFI_Blurb = "<b>BioScale</b> provides instruments and consumable, multiplexed biochips for nano-scale detection of cells and proteins";
      rFI_Category = "life_sciences";
      break
    case 2:
      rFI_Url = "http://www.criticalmention.com";
      rFI_Img = "criticalmention.jpg";
      rFI_Blurb = "<b>Critical Mention</b> is a leading provider of real-time, web-based TV search and broadcast monitoring services that help";
      rFI_Category = "media";
      break
    case 3:
      rFI_Url = "http://www.signstorey.com";
      rFI_Img = "signstorey.jpg";
      rFI_Blurb = "<b>SignStorey</b> is a point-of-purchase media company that provides customized retailer networks in-store. It uses advanced";
      rFI_Category = "media";
      break
    case 4:
      rFI_Url = "http://www.contentdirections.com";
      rFI_Img = "linkpoint.jpg";
      rFI_Blurb = "<b>Linkstorm Corporation</b> provides technology for improving results with online advertising, marketing, measurement and other";
      rFI_Category = "internet_services";
      break
    case 5:
      rFI_Url = "http://www.ejamming.com";
      rFI_Img = "ejamming.jpg";
      rFI_Blurb = "eJamming is a patented communications technology that connects musicians online so they can write, record or jam together in real time";
      rFI_Category = "internet_services";
      break
    case 6:
      rFI_Url = "http://www.design2launch.com";
      rFI_Img = "design2launch.jpg";
      rFI_Blurb = "<b>Design2Launch</b> (D2L) is a pioneer and leader in digital workflow solutions for artwork and package management for the";
      rFI_Category = "software";
      break
    case 7:
      rFI_Url = "http://www.koolspan.com";
      rFI_Img = "koolspan.jpg";
      rFI_Blurb = "Based in Bethesda, Md., <b>KoolSpan</b> is the leading innovator of simple secure connectivity solutions that seamlessly unite mission-critical network devices";
      rFI_Category = "networking";
      break
    case 8:
      rFI_Url = "http://www.metaphorsolutions.com";
      rFI_Img = "metaphor.jpg";
      rFI_Blurb = "<b>Metaphor Solutions</b> provides speech recognition solutions to automate personal and customer service by phone.";
      rFI_Category = "networking";
      break
    case 9:
      rFI_Url = "http://www.billtrust.com";
      rFI_Img = "billtrust.jpg";
      rFI_Blurb = "<b>Billtrust</b> has developed a unique suite of outsourced billing solutions, called CompleteBilling. This comprehensive";
      rFI_Category = "financial_services";
      break
    case 10:
      rFI_Url = "http://www.ambientdevices.com";
      rFI_Img = "ambient.jpg";
      rFI_Blurb = "<b>Ambient Devices</b> provides a bit-trickling wireless applications platform that is proprietary and patent-pending.";
      rFI_Category = "networking";
      break
    case 11:
      rFI_Url = "http://www.emailanalyst.com";
      rFI_Img = "emailanalyst.jpg";
      rFI_Blurb = "<b>Email Data Source</b> is the only supplier of 3rd party Competitive Email Analytics.";
      rFI_Category = "business_services";
      break
    case 12:
      rFI_Url = "http://www.chromisfiber.com";
      rFI_Img = "chromisfiber.jpg";
      rFI_Blurb = "<b>Chromis'</b> next-generation plastic optical fiber (POF) systems greatly simplify high speed short-distance communication by combining...";
      rFI_Category = "networking";
      break
    default:
      rFI_Url = "";
      rFI_Img = "";
      rFI_Blurb = "";
      rFI_Category = "";
  }
  openModule(rFI_ModName);
  document.write('<a href="' + rFI_Url + '" target="new"><img src="img/portfolio/' + rFI_Img + '" style="padding-bottom:4px" /></a>');
  document.write('<div>'+ rFI_Blurb +'... </div>');
  document.write('<div class="nt_link"><a href="portfolio/default.html">VIEW OUR PORTFOLIO </a></div>');
  closeModule();
}

function renderSponsors() {//dinky, no functionality, need to do it
  openModule("SPONSORS");
  document.write('<div align="center"><a href="sponsors/pwc.html"><img alt="" src="img/sponsors/pwc.gif" /></a></div>');
  document.write('<div align="center" style="margin:10px auto;"><a href="sponsors/svb.html"><img alt="" src="img/sponsors/svb.gif" /></a></div>');  
  document.write('<div class="nt_link"><a href="sponsors/default.html">LEARN MORE ABOUT OUR SPONSORS </a></div>');   
  closeModule();
}

function renderFeaturedBio() {
  var rFB_ModName = "FEATURED MEMBER";
  var rFB_Name;
  var rFB_Blurb;
  var rFB_Selector;
  rFB_Selector = Math.round( Math.random() *1000 ) % 6;
  
  
  switch(rFB_Selector) {
    case 0:
      rFB_Name = "Howard Morgan";
      rFB_File = "howard_morgan";
      rFB_Blurb = "Howard Lee Morgan is Vice Chairman of idealab! the Pasadena, CA based creator and operator of internet companies, where was a founding investor";
    break
    
    case 1:
      rFB_Name = "David S. Rose";
      rFB_File = "david_rose";
      rFB_Blurb = "David S. Rose is an entrepreneurial executive and investor with extensive experience in high technology and communications, angel investments"
    break
    
    case 2:
      rFB_Name = "Philip J. Hartog";
      rFB_File = "philip_hartog";
      rFB_Blurb = "After several years in larger public companies Mr. Hartog founded RenderStar Technology BV, based in Amsterdam, in 1992. Three years later after";
    break
    
    case 3:
      rFB_Name = "Bill Michels";
      rFB_File = "bill_michels";
      rFB_Blurb = "In over 30 years as a management consultant and private investor, Mr. Michels has helped both early stage and established companies";
    break
    
    case 4:
      rFB_Name = "Thomas Blum";
      rFB_File = "thomas_blum";
      rFB_Blurb = "Thomas Blum has spent 22 years as an investment banker and an investor in private equity and venture capital opportunities";
    break

    case 5:
      rFB_Name = "Angelo Abdela";
      rFB_File = "angelo_abdela";
      rFB_Blurb = "Angelo S. Abdela is a seasoned and dynamic businessman with substantial experience in general management, finance, business development and acquisitions";
    break
    
    default :
      rFB_Name = "";
      rFB_File = "";
      rFB_Blurb = "";
  }
  openModule(rFB_ModName);
    document.write('<table><tr valign="top">');
    document.write('<td><img src="img/members/' + rFB_File + '_lg.jpg" height="60" width="60" align="left" style="padding-right:3px" />' + rFB_Blurb + '...</td>');
    document.write('</tr></table>');
    document.write('<div class="nt_link"><a href="members/' + rFB_File + '.html">VIEW FULL BIO </a></div>');
  closeModule();
}

function renderThreeUpcomingEvents() {

  // Get the current month, date, and year
    
  var d = new Date();
  var currentMonth = d.getMonth();
  var currentDate = d.getDate();
  var currentYear = d.getFullYear();

  // Start rendering the events list
  
  openModule('UPCOMING ' + monthNames[ currentMonth ].toUpperCase() + 
    ' EVENTS' );
  
    // Since we're only displaying the next three events for the current month,
    // let's keep track of how many events we've listed so far.  Also, we'll 
    // keep track of where we are in the event dates list
  
    var eventsRendered = 0;
    var eventDatesPos = 0;
    
    // Bring in the event data...
    
    getData_EventsPicker( currentMonth, currentYear );   
    
    // Start the table to hold the events list...
    
    document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%">');

    // And now, let's iterate through the data.  As long as we haven't rendered
    // three events and we haven't reached the end of the data...
    
    while ( ( eventsRendered < 3 ) && 
            ( eventDatesPos < ( eventDates.length ) ) ) {
        
        // If the date for the event hasn't happened yet, list the event, then
        // increment the number of events we've listed
                
        if ( eventDates[ eventDatesPos ] >=
        currentDate ) {
            var eventDateString = ( currentMonth + 1 ) + '-' + 
              eventDates[ eventDatesPos ] + '-' +  currentYear;
                
            document.write('<tr><td>' + eventDateString +
              '</td><td><a href="aboutus/calendar.html">' + 
              eventTitles[ eventDatesPos ] + '</a></td></tr>');

            eventsRendered++;
        }
        
        // After we've looked at an event and decided whether or not to list it,
        // mark the next event we're going to look at
        
        eventDatesPos++;
    }
    
    // If we didn't list any events, then tell people that there are no more
    // events this month
    
    if ( eventsRendered == 0 ) {
        document.write('<tr><td>No events scheduled for the rest of this month.<br/><br/></td></tr>');
    }
    
    // Close up the table and put a link to look at the calendar
    
    document.write('</table>');    
    document.write('<div class="nt_link"><a href="aboutus/calendar.html"><br/>VIEW ALL EVENTS </a></div>');
    
  closeModule();
}

function renderNotes() {
  notes = '<td id="notes">';
  notes += '<table cellspacing="0"><tr><td>';
  notes += '<div class="nt_title">For Entrepreneurs</div>';
  notes += '<div class="nt_text">If you are a company with a great idea, we want to hear from you. Read about our investment criteria, funding process, and then learn how to submit your business plan.</div>';
  notes += '<div class="nt_link"><a href="entrepreneurs/submit.html">SUBMIT YOUR BUSINESS PLAN</a></div>';
  notes += '</td>';
  notes += '<td>';
  notes += '<div class="nt_title">For Angel Investors</div>';
  notes += '<div class="nt_text">Membership in New York Angels is by invitation only, and is extended to individuals who share our vision and will actively contribute to our process. Find out more about becoming a member.</div>';
  notes += '<div class="nt_link"><a href="membership/default.html">LEARN MORE</a></div>';
  notes += '</td></tr></table>';
  notes += '</td>';
  document.write(notes);
}


