﻿function initMenu() {
    // home
    $("#menu-index")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_01_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_01.png"); })
        .click(function() { self.location.href = 'index.html'; });
    // discography
    $("#menu-discography")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_07_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_07.png"); })
        .click(function() { self.location.href = 'discography.htm'; });
    // tour
    $("#menu-tour")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_02_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_02.png"); })
        .click(function() { self.location.href = 'tour.htm'; });
    // press
    $("#menu-press")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_08_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_08.png"); })
        .click(function() { self.location.href = 'press.htm'; });
    // photos
    $("#menu-photos")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_04_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_04.png"); })
        .click(function() { self.location.href = 'photos.htm'; });
    // bios
    $("#menu-bios")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_03_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_03.png"); })
        .click(function() { self.location.href = 'bios.htm'; });
    // video
    $("#menu-video")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_05_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_05.png"); })
        .click(function() { self.location.href = 'video.htm'; });
    // store
    $("#menu-store")
        .hover(function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_06_on.png"); }, function() { $(this).children().eq(0).attr("src", "images/menu/newmenu/menu_06.png"); })
        .click(function() { self.location.href = 'store.htm'; });
  

    $("#twitter").click(function() { self.location.href = 'http://twitter.com/smccurryband'; });
    $("#facebook").click(function() { self.location.href = 'http://www.facebook.com/scottmccurry'; });
    $("#myspace").click(function() { self.location.href = 'http://www.myspace.com/scottmccurry'; });
    $("#youtube").click(function() { self.location.href = 'http://www.youtube.com/watch?v=3uJseiB02kA'; });

    $("#contact-button").click(function() { location.href="mailto:" + $("#contact-select").val() });
    
}

var bg = new Array("bg1.jpg"); //, "bg2.jpg", "bg3.jpg", "bg4.jpg"
var bgIndex = 1;
var rndm = Math.floor(Math.random() * bg.length);

function randomizeBackground() {
    $("#top").css({ background: "url(../images/" + bg[rndm] + ")" })
    $("#top").fadeIn(400);
}
function fadeBackground() {
    $("#top")
    .fadeTo(400, .1, function() { $(this).css({ background: "url(../images/" + bg[bgIndex] + ")" })
    .fadeTo(400, 1);
    if (bgIndex < bg.length - 1) { bgIndex++ } else { bgIndex = 0 };
    });
}
