   var ind = 0;
   var count = 2;

     function load()
     {
       document.getElementById("casestudies_0").style.display = "block";
       changeOpac(100,"casestudies_0");
       document.getElementById("casestudies_1").style.display = "none";
       changeOpac(0,"casestudies_1");
       document.getElementById("casestudies_2").style.display = "none";
       changeOpac(0,"casestudies_2");
       setInterval('sawp()',6000);
     }
     function sawp() 
     {
       opacity('casestudies_'+ind, 100, 0, 500);
       setTimeout('step_2()', 500);
     }
      function step_2()
      {
         document.getElementById('casestudies_'+ind).style.display = "none";
         if(ind<count)
            ind++;
         else
            ind=0;
         document.getElementById('casestudies_'+ind).style.display = "block";
         opacity('casestudies_'+ind, 0, 100, 500);
      }
   function opacity(id, opacStart, opacEnd, millisec) { 
       //speed for each frame 
       var speed = Math.round(millisec / 100); 
       var timer = 0; 

       //determine the direction for the blending, if start and end are the same nothing happens 
       if(opacStart > opacEnd) { 
           for(i = opacStart; i >= opacEnd; i--) { 
               setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
               timer++; 
           } 
       } else if(opacStart < opacEnd) { 
           for(i = opacStart; i <= opacEnd; i++) 
               { 
               setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
               timer++; 
           } 
       } 
   }
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
