function opacity(id, opacStart, opacEnd, millisec) {
    //speed per 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=i-2) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer = timer + 2;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i=i+2)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer = timer + 2;
        }
    }
}

//change the opacity for different browsers
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 + ")";
} 

//Fade Object
function fadeobj(id, tosolid) {
  var objclass = document.getElementById(id).className;
  if (objclass.charAt(0) != "v") {
    if (tosolid == 1) {
      opacity(id, 30, 100, 500);
    } else {
      opacity(id, 100, 30, 500);
    } 
  }
}

function resetbuttons() {
  document.getElementById("resetbutt").style.display='block';
  opacity("resetbutt",100,0,500);
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "lightbox")) {
      var idbase = anchor.id.substr(1,2);
      var cellname = document.getElementById("c" + idbase);
      if (cellname.className.charAt(0) == "v") {
        cellname.className = cellname.className.substr(1, cellname.className.length - 1)   ;
        fadeobj("c" + idbase, 0);
      }  
		}
	}
  setTimeout("document.getElementById('resetbutt').style.display='none';", 700);   
}






