// Set Up Events

window.onload = SetUp;

function SetUp() {
    HeadAnim();
   }


   function PlaySound(SoundToPlay) {
   	Sound.play(SoundToPlay, { replace: true });
   }

function HeadAnim() {
    DoFade('a1');
    setTimeout("DoFade('a2')", 200)
    setTimeout("DoFade('a2')", 4000)
    setTimeout("DoFade('a3')", 4200)
    setTimeout("DoFade('a3')", 8000)
    setTimeout("DoFade('a4')", 8200)
    setTimeout("DoFade('a4')", 12000)
    setTimeout("DoFade('a5')", 12200)
    setTimeout("DoFade('a5')", 16000)
    setTimeout("DoFade('a1')", 16200)
    setTimeout("HeadAnim()", 20000)
}

function ShowMenu() {
    var SubMenu = document.getElementById("SubMenu")
    var SubState = SubMenu.style.visibility
    if (SubState == "hidden") {
        SubMenu.style.visibility = "visible";
    }
    else {
        SubMenu.style.visibility = "hidden";
    }
}

function HideMenu() {
    SubMenu.style.visibility = "hidden";
}

function DoFade(fadeItem) {
    Effect.toggle(fadeItem, 'appear')
}

function DoSlide(fadeItem) {
    Effect.toggle(fadeItem, 'slide')
}


/* Chris modified this function */
/*
function OpenPlayer() {
    window.open('mplayer.aspx', 'player', 'width=310,height=300');
}
*/
function OpenPlayer() {
    window.open('music.html', 'player', 'width=310,height=300');
}

/* Chris modified this function */
/*function OpenVPlayer() {
    window.open('vplayer.aspx', 'player', 'width=500,height=500');
}
*/
function OpenVPlayer() {
    window.open('video.html', 'player', 'width=500,height=500');
}

function ShowGallImg(FileToLoad) {

    document.getElementById("GalleryImg").src = "./themes/gallery/" + FileToLoad;
    var Wrapper = document.getElementById("GallImgWrap");
    var CheckState = Wrapper.style.display;
    if (CheckState == "none") {
        //Wrapper.style.display = "inline";
        //new Effect.Opacity('GallImgWrap', { from: 0.0, to: 1.0, duration: 0.5 });
        setTimeout("DoFade('GallImgWrap')", 400);
    }
    //
    //DoFade('GalleryGridWrap');
}

function CloseGalleryImage() {

    setTimeout("DoFade('GallImgWrap')", 400);
}
//
function GallMOver(FileToLoad) {

    var GallMO = document.getElementById("GallMoImg");
    GallMO.src = "./themes/gallery/" + FileToLoad;
    GallMO.style.visibility = "visible";

}

function GalleryMouseOut() {

    var GallMO = document.getElementById("GallMoImg");
    GallMO.src = "";
    GallMO.style.visibility = "hidden";

}