// global arrays var fading_els = new Array(); // this is used to store whether an element is "busy" with a transition, or is free to be transitioned var myOpacity = new Array(); // this is used to store an elements current opacity // fading an element through an opacity range function opacity(id, opacStart, opacEnd, millisec) { //speed for each frame var speed = Math.round(millisec / 100); var timer = 0; document.getElementById(id).style.display = ''; //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++; } } } //change the opacity for different browsers function changeOpac(opacity, id) { try { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")"; myOpacity[id] = opacity; } catch(ex) { } } // fades in/out for an element. Can specify the time in ms. // Will check to see that whether or not the element is busy with a fade. function fade(el_id, inout, ms) { if (fading_els[el_id] !== 'busy') { var thisOpac = "" + myOpacity[el_id]; if (inout == 'in') { if (thisOpac == "0" || thisOpac == "" || thisOpac == "undefined") { opacity(el_id, 0, 100, ms); fading_els[el_id] = 'busy'; window.setTimeout("fade_freeup('" +el_id + "')", ms); } } else { if (thisOpac == "100" || thisOpac == "" || thisOpac == "undefined") { opacity(el_id, 100, 0, ms); fading_els[el_id] = 'busy'; window.setTimeout("fade_freeup('" +el_id + "')", ms); } } } } function fade_freeup(el_id) { fading_els[el_id] = ''; } // Global variables var timerlen = 2; var slideAniLen = 350; var timerID = new Array(); var startTime = new Array(); var obj = new Array(); var endHeight = new Array(); var moving = new Array(); var dir = new Array(); var inners = new Array(); var nextmove = new Array(); // this stores what the next move is. allows for chaining animations. // slide an element down function slidedown(objname){ if(moving[objname]) { nextmove[objname] = "down"; return; } if(document.getElementById(objname).style.display != "none") return; // cannot slide down something that is already visible moving[objname] = true; dir[objname] = "down"; fade(objname, 'in', 200); // fadeTo(objname, 100, 200); startslide(objname); } // slide an element up (hide it) function slideup(objname){ if(moving[objname]) { nextmove[objname] = "up"; return; } if(document.getElementById(objname).style.display == "none") return; // cannot slide up something that is already hidden moving[objname] = true; dir[objname] = "up"; fade(objname, 'out', 200); // fadeTo(objname, 0, 200); startslide(objname); } // toggle the slide - if it's up, slide it down; and visa versa. function toggleSlide(objname){ if(document.getElementById(objname).style.display == "none"){ // div is hidden, so let's slide down slidedown(objname); } else { // div is not hidden, so slide up slideup(objname); } } // start the slide operation - performs some setup work, and then start animating function startslide(objname){ obj[objname] = document.getElementById(objname); obj[objname].style.display = "block"; // so that we can grab the scrollHeight. else returns NaN if (document.getElementById(objname).style.width == '') { document.getElementById(objname).style.width = obj[objname].scrollWidth+'px'; } endHeight[objname] = parseInt(obj[objname].scrollHeight); startTime[objname] = (new Date()).getTime(); if (inners[objname] !== 'true') { var inn_wid = obj[objname].scrollWidth; inners[objname] = "true"; obj[objname].style.position = 'relative'; obj[objname].style.overflow = 'hidden'; var new_str = '