
function zvSwitchid(zid,ztab){  
        zvHideallids();
        zvShowdiv(zid,ztab);
}

function zvHideallids(){
        //loop through the array and hide each element by id
        for (var i=0;i<zdivids.length;i++){
                zvHidediv(zdivids[i],ztabids[i]);
        }                 
}

function zvHidediv(zid,ztaboff) {
        //safe function to hide an element with a specified id
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(zid).style.display = 'none';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.zid.display = 'none';
                }
                else { // IE 4
                        document.all.zid.style.display = 'none';
                }
        }
        // switch tab image to off state
        document.getElementById(ztaboff).src = zimgpath+ztaboff+"_off.gif";
}

function zvShowdiv(zid,ztab) {
        //safe function to show an element with a specified id
                  
        if (document.getElementById) { // DOM3 = IE5, NS6
                document.getElementById(zid).style.display = 'block';
        }
        else {
                if (document.layers) { // Netscape 4
                        document.zid.display = 'block';
                }
                else { // IE 4
                        document.all.zid.style.display = 'block';
                }
        }
        // switch tab image to current selection
        document.getElementById(ztab).src = zimgpath+ztab+"_on.gif";
}

/* ----- widgetDayButtons --------------------------------------------------- */

function widgetDayButtons() {
    (function() {
        var cat = buttonCat();
        var partner = 'http://www.brantnews.com/index.cfm?page=home&section=eventsNew&eventDate';
        var searchUrl = partner + '={day}';
        var nDays = 7;
        var dayNames = [
            'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
        ];
        var monthNames = [
            '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'
        ];
        var todayClass = ' ZventsDayButtonToday';
        var today = new Date( (new Date).setHours( 0, 0, 0, 0 ) );
        for( var i = 1;  i <= nDays;  ++i ) {
            var year = today.getFullYear();
            var month = monthNames[ today.getMonth() ];
            var date = today.getDate();
            var day = today.getDay();
            var weekend = ( day == 0  ||  day == 6 );
            var weekendClass = weekend ? ' ZventsDayButtonWeekend' : '';
            var dayName = dayNames[ today.getDay() ];
            var search = searchUrl.replace( /{day}/, i == 1 ? month + '/' + date + '/' + year : i == 2 ? month + '/' + date + '/' + year : month + '/' + date + '/' + year );
            button( date, dayName.slice(0,3), search,
                dayName + ', ' + month + ' ' + date + ', ' + year );
            todayClass = '';
            today.setDate( date + 1 );
        }
    
        
        function button( date, day, url, title ) {
            document.write( [
                '<td>',
                    '<a href="', url, '" ',
                        'class="ZventsDayButton', todayClass, weekendClass, '" ',
                        'title="View events on Brantford.com" ',
                    '>',
                    '<span class="ZventsDayButtonDay">',
                        day,
                    '</span>',
                    '<span class="ZventsDayButtonDate">',
                        '&nbsp;', date, '&nbsp;',
                    '</span>',
                    '</a>',
                '</td>'
            ].join('') );
        }
    })();
}



