// main function to process the fade request //
function colorFade(id,element,start,end,steps,speed) {
  var startrgb,endrgb,er,eg,eb,step,rint,gint,bint,step;
  var target = document.getElementById(id);
  steps = steps || 20;
  speed = speed || 20;
  clearInterval(target.timer);
  endrgb = colorConv(end);
  er = endrgb[0];
  eg = endrgb[1];
  eb = endrgb[2];
  if(!target.r) {
    startrgb = colorConv(start);
    r = startrgb[0];
    g = startrgb[1];
    b = startrgb[2];
    target.r = r;
    target.g = g;
    target.b = b;
  }
  rint = Math.round(Math.abs(target.r-er)/steps);
  gint = Math.round(Math.abs(target.g-eg)/steps);
  bint = Math.round(Math.abs(target.b-eb)/steps);
  if(rint == 0) { rint = 1 }
  if(gint == 0) { gint = 1 }
  if(bint == 0) { bint = 1 }
  target.step = 1;
  target.timer = setInterval( function() { animateColor(id,element,steps,er,eg,eb,rint,gint,bint) }, speed);
}

// incrementally close the gap between the two colors //
function animateColor(id,element,steps,er,eg,eb,rint,gint,bint) {
  var target = document.getElementById(id);
  var color;
  if(target.step <= steps) {
    var r = target.r;
    var g = target.g;
    var b = target.b;
    if(r >= er) {
      r = r - rint;
    } else {
      r = parseInt(r) + parseInt(rint);
    }
    if(g >= eg) {
      g = g - gint;
    } else {
      g = parseInt(g) + parseInt(gint);
    }
    if(b >= eb) {
      b = b - bint;
    } else {
      b = parseInt(b) + parseInt(bint);
    }
    color = 'rgb(' + r + ',' + g + ',' + b + ')';
    if(element == 'background') {
      target.style.backgroundColor = color;
    } else if(element == 'border') {
      target.style.borderColor = color;
    } else {
      target.style.color = color;
    }
    target.r = r;
    target.g = g;
    target.b = b;
    target.step = target.step + 1;
  } else {
    clearInterval(target.timer);
    color = 'rgb(' + er + ',' + eg + ',' + eb + ')';
    if(element == 'background') {
      target.style.backgroundColor = color;
    } else if(element == 'border') {
      target.style.borderColor = color;
    } else {
      target.style.color = color;
    }
  }
}

// convert the color to rgb from hex //
function colorConv(color) {
  var rgb = [parseInt(color.substring(0,2),16), 
    parseInt(color.substring(2,4),16), 
    parseInt(color.substring(4,6),16)];
  return rgb;
}


<!-- -------------first ------------- -->
function hover_box01_1()
{
onmouseover=colorFade('box01_1','border','000000','216bb0',25,30) ;
onmouseover=colorFade('box01_1_bg','background','000000','131313',25,30);
onmouseover=colorFade('readmore01','color','7e7e7e','216bb0',25,30) ;
}

function hout_box01_1()
{
onmouseover=colorFade('box01_1','border','216bb0','000000',25,30);
onmouseover=colorFade('box01_1_bg','background','131313','000000',25,30);
onmouseout=colorFade('readmore01','color','216bb0','7e7e7e',25,30) ;
}

<!-- -------------second ------------- -->

function hover_box01_2()
{
onmouseover=colorFade('box01_2','border','000000','216bb0',25,30) ;
onmouseover=colorFade('box01_2_bg','background','000000','131313',25,30);
onmouseover=colorFade('readmore02','color','7e7e7e','216bb0',25,30) ;
}

function hout_box01_2()
{
onmouseover=colorFade('box01_2','border','216bb0','000000',25,30);
onmouseover=colorFade('box01_2_bg','background','131313','000000',25,30);
onmouseout=colorFade('readmore02','color','216bb0','7e7e7e',25,30) ;
}

<!-- -------------third ------------- -->

function hover_box01_3()
{
onmouseover=colorFade('box01_3','border','000000','216bb0',25,30) ;
onmouseover=colorFade('box01_3_bg','background','000000','131313',25,30);
onmouseover=colorFade('readmore03','color','7e7e7e','216bb0',25,30) ;
}

function hout_box01_3()
{
onmouseover=colorFade('box01_3','border','216bb0','000000',25,30);
onmouseover=colorFade('box01_3_bg','background','131313','000000',25,30);
onmouseout=colorFade('readmore03','color','216bb0','7e7e7e',25,30) ;
}


/*--------------------------------------------------*/
function hover_infoBox01()
{
	onmouseover=colorFade('infoBox01','border','000000','216bb0',25,30) ;
onmouseover=colorFade('01','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox01()
{
	onmouseover=colorFade('infoBox01','border','216bb0','000000',25,30);
onmouseout=colorFade('01','color','216bb0','7e7e7e',25,30) ;

}

/*--------------------------------------------------*/


function hover_infoBox02()
{
	onmouseover=colorFade('infoBox02','border','000000','216bb0',25,30);
onmouseover=colorFade('02','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox02()
{
	onmouseover=colorFade('infoBox02','border','216bb0','000000',25,30);
onmouseout=colorFade('02','color','216bb0','7e7e7e',25,30) ;
 
 
}

/*--------------------------------------------------*/

function hover_infoBox03()
{
	
	onmouseover=colorFade('infoBox03','border','000000','216bb0',25,30) ;
onmouseover=colorFade('03','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox03()
{
	onmouseover=colorFade('infoBox03','border','216bb0','000000',25,30);
onmouseout=colorFade('03','color','216bb0','7e7e7e',25,30) ;
 
 
}

/*--------------------------------------------------*/


function hover_infoBox04()
{
	onmouseover=colorFade('infoBox04','border','000000','216bb0',25,30) ;
onmouseover=colorFade('04','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox04()
{
	onmouseover=colorFade('infoBox04','border','216bb0','000000',25,30);
onmouseout=colorFade('04','color','216bb0','7e7e7e',25,30) ;
 
 
}

/*--------------------------------------------------*/


function hover_infoBox05()
{
	onmouseover=colorFade('infoBox05','border','000000','216bb0',25,30) ;
onmouseover=colorFade('05','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox05()
{
	onmouseover=colorFade('infoBox05','border','216bb0','000000',25,30);
onmouseout=colorFade('05','color','216bb0','7e7e7e',25,30) ;
 
 
}

/*--------------------------------------------------*/


function hover_infoBox06()
{
	onmouseover=colorFade('infoBox06','border','000000','216bb0',25,30) ;
onmouseover=colorFade('06','color','7e7e7e','216bb0',25,30) ;
 
 
}

function hout_infoBox06()
{
	onmouseover=colorFade('infoBox06','border','216bb0','000000',25,30);
onmouseout=colorFade('06','color','216bb0','7e7e7e',25,30) ;
 
 
}

/*--------------------------------------------------*/

