var deadlines = [];

function dsort(a,b)
{
    return a.month-b.month;
}

function init()
{
    x=document.getElementsByTagName('A');
    len=x.length;
    for(i=0;i<len;i++)
    {
        if(x[i].getAttribute('href')=='email.html')
        {
            x[i].setAttribute('href',"mailto:"+x[i].getAttribute('rel')+"@oberlin.edu");
        }
    }
    con=document.getElementById('deadlines');
    x=con.getElementsByTagName('LI');
    date=new Date();
    date=date.getMonth();
    while(x.length)
    {
        y=deadlines.length;
        deadlines[y] = { ele : x[0], month : x[0].getAttribute('month')-1};
        if(deadlines[y].month < date) deadlines[y].month+=12;
        con.removeChild(x[0]);
    }
    deadlines.sort(dsort);
    con.appendChild(deadlines[0].ele);
    con.appendChild(deadlines[1].ele);
}
addEventListener("DOMContentLoaded",init,false);
