// JavaScript Document
onerror=handleErr;

function handleErr(msg,url,l) {
	txt="There was an error on this page.\n\n";
	txt+="Error: " + msg + "\n";
	txt+="URL: " + url + "\n";
	txt+="Line: " + l + "\n\n";
	txt+="Click OK to continue.\n\n";
	alert(txt);
	return true;
}

var moving = new Array();
	
function displayObj(id){
	moving[id] = true;
	displayString = 'opacity("'+ id +'",0,80,250)';
	execString = setTimeout(displayString,250);
}

function halt(id){
	hideString = 'opacity("'+ id +'",80,0,250)';
	execString = setTimeout(hideString,250);
}

function stay(id){
	clearTimeout(execString)
	var object = document.getElementById(id).style;
	object.display == 'block';
}

function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if(opacStart > opacEnd) { //hide
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "'," + opacStart + "," + opacEnd + "," + timer + "," + speed + ")",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) { //show
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "'," + opacStart + "," + opacEnd + "," + timer + "," + speed + ")",(timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id, opacStart, opacEnd, timer, speed) {
    var object = document.getElementById(id).style;

	if(timer == "80"){
		cleanUp(opacStart, opacEnd, object,id);	
	}
	
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";

}
function cleanUp(opacStart, opacEnd, object, id){
	moving[id] = false;
	if(opacStart > opacEnd){
		object.display = 'none' ;
	}
	if(opacStart < opacEnd) {
		object.display = 'block';
	}
}
