//----------------------------------------------------------
// Copyright - Gallaware, Inc. 2000+
// All rights reserved
// These JavaScript functions are copyrighted by Gallaware, Inc.
// They can not be used, copied, altered, edited, or included 
// with or within any software, or published or distributed without
// the expressed written consent of Gallaware, Inc.
//----------------------------------------------------------

// Image processing utilities
//
// Functions included:
//  opacity()
//  changeOpac()
// getOpactiy()

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++;
        }
    }
}

//change the opacity for different browsers
function changeOpacity(opacity, id) {
	var object = document.getElementById(id).style;

	if (typeof(object.opacity) != "undefined") {
		object.opacity = (opacity / 100);
	}

	if (typeof(object.MozOpacity) != "undefined") {
		object.MozOpacity = (opacity / 100);
	}

	if (typeof(object.KhtmlOpacity) != "undefined") {
		object.KhtmlOpacity = (opacity / 100);
	}

	if (typeof(object.filter) != "undefined") {
		object.filter = "alpha(opacity=" + opacity + ")";
	}
}


//change the opacity for different browsers
function getOpacity(id) {
	var object = document.getElementById(id).style;

	if (typeof(object.opacity) != "undefined") {
		return object.opacity;
	}

	if (typeof(object.MozOpacity) != "undefined") {
		return object.MozOpacity;
	}

	if (typeof(object.KhtmlOpacity) != "undefined") {
		return object.KhtmlOpacity;
	}

	if (typeof(object.filter) != "undefined") {
		return object.filter;
	}
}


