﻿function randomImage()
{
    var chosenImage = new Array();
    chosenImage[0] = "contentimage101.png";
    chosenImage[1] = "contentimage102.png";
    chosenImage[2] = "contentimage103.png";
        
    var getRan = Math.floor(Math.random()*chosenImage.length);
        
    document.getElementById('randomImage').setAttribute('src','images/' + chosenImage[getRan]);
}
    
function randomText()
{
    var chosenText = new Array();
    chosenText[0] = "&#8220;Shoot for the moon. Even if you miss, you'll land among the stars.&#8221;";
    chosenText[1] = "&#8220;Really great people make you feel that you, too, can become great.&#8221;";
    chosenText[2] = "&#8220;Success is not final, failure is not fatal: it is the courage to continue that counts.&#8221;";
        
    var getRan = Math.floor(Math.random()*chosenText.length);
        
    document.getElementById('quote').innerHTML = "<p>" + chosenText[getRan] + "</p>";
}
    
var index = 0;
    
function changingImage()
{
    var chosenImage = new Array();
    chosenImage[0] = "contentimage101.png";
    chosenImage[1] = "contentimage102.png";
    chosenImage[2] = "contentimage103.png";

    if(index > 2)
    {   
        index=0;
        document.getElementById('randomImage').setAttribute('src','images/' + chosenImage[index]);
        index++;
    }
    else
    {
        document.getElementById('randomImage').setAttribute('src','images/' + chosenImage[index]);
        index++;
    }
}

function changingImagePreLoad()
{
    var oldPhoto = document.getElementById('randomImage').src;
    var preLoadImage = ['images/contentimage101.png','images/contentimage102.png','images/contentimage103.png'];
    var newPhoto = new Image();

    if(index > 2)
    {   
        index=0;
        newPhoto.src = preLoadImage[index];
        document.getElementById('randomImage').src = newPhoto.src;
        index++;
    }
    else
    {
        newPhoto.src = preLoadImage[index];
        document.getElementById('randomImage').src = newPhoto.src;
        index++;
    }
}

function openingNewWindow(url)
{
    window.open(url);
}

var browserName=navigator.appName;
    
function onBackgroundMusic() 
{
    if (browserName=="Netscape")
    { 
        var thissound = document.getElementById('sound1');
        thissound.Play();
    }
    else 
    { 
        if (browserName=="Microsoft Internet Explorer")
        {
            document.getElementById('music').setAttribute('src','media/music.mp3');
        }
        else
        {
            //No Code
        }
    }
}

function offBackgroundMusic() 
{
    if (browserName=="Netscape")
    { 
        var thissound = document.getElementById('sound1');
        thissound.Stop();
    }
    else 
    { 
        if (browserName=="Microsoft Internet Explorer")
        {
            document.getElementById('music').setAttribute('src','media/nomusic.mp3');
        }
        else
        {
            //No Code
        }
    }
}
