function buildCal(m, y, cM, cH, cDW, cD, brdr,maf2){
var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];
var dim=[31,0,31,30,31,30,31,31,30,31,30,31];

var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st
oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st

var todaydate=new Date() //DD added
var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
var hh = (y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added
dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;
var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';
t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';
for(s=0;s<7;s++)t+='<td class="'+cDW+'" style="color:black">'+"SMTWTFS".substr(s,1)+'</td>';
t+='</tr><tr align="center">';
for(i=1;i<=42;i++){
var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : '&nbsp;';
if (x==scanfortoday) //DD added
{
x='<span id="today">'+x+'</span>' ;//DD added
t+='<td class="'+cD+'">'+x+'</td>';
}
//else
//{
//if (x == maf2)
//{
//t+='<td class="'maf'">'+x+'</td>';
//}
//else
//{
//t+='<td class="'+cD+'">'+x+'</td>';
//}
//}
else
{

if (maf2== "1")
{
switch (x)
            {
            
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;
            }
}
else if (maf2== "2")
{

switch (x)
            {
           
                case 25:
t+='<td class="'+cD+'"><a title="The 15th annual course on the diseases of the nose and paranasal sinuses" href="news.htm#25022009">'+x+'</a></td>';


                    break;
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                                break;
            }
}
else if (maf2=="3")
{
switch (x)
            {
            
                case 2:
t+='<td class="'+cD+'"><a title="The 7th Saudi ORL Society & the 8th GCC ORL Society Conference" href="news.htm#02032009">'+x+'</a></td>';                 ;
                    break;
                case 9:
t+='<td class="'+cD+'"><a title="The 3rd Ain Shams Course on Applications of Laser in Laryngology" href="news.htm#09032009">'+x+'</a></td>';                 ;
                    break;
                case 11:
t+='<td class="'+cD+'"><a title="The Egyptian International Otolaryngology Congress 2009" href="news.htm#11032009">'+x+'</a></td>';                 ;
                    break;                   
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                                break;
            }
}
else if (maf2=="4")
{
switch (x)
            {
            
                case 15:
t+='<td class="'+cD+'"><a title="Rhinology World 2009" href="news.htm#15042009">'+x+'</a></td>';                 ;
                    break;                   
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="5")
{
switch (x)
            {
            
                case 13:
t+='<td class="'+cD+'"><a title="The 6th ARABFOS congress of otorhinolaryngology Head & Neck Surgery" href="news.htm#13052009">'+x+'</a></td>';                 ;
                    break;                   
    case 23:
t+='<td class="'+cD+'"><a title="Society Spring Meeting spring meeting for Egyptian Society of ear, nose, throat and allied sciences" href="news.htm#23052009">'+x+'</a></td>';                 ;
                    break;    
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="6")
{
switch (x)
            {
            
                case 1:
t+='<td class="'+cD+'"><a title="XIX IFOS World Congress" href="news.htm#01062009">'+x+'</a></td>';                 ;
                    break; 
                 case 27:
t+='<td class="'+cD+'"><a title="The 1st Meeting of the European Academy of ORL-HNS in Collaboration with EUFOS" href="news.htm#27062009">'+x+'</a></td>';                 ;
                    break; 
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="7")
{
switch (x)
            {
            
                 case 30:
t+='<td class="'+cD+'"><a title="The Summer congress of otolaryngology" href="news.htm#30072009">'+x+'</a></td>';                 ;
                    break; 
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="8")
{
switch (x)
            {
            
                 case 4:
t+='<td class="'+cD+'"><a title="The 27th Alexandria International Combined ORL Congress" href="news.htm#04082009">'+x+'</a></td>';                 ;
                    break; 
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="9")
{
switch (x)
            {
            
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;
            }
}
else if (maf2=="10")
{
switch (x)
            {
            
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="11")
{
switch (x)
            {
            
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}
else if (maf2=="12")
{
switch (x)
            {
            
              default:t+='<td class="'+cD+'">'+x+'</td>';
                                  break;              
            }
}

             // t+='<td class="'+cD+'">'+x+'</td>';

}
if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';
}
return t+='</tr></table></div>';

}

