









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 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 + ")";
}

function shiftOpacity(id) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.height == '0px') {
        opacity(id, 0, 100, 1000);
    } else {
        opacity(id, 100, 0, 1000);
    }
}

function shiftOpacity2(id) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.height == '0px' || document.getElementById(id).style.height == '0%') {
        document.getElementById(id).style.display = 'block'
        opacity(id, 0, 50, 1000);

    } else {
        opacity(id, 50, 0, 1000);
                window.setTimeout('hide_popup()',1100);

    }
}

function shiftOpacity3(id) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.height == '0px' || document.getElementById(id).style.height == '0%') {
        document.getElementById(id).style.display = 'block'
        opacity(id, 0, 100, 1000); }
 else {
        opacity(id, 100, 0, 1000);


    }
}

function currentOpac(id, opacEnd, millisec) {
    //standard opacity is 100
    var currentOpac = 100;

    //if the element has an opacity set, get it
    if(document.getElementById(id).style.opacity < 100) {
        currentOpac = document.getElementById(id).style.opacity * 100;
    }

    //call for the function that changes the opacity
    opacity(id, currentOpac, opacEnd, millisec)
}



function shiftOpacity3ie(id) {
    //if an element is invisible, make it visible, else make it ivisible

    if(document.getElementById(id).style.height == '0px' || document.getElementById(id).style.height == '0%') {
    document.getElementById(id).style.display = 'block'
    }

    else {
        window.setTimeout('hide_popupie()',1100);

    }


}

function hide_loader() {
document.getElementById("s5_loader").style.display = 'none';
}

function loader(id) {
    //if an element is invisible, make it visible, else make it ivisible
        opacity(id, 0, 95, 1);
}

function loaded(id) {
    //if an element is invisible, make it visible, else make it ivisible
        opacity(id, 95, 0, 1200);
                window.setTimeout('hide_loader()',1200);
}


function shiftOpacity2ie(id) {
    //if an element is invisible, make it visible, else make it ivisible
    if(document.getElementById(id).style.height == '0px' || document.getElementById(id).style.height == '0%') {


    document.getElementById(id).style.display = 'block'
    }

    else {
        window.setTimeout('hide_popupie()',1100);

    }
}






