// Langwarrin Soccer Club JavaScript Document
// Do not touch what you do not know!


/*
son of suckerfish menu script from:
http://www.htmldog.com/articles/suckerfish/dropdowns/
*/
sfHover = function() {
    var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
            this.style.zIndex=200; //this line added to force flyout to be above relatively positioned stuff in IE
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


// stripe the tables
var stripe = function() {
        var tables = document.getElementsByTagName("table");    

        for(var x=0;x!=tables.length;x++){
            var table = tables[x];
            if (! table) { return; }
            
            var tbodies = table.getElementsByTagName("tbody");
            
            for (var h = 0; h < tbodies.length; h++) {
                var even = true;
                var trs = tbodies[h].getElementsByTagName("tr");
                
                for (var i = 0; i < trs.length; i++) {
                    //trs[i].onmouseover=function(){
                    //    this.className += " ruled"; return false
                    //}
                    //trs[i].onmouseout=function(){
                    //    this.className = this.className.replace("ruled", ""); return false
                    //}
                    
                    if(even)
                        trs[i].className += " even";
                    
                    even = !even;
                }
            }
        }

}


// launch a new window containing the league fixture from ResultsVault
function launchFixtures(url) {
    window.open(url,'fixturesWin','left=20,top=20,width=790,height=520,toolbar=1,resizable=1,scrollbars=1');
}
// launch a new window containing the league ladders from ResultsVault
function launchLadder(url) {
    window.open(url,'ladderWin','left=20,top=20,width=790,height=520,toolbar=1,resizable=1,scrollbars=1');
}
// launch a new window containing the league results from ResultsVault
function launchResults(url) {
    window.open(url,'resultsWin','left=20,top=20,width=780,height=520,toolbar=1,resizable=1,scrollbars=1');
}

// Google Maps popup
function map() {
    window.open("map.php","mapWin","resizable=1,scrollbars=1,width=680,height=540");
}

// junior team results popup script
function juniorPop() {
    // get selected index
    selIndex = document.juniors.team.selectedIndex;
    // get value of selected index
    url = document.juniors.team.options[selIndex].value;
    // open the new window with the url
    if (url != 'null') {
        window.open(url,'juniorsWin','left=20,top=20,width=780,height=520,toolbar=1,resizable=1,scrollbars=1');
    }
}

// toggle divs open/close same link
function toggle(obj) {
    var el = document.getElementById(obj);
    el.style.display = (el.style.display != 'none' ? 'none' : '' );
}

