var realUrl = '/templates/defaultNew/'
var documentRoot = "overviews/calendar-basketball/";
var vshow_all = false;
function updateSchedule() {
id = 0;
if (typeof teamNames != 'undefined' && id == 0) for (var i in teamNames) if (teamNames[i] == document.getElementById('tb').value) id = teamIds[i];
$.ajax({
url: '/templates/defaultNew/overviews/calendar/getTeam.php',
data: {'id': id, 'games_id': games_id},
success: function (ret) {
$('.spman').css("background-color", "");
$.each(ret, function (i, item) {
$('.spman_' + item).css("background-color", "yellow");
}
);
},
dataType: 'json'
});
}
function switch_day(sid) {
var parameters = new Array(
"supermatch=" + sid
);
if (sid == 'playoffs') {
$('.submitBtn2').removeClass('submitBtn2Hover');
} else {
vshow_all = false;
curday = sid;
$('.submitBtn2').removeClass('submitBtn2Hover');
$('#but_' + sid).addClass('submitBtn2Hover');
}
voegToeBuffer("getCalendar", "getCalendar.php", parameters);
}
function showPlayoffs() {
switch_day('playoffs');
}
function showPerConf() {
$('#persub').hide();
$('#perdiv').show();
}
function showPerDiv() {
$('#perdiv').hide();
$('#persub').show();
}
function getCalendar() {
if (xmlHttp.readyState != 4 && xmlHttp.readyState != "complete") return false;
$('#dynCont').html(xmlHttp.responseText);
if (!vshow_all)
$('#sall').show();
else
$('#sall').hide();
updateSchedule();
verwijderBuffer("getCalendar");
}
function show_all() {
vshow_all = true;
var parameters = new Array(
"supermatch=all"
);
$('.submitBtn2').removeClass('submitBtn2Hover');
voegToeBuffer("getCalendar", "getCalendar.php", parameters);
}
function nextDay() {
var toShow = [];
var first = 0;
//find first
for (var i = 0; i < sprms.length; i++) {
if (sprms[i]['id'] == firstDay) {
if (typeof sprms[i + 1] !== "undefined") {
firstDay = sprms[i + 1]['id'];
first = i + 1;
} else {
return false;
}
break;
}
}
//find all to show
for (var i = first; i < sprms.length && i < (first + 7); i++) {
toShow.push(getButt(sprms[i]));
}
//remove old
$('#butts .submitBtn2').remove();
//add new
for (var i = 0; i < toShow.length; i++) {
$('#butts').append(toShow[i]);
}
}
function getButt(ob) {
var cl = 'submitBtn2';
if (ob.id == curday)
var cl = 'submitBtn2 submitBtn2Hover';
var but = $('', {
'id': 'but_' + ob.id,
'class': cl,
'html': '' + ob.supermatch + ' ' + ob.matches + '',
'click': function () {
switch_day(ob.id);
return false;
}
});
return but;
}
function prevDay() {
var toShow = [];
var first = 0;
//find first
for (var i = 0; i < sprms.length; i++) {
if (sprms[i]['id'] == firstDay) {
if (typeof sprms[i - 1] !== "undefined") {
firstDay = sprms[i - 1]['id'];
first = i - 1;
} else {
return false;
}
break;
}
}
//find all to show
for (var i = first; i < sprms.length && i < (first + 7); i++) {
toShow.push(getButt(sprms[i]));
}
//remove old
$('#butts .submitBtn2').remove();
//add new
for (var i = 0; i < toShow.length; i++) {
$('#butts').append(toShow[i]);
}
}