﻿jQuery(document).ready(function () {
    name1anim();
    name2anim();
    name3anim();
    name4anim();

    club1anim();
    club2anim();
    club3anim();
    club4anim();
});

function fadetime(val) {
    return Math.floor(Math.random() * val) + 1500;
}

function name1anim() {
    jQuery("#name1").animate({ opacity: 1.0 }, { duration: 150 })
                .animate({ opacity: 0 }, { duration: fadetime(4000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(500), complete: name1anim })
}
function name2anim() {
    jQuery("#name2").animate({ opacity: 1.0 }, { duration: 150 })
                .animate({ opacity: 0 }, { duration: fadetime(4000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(200), complete: name2anim })
}
function name3anim() {
    jQuery("#name3").animate({ opacity: 1.0 }, { duration: 150 })
                .animate({ opacity: 0 }, { duration: fadetime(4000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(500), complete: name3anim })
}
function name4anim() {
    jQuery("#name4").animate({ opacity: 1.0 }, { duration: 250 })
    jQuery("#name4").animate({ opacity: 0 }, { duration: fadetime(4500), complete: name4anim })
}
function club1anim() {
    jQuery("#club1").animate({ opacity: 1.0 }, { duration: 150 })
                .animate({ opacity: 0 }, { duration: fadetime(7000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(300), complete: club1anim })
}
function club2anim() {
    jQuery("#club2").animate({ opacity: 1.0 }, { duration: 100 })
                .animate({ opacity: 0 }, { duration: fadetime(6000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(150), complete: club2anim })
}
function club3anim() {
    jQuery("#club3").animate({ opacity: 1.0 }, { duration: 300 })
                .animate({ opacity: 0 }, { duration: fadetime(8000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(200), complete: club3anim })
}
function club4anim() {
    jQuery("#club4").animate({ opacity: 1.0 }, { duration: 300 })
                .animate({ opacity: 0 }, { duration: fadetime(9000) })
                .animate({ opacity: 1.0 }, { duration: fadetime(200), complete: club4anim })
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (version <= 8) && (document.body.filters)) {
        for (var i = 0; i < document.images.length; i++) {
            var img = document.images[i]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length - 3, imgName.length) == "PNG") {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                i = i - 1
            }
        }
    }
}
window.attachEvent("onload", correctPNG);

