';
}
var cDate = new Date();
var cDay = cDate.getDate();
var cMonth = cDate.getMonth();
var cYear = cDate.getFullYear();
var day = 0;
cDate.setFullYear(y, m, 1);
var days = this._getDaysPerMonth(y, m);
firstDay = cDate.getDay();
if (firstDay != 0) {
cells = firstDay - 1 + days;
} else {
cells = 6 + days;
}
if (cells > 35) {
cells = 42;
} else {
cells = 35;
}
if (firstDay == 0) {
firstDay = 7;
}
// days from last month
if (firstDay > 1) {
var lastDays = this._getDaysPerMonth(y, m-1);
}
startClass = 'odd';
html = html + '
';
var isPast = true;
var isToday = true;
var isFirstCell = true;
for (i = 0; i < cells; i++) {
var url = this.url;
if(isPast && this.preUrl){
url = this.preUrl;
}
html = html + '
= 0) {
if (day < days) {
day = i - firstDay + 2;
isToday = false;
if (day == cDay && cMonth == m && cYear == y) {
isPast = false;
isToday = true;
}
var dayUrl = y + '' + this._formatNumber(m+1) + '' + this._formatNumber(day);
if(this.dayInfo[dayUrl]){
html += ' title="' + this.dayInfo[dayUrl] + '"';
}
if ((i - firstDay + 2) == cDay && cMonth == m && cYear == y && (this.uDay == 0 || this.uDay == cDay && this.uMonth == cMonth && this.uYear == cYear)) {
html = html + ' class="c-day' + (isFirstCell ? ' first' : '') + '">';
} else {
if ((i - firstDay + 2) == cDay && cMonth == m && cYear == y && this.uDay > 0 && this.uDay != cDay) {
html = html + ' class="u-day' + (isFirstCell ? ' first' : '') + '">';
} else if (day == this.uDay && m == this.uMonth && y == this.uYear){
html = html + ' class="c-day' + (isFirstCell ? ' first' : '') + '">';
} else {
html = html + ' class="c-month' + (isFirstCell ? ' first' : '') + '">';
}
}
html = html + '';
if(this.dayInfo[dayUrl]){
html += '';
}
html += day;
if(this.dayInfo[dayUrl]){
html += '';
}
html += '';
} else {
html = html + ' class="o-month">';
++day;
var tmpM = m == 11 ? 1 : m + 2;
var tmpY = m == 11 ? y + 1 : y;
var tmpDay = day - days;
html = html + '' + tmpDay + '';
}
} else {
var tmpM = m == 0 ? 12 : m;
var tmpY = m == 0 ? y - 1 : y;
var tmpDay = (lastDays + (i - firstDay + 2));
html = html + ' class="o-month' + (isFirstCell ? ' first' : '') + '">';
html = html + '' + tmpDay + '';
}
html = html + '
';
isFirstCell = false;
if ((i + 1) % 7 == 0 && i != (cells - 1)) {
if (startClass == 'odd') {
startClass = 'even';
} else {
startClass = 'odd';
}
isFirstCell = true;
html = html + '
';
}
}
html = html + '
';
if (this.footerUrl && this.footerName) {
html = html + '
');
}
//("#dialog").dialog("destroy");
$("#dialog-modal").dialog({
modal: true,
header: false,
title:'Error',
width:500,
height:130
});
};
// menu filter functions
//-------------------------------
this.onMenuFilterMouseOver = function(){
ls.menuFilterMouseIsOver = true;
$(this).children('.menuHeaderSearch').show();
$(this).children('.menuHeaderText').hide();
};
this.onMenuFilterMouseOut = function(){
ls.menuFilterMouseIsOver = false;
if($('#menuFilterInput').hasClass('inactive')){
$('#menuHeader').children('.menuHeaderSearch').hide();
$('#menuHeader').children('.menuHeaderText').show();
}
};
this.onMenufilterFocusIn = function(){
if($('#menuFilterInput').hasClass('inactive')){
$('#menuFilterInput').val('');
$('#menuFilterInput').removeClass('inactive');
}
};
this.onMenufilterFocusOut = function(){
if($('#menuFilterInput').val() == ""){
$('#menuFilterInput').addClass('inactive');
$('#menuFilterInput').val('Type here to filter');
if(!ls.menuFilterMouseIsOver){
ls.onMenuFilterMouseOut();
}
}
};
this.onMenufilterKeyUp = function(e){
if (e.keyCode == 27) {
$('#menuFilterInput').val('');
ls.onMenufilterFocusOut();
$('#menuFilterInput').blur();
ls.cancelFilter();
return;
}
ls.menuFilterReg = new RegExp("" + $(this).val() + "", "i");
$('#sportMenuContainer').children('li').each(function(index) {
if($(this).text().match(ls.menuFilterReg)){
$(this).removeClass('forceFilterHidden');
}else{
$(this).addClass('forceFilterHidden');
}
$(this).find('li').each(function(index) {
if($(this).text().match(ls.menuFilterReg)){
$(this).removeClass('forceFilterHidden');
}else{
$(this).addClass('forceFilterHidden');
}
});
});
if($('#menuFilterInput').val() == ""){
ls.cancelFilter();
}else{
$('#sportMenuContainer').children('li').addClass('forceFilterExpanded');
$('#menuFilterInfo').show();
}
};
this.cancelFilter = function(){
$('#sportMenuContainer').children('li').removeClass('forceFilterExpanded');
$('#sportMenuContainer').find('li').removeClass('forceFilterHidden');
$('#menuFilterInfo').hide();
};
// togle main menu
//-------------------------------
this.togleMenu = function(){
if($('#mainMenuContent').is(':hidden')){
$('#mainMenuContent').show();
$('#menuHeader').removeClass('collapsed');
var date = new Date();
$.get('/ajax-set-cookie/MyBlock/LeftMenu/open/?' + date.getTime());
}else{
$('#mainMenuContent').hide();
$('#menuHeader').addClass('collapsed');
var date = new Date();
$.get('/ajax-set-cookie/MyBlock/LeftMenu/close/?' + date.getTime());
}
};
// togle stages menu
//-------------------------------
this.togleStageMenu = function(){
if($('#tournamentStages').find('ul').is(':hidden')){
$('#tournamentStages').find('ul').show();
$('#tournamentStages').removeClass('collapsed');
var date = new Date();
$.get('/ajax-set-cookie/MyBlock/StageMenu/open/?' + date.getTime());
}else{
$('#tournamentStages').find('ul').hide();
$('#tournamentStages').addClass('collapsed');
var date = new Date();
$.get('/ajax-set-cookie/MyBlock/StageMenu/close/?' + date.getTime());
}
};
// search functions
//-------------------------------
this.onSearchFocusIn = function(){
$('#search').addClass('focused')
$('#dummySearchHeight').show();
};
this.onSearchFocusOut = function(){
$('#search').removeClass('focused')
$('#dummySearchHeight').hide();
};
this.submitForm = function(point){
location.href = point.action + $('#searchBox').val();
};
// hash functions
//-------------------------------
this.changeHashUrl = function(hash){
document.location.href = '#' + hash;
};
this.applyHashUrl = function(){
};
// timezone functions
//-------------------------------
this.daysText = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
this.setTimeZonedetected = function(timeZoneId, defaultOffset){
if(tz.detectType == 2){
// user settings in GMT+X format are available, we have to narrow them down to full timezone
// -------------------------------
if(defaultOffset == tz.currentOffset){
// silently narrow the timezone setting
this.setTimeZone(timeZoneId, defaultOffset, false);
}else{
this.setTimeZoneEstimate(tz.currentOffset);
}
}else{
// forced timezone detection, user is new to the site
// -------------------------------
try{
if(undefined == page){
page = undefined;
}
}catch(e){
page = undefined;
}
if(defaultOffset == tz.currentOffset){
// silently narrow the timezone setting
this.setTimeZone(timeZoneId, defaultOffset, false);
}else if(page && page.timeZoneChange){
// change timezone without refresh
this.setTimeZone(timeZoneId, defaultOffset, true);
}else{
// not able to set timezone without refresh, display message
// set full timezone as estimate
var h1 = document.getElementsByTagName('H1')[0];
var infoMsg = $createElement('div',h1.parentNode,'message-info');
infoMsg.parentNode.insertBefore(infoMsg, h1.nextSibling);
var offset = defaultOffset;
if(offset > 0){
offset = '+' + offset;
}
infoMsg.innerHTML = '
We have noticed that you may be located in a different time zone. You may want to change the time zone here to GMT ' + offset + ' or click the time zone selector at the top right corner.