var image1 = new Image();
var image2 = new Image();
var image3 = new Image();
var image4 = new Image();
var image5 = new Image();
//var image6 = new Image();

var imageLeft = new Image();
var imageLeftFifty = new Image();
var imageRight = new Image();
var imageRightFifty = new Image();

image1.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/headerImage1.jpg";
image2.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/headerImage2.jpg";
image3.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/headerImage3.jpg";
image4.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/headerImage4.jpg";
image5.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/headerImage5.jpg";
//image6.src = "http://girlswhorock.org/2011/wp-content/themes/gwr2011/images/headerImage6.png";

imageLeft.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/left.png";
imageLeftFifty.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/left_50.png";
imageRight.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/right.png";
imageRightFifty.src = "http://girlswhorock.org/wp-content/themes/gwr2011/images/right_50.png";

var splashSpeed = 8000; //Miliseconds
var splashInterval;
var splashImageCounter = 1;
var splashImageNumber = 5;

function splash(){
    splashSwitchImage();
    splashInterval = setInterval("splashSwitchImage()", splashSpeed);
}

function continueSplash(){
    stopSplash();
    splashInterval = setInterval("splashSwitchImage()", splashSpeed);
}

function stopSplash(){
    clearInterval(splashInterval);
}

function splashSwitchImage(){
    
    /*if(splashImageCounter == splashImageNumber){
        document.getElementById('movie').style.display = "block";
        document.getElementById('raster').style.display = "none";
        document.getElementById('splash').style.backgroundImage = "url('" + window['image'+splashImageCounter].src + "')";
        //document.getElementById('textOverlay').style.display = "none";
    }
    else{
        document.getElementById('movie').style.display = "none";
        document.getElementById('raster').style.display = "block";
        //document.getElementById('textOverlay').style.display = "block";
        
        document.getElementById('splash').style.backgroundImage = "url('" + window['image'+splashImageCounter].src + "')";
    }*/

    //document.getElementById('movie').style.display = "none";
    //document.getElementById('raster').style.display = "block";
    //document.getElementById('textOverlay').style.display = "block";
    
    if(document.getElementById('splash') != undefined){
        document.getElementById('splash').style.backgroundImage = "url('" + window['image'+splashImageCounter].src + "')";
    }

    splashImageCounter++;

    if(splashImageNumber < splashImageCounter){
        splashImageCounter = 1;
    }
}

function splashSwitchImageBack(){
    
    if(splashImageCounter == 2){
        splashImageCounter = splashImageNumber;
    }
    else if(splashImageCounter == 1){
        splashImageCounter = (splashImageNumber - 1);
    }
    else{
        splashImageCounter -= 2;
    }
    
    if(document.getElementById('splash') != undefined){
        document.getElementById('splash').style.backgroundImage = "url('" + window['image'+splashImageCounter].src + "')";
    }

    splashImageCounter++;

    if(splashImageNumber < splashImageCounter){
        splashImageCounter = 1;
    }
}
