var filename = "http://www.phoenixmusic.org/Songs/Live/TheLookOfLove.mp3";

if (navigator.appName == "Microsoft Internet Explorer")
{
//    document.writeln('<BGSOUND width=\"0\" height=\"0\" hidden=\"true\" id="BGSOUND" SRC="' + filename + '">');
}
else
if (navigator.appName == "Netscape")
{
//    document.writeln('<EMBED width=\"0\" height=\"0\" hidden=\"true\" id="BGSOUND" SRC="' + filename + '" AUTOSTART=TRUE WIDTH=144 HEIGHT=60><P>');
}

ShowMainSite();

function StopBackgroundMusic()
{
//    document.getElementById("BGSOUND").src = " ";
}
        
var currentMenuItem;
var currentContent;

function LogoHighlight(img)
{
    img.src = "http://www.phoenixmusic.org/Images/ClaireLogoRed.png";
    img.style = "\"cursor:pointer;width:400;height:600\" onmouseover=\"LogoHighlight(this)\" onmouseout=\"LogoLowlight(this)\" onclick=\"ShowMainSite()\"";
}

function LogoLowlight(img)
{
    img.src = "http://www.phoenixmusic.org/Images/ClaireLogoYellow.png";
}

var images = new Array();

images[0] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand2.jpg"
images[1] = "Photos/Live/FarncombeCavern/19-Jul-2010/Claire3.jpg"
images[2] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand4.jpg"
images[3] = "Photos/Live/Tomodo2010/Steve1.jpg"
images[4] = "Photos/Live/FarncombeCavern/19-Jul-2010/Claire4.jpg"
images[5] = "Photos/Live/Tomodo2010/TheBand1.jpg"
images[6] = "Photos/Live/FarncombeCavern/19-Jul-2010/Ian.jpg"
images[7] = "Photos/Live/TheBoilerroom/Claire1.jpg"
images[8] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand1.jpg"
images[9] = "Photos/Live/Tomodo2010/TheBand2.jpg"
images[10] = "Photos/Live/ClaireEnhanced.jpg"
images[11] = "Photos/Live/Tomodo2010/Steve2.jpg"
images[12] = "Photos/Live/TheBoilerroom/Claire2.jpg"
images[13] = "Photos/Live/BedBar/Shoes.jpg"
images[14] = "Photos/Live/Tomodo2010/Trio1.jpg"
images[15] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand5.jpg"
images[16] = "Photos/Live/FarncombeCavern/19-Jul-2010/Steve.jpg"
images[17] = "Photos/Live/Tomodo2010/TheBand3.jpg"
images[18] = "Photos/Live/TheBoilerroom/ClaireAndMatt.jpg"
images[19] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand3.jpg"
images[20] = "Photos/Live/Tomodo2010/Claire2.jpg"
images[21] = "Photos/Live/FarncombeCavern/19-Jul-2010/Tom.jpg"
images[22] = "Photos/Live/Tomodo2010/Steve3.jpg"
images[23] = "Photos/Live/FarncombeCavern/19-Jul-2010/TheBand6.jpg"

var firstImage = 0;
var lastImage = images.length - 1;
var image = firstImage;
var imageTimeoutId;

function ChangePicture(direction)
{
    var currentPicture = document.getElementById("GalleryPicture");

    if (currentPicture != null)
    {
        image += direction;

        if (image > lastImage)
        {
            image = 0;
        }

        if (image < firstImage)
        {
            image = lastImage;
        }
        
        currentPicture.src = images[image];
    }
} 

function MenuItemSelect(menuItem)
{
    if (currentMenuItem != null)
    {
        currentMenuItem.style.color = "#aaaa55";
    }

    if (menuItem != null)
    {
        menuItem.style.color = "#cc0000";

        currentMenuItem = menuItem;

        var contentName = menuItem.id.substring(8);
    }

    if (currentContent != null)
    {
        currentContent.style.visibility = "hidden";
    }

    currentContent = document.getElementById(contentName);

    if (currentContent != null)
    {
        currentContent.style.visibility = "visible";

        if (contentName == "Gallery")
        {
            MakeVisible("GalleryControl");
        }
        else
        {
            MakeInvisible("GalleryControl");
        }
    }
}

function MenuItemHighlight(menuItem)
{
    menuItem.style.color = "#cc0000";
}

function MenuItemLowlight(menuItem)
{
    if (menuItem != currentMenuItem)
    {
        menuItem.style.color = "#aaaa55";
    }
}

function MakeVisible(elementId)
{
    var element = document.getElementById(elementId);

    if (element != null)
    {
        element.style.visibility = "visible";
    }
}

function MakeInvisible(elementId)
{
    var element = document.getElementById(elementId);

    if (element != null)
    {
        element.style.visibility = "hidden";
    }
}

//E:\Music\Phoenix\WebSite\httpdocs\index.html

function ShowMainSite()
{
    //    document.getElementById("Entrance").style.visibility = "hidden";
//    document.getElementById("EntranceTitles").style.visibility = "hidden";
    MakeVisible("Picture");
    MakeVisible("Titles");
    MakeVisible("Menu");
    
//    document.getElementById("Titles").style.top = "1em";
//    document.getElementById("Titles").style.left = "1em";
//    
    currentMenuItem = document.getElementById("MenuItemHome");
    currentContent = document.getElementById("Home");

    MenuItemSelect(currentMenuItem);
}

var news = new Array();
news[0] = "First booking for 2013 in the diary - see <b>Events</b> for further info";
news[1] = "Godalming Bandstand now moved to 3rd June 2012 - see <b>Events</b> for further info";
news[2] = "Fernhurst Revels confirmed for 2012 and 2013 - see <b>Events</b> for further info";
news[3] = "iPhone app <b>Jazz O'Clock</b> available (featuring Claire's composition) - see <b>Shop</b> for further info";

var newsItem = "content of newsItem here";
var newsItemIndex = 0;
var delay = 50;
var currentChar = 1;
var destination = "[not defined]";

function type()
{
    if (document.getElementById)
    {
        var dest = document.getElementById(destination);
        if (dest)
        {
            dest.innerHTML = newsItem.substr(0, currentChar);
            currentChar++
            if (currentChar > newsItem.length) 
            {
                currentChar = 1;

                newsItemIndex++;

                if (newsItemIndex >= news.length)
                {
                    newsItemIndex = 0;
                }

                newsItem = news[newsItemIndex];

                setTimeout("type()", 5000);
            }
            else
            {
                setTimeout("type()", delay);
            }
        }
    }
}

function startTyping(newsItemParam, delayParam, destinationParam)
{
    newsItem = news[0];
    delay = delayParam;
    currentChar = 1;
    destination = destinationParam;
    type();
}

