function Opacity(idarray, singleId)
{
    this.opacity = 0;

    this.style =  singleId;

    this.timer = null;

    this.idArray = idarray;

    this.intNum = 0;

    this.timerFade = 10;
}


Opacity.prototype.HideDivs  = function(){
    for (i=0;i<this.idArray.length;i++){
        if (document.getElementById) {
            document.getElementById(this.idArray[i]).style.visibility = 'hidden';
        }
    }
}
Opacity.prototype.SetHideDivs  = function(arrayOfDivs){
    this.idArray = arrayOfDivs;
    this.HideDivs();
}
Opacity.prototype.ShowDivs  = function(){
    for (i=0;i<this.idArray.length;i++){
        if (document.getElementById) {
            document.getElementById(this.idArray[i]).style.visibility = 'visible';
        }
    }
}
Opacity.prototype.SetShowDivs  = function(arrayOfDivs){

    this.idArray = arrayOfDivs;

    this.ShowDivs();
}

/** Opacity Manager **/


Opacity.prototype.setOpacity = function(value)
{
    var myStyle =  document.getElementById(this.style);

    if(value == 0) {
        myStyle.style.visibility = 'hidden';
    } else {

        myStyle.style.visibility = 'visible';
    }

    myStyle.style.opacity = (value / 100);
    myStyle.style.MozOpacity = (value / 100);
    myStyle.style.KhtmlOpacity = (value / 100);
    myStyle.style.filter = "alpha(opacity=" + value + ")";
}

Opacity.prototype.Stop = function()
{
    clearInterval(this.timer);
    if(this.opacity > 0) {
        this.setOpacity(100);
    }
}

Opacity.prototype.FadeIn = function(timer)
{
    this.opacity = 0;

    if (! (timer== ''))
        this.timerFade = timer

    var _this = this;

    this.timer = window.setInterval(function() {
        _this.FadeInTimer();
    }, this.timerFade);

    this.opacity = 0;
}

Opacity.prototype.FadeInTimer = function()
{
    if(this.opacity < 100) {
        this.opacity = this.opacity + 1;
        this.setOpacity(this.opacity);
        return false;
    } else {
        clearInterval(this.timer);
        return true;
    }
}

Opacity.prototype.FadeOut = function(timer)
{
    this.opacity = 100;

    if(!( timer == ''))
        this.timerFade = timer



    var _this = this;

    this.timer = window.setInterval(function() {
        _this.FadeOutTimer();
    }, this.timerFade);

    this.opacity = 100;
}

Opacity.prototype.FadeOutTimer = function()
{

    if(this.opacity > 0) {
        this.opacity = this.opacity-1;
        this.setOpacity(this.opacity);
        return false;
    } else {
        clearInterval(this.timer);
        return true;
    }
}

Opacity.prototype.SetId = function(ID){

    this.style = ID;
}
////these are in a loops need work how to get it to stop
// array of divs, number of div to make invisible or single div
var opacity = new Opacity(new Array('logoDiv1','logoDiv2'),"");



function StartUp(){

    if(window.location.search =="?m=Home/Home" || window.location.search ==""){

       document.getElementById("fade").style.display = 'block';

        var opacity = new Opacity('',"");
        opacity.SetHideDivs(new Array('logoDiv1','logoDiv2'));

        var timer1 = setInterval(function() {
            // array of divs, number of div to make invisible or single div
            opacity.SetId('logoDiv1');opacity.FadeIn(30);
            clearTimeout(timer1);
        }, 2000);
        var timer2 = setInterval(function() {
            // array of divs, number of div to make invisible or single div
            opacity.SetId('logoDiv2');opacity.FadeIn(30);
            clearTimeout(timer2);
        }, 5000);

    } else {
        

    }
}
