// function out(pid){
// var ajaxRequest;
// try{
// ajaxRequest = new XMLHttpRequest();
// } catch (e){
// try{
// ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
// } catch (e) {
// try{
// ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
// } catch (e){
// alert("error");
// return false;
// }
// }
// }
// ajaxRequest.onreadystatechange = function(){
// if(ajaxRequest.readyState == 4){
// }
//
// }
//
// ajaxRequest.open("GET", "/ajax/rc/"+pid, true);
// ajaxRequest.send(null);
// }
//
//
//
// var Yoffset = 50;
// var Xvalue = 0;
// var adOffset = 0;
// var side = 'right';
// function mouseCoords(ev){
// ev = ev || window.event;
// if(ev.pageX || ev.pageY){
// return {x:ev.pageX, y:ev.pageY};
// }
// return {
// x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
// y:ev.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)
// };
// }
//
//
// function mouseY(evt) {
// if (!evt) evt = window.event;
// if (evt.pageY) return evt.pageY;
// else if (evt.clientY)return ev.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
// else return 0;
// }
// function overGame (ev, column, gameId){
// document.onmousemove = mouseMove;
// document.onscroll = mouseMove;
// switch(column){
//
// case '1':
// xPos = 193+adOffset;
// direction = 'right';
// break;
// case '2':
// xPos = 383+adOffset;
// direction = 'right';
// break;
// case '3':
// xPos = 573+adOffset;
// direction = 'right';
// break;
// case '4':
// xPos = 763+adOffset;
// direction = 'right';
// break;
// }
// Xvalue = xPos;
// if(direction == 'right'){
// document.getElementById("dek").style.left = xPos + 'px';
// }else{
// document.getElementById("dek").style.left = Xvalue - 121 + 'px';
// }
// side = direction;
// changeContent(gameId);
// document.getElementById("dek").style.display = 'block';
// }
// function changeContent (gameId){
// document.getElementById("dek").innerHTML = '';
// }
// function rollout (ev){
// ev = ev || window.event;
// var relTarg = ev.relatedTarget || ev.toElement;
// if(relTarg){
// if(relTarg.className != 'gr' && relTarg.className != 'gr_s'){
// document.getElementById("dek").style.display = 'none';
// document.getElementById("dek").style.left = 0 + 'px';
// document.onmousemove = null;
// }
// }else{
// document.getElementById("dek").style.display = 'none';
// document.getElementById("dek").style.left = 0 + 'px';
// document.onmousemove = null;
// }
// }
// function mouseMove (ev) {
// ev = ev || window.event;
// var mousePos = mouseCoords(ev);
// xMouse = mousePos.x;
// yMouse = mousePos.y;
// if(side == 'right'){
// document.getElementById("dek").style.left = Xvalue + 'px';
// document.getElementById("dek").style.padding = '4px 3px 3px 11px';
// document.getElementById("dek").style.backgroundImage = 'url(/i/roll-over_bg.gif)';
// }else{
// document.getElementById("dek").style.left = Xvalue - 121 + 'px';
// document.getElementById("dek").style.padding = '5px 18px 5px 5px';
// document.getElementById("dek").style.backgroundImage = 'url(/i/roll-over_bg.gif)';
// }
// document.getElementById("dek").style.top = yMouse + 5 - Yoffset + 'px';
// }
(function($) {
// Accordion
$.fn.accordion = function() {
var animating = false;
$(this).find('> .a-body').each(function(){
$(this).data('height', $(this).height());
});
$(this).find('> .a-h:not(.open)').addClass('closed')
.next().hide().css('height',0);
$(this).find('> .a-h').click(function(){
$('#views-today .list').getContent('popular/views/today');
if($(this).hasClass('closed') && animating == false){
animating = true;
var domCurrent = $(this);
var intCurrentHeight = domCurrent.next().data('height');
var domOpened = $(this).siblings('.open');
domOpened.addClass('closed').removeClass('open')
.next().animate({'height': 0}, function() {$(this).hide()});
domCurrent.removeClass('closed').addClass('open')
.next().show().animate({'height': intCurrentHeight}, function() {
animating = false;
});
}
});
}
})(jQuery);
/* Game list Carousel */
(function($) {
$.fn.gameListCarousel = function(method) {
var defaults = {
timeout: 2000,
klass: 'current',
child: '> li'
}
var settings = {}
var methods = {
init : function(options) {
settings = $.extend({}, defaults, options)
return this.each(function() {
var
$element = $(this),
element = this,
$next;
$element.mouseenter(function() {
clearTimeout($element.timer);
}).mouseleave(function() {
helpers.next($element);
});
helpers.next($element);
});
}
}
var helpers = {
next: function($element) {
$next = $element.find(settings.child + '.' + settings.klass).next();
if ($next.length == 0) {
$next = $element.find(settings.child + ':first-child');
}
$element.timer = setTimeout(function() { helpers.change($element, $next) }, settings.timeout);
},
change: function($element, $next) {
$next.siblings().removeClass(settings.klass);
$next.addClass(settings.klass);
helpers.next($element);
}
}
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error( 'Method "' + method + '" does not exist in gameListCarousel plugin!');
}
}
})(jQuery);
$(document).ready(function(){
$.scrolling = {status: false};
frontPageSliders();
tabTooltip();
rolOver();
//itemFocus();
itemClick();
$('#home-accordion').accordion();
var ftListCurrent = $('#ft-list').find('.current');
featuredRotator();
//$('.game-carousel-list').gameListCarousel();
// Ajaxed content for tabs sidebar
// $('#rating-today .list').getContent('popular/rating/today');
// $('#rating-alltime .list').getContent('popular/rating/alltime');
// $('#views-today .list').getContent('popular/views/today');
// $('#views-alltime .list').getContent('popular/views/alltime');
});
function featuredRotator() {
featuredtimer = setTimeout(function() { changeFeatured($('#ft-list .current').next().children(":first-child"), true) }, 2000);
//console.log($('#ft-list .current').next().first());
$('#ft-list li').children(":first-child").mouseenter(function() {
clearTimeout(featuredtimer);
changeFeatured($(this));
}).mouseleave(function() {
featuredtimer = setTimeout(function() { changeFeatured($('#ft-list .current').next().children(":first-child"), true) }, 2000);
});
$('#ft-games li').children(":first-child").mouseenter(function() {
clearTimeout(featuredtimer);
}).mouseleave(function() {
featuredtimer = setTimeout(function() { changeFeatured($('#ft-list .current').next().children(":first-child"), true) }, 2000);
});
}
function changeFeatured(item, rotate) {
//console.info(item);
if (item.length == 0) item = $('#ft-list li:first-child').children(":first-child");
var parentEl = item.parent('li');
var newClass = $(parentEl).siblings().removeAttr('class').end().addClass('current').attr('id');
$('#ft-bg').removeAttr('class').addClass(newClass);
$('#ft-games li').removeClass('current');
$('#ft-games').find('.' + newClass).addClass('current');
if(rotate == true) featuredtimer = setTimeout(function() { changeFeatured(item.parent('li').next().children(":first-child"), true) }, 2000);
}
function frontPageSliders() {
// Checking if there is enough elements in favorites
if (!$('#top-slider .sb-content ul:nth-child(2)').length) $('#top-slider .sb-control').addClass('less');
// Slider for FP games
$(".sb:not(.vertical) .sb-content").scrollable({ circular: true ,
onBeforeSeek: function() {
$.scrolling.status = true;
},
onSeek: function() {
$.scrolling.status = false;
}
});
// Vertical slider .vertical .sb-content .items
$(".vertical .sb-content").scrollable({ circular: true, vertical: true,
onBeforeSeek: function(event, i) {
$.scrolling.status = true;
var index = this.getIndex()+1;
if (i < 0) {
index = this.getItems().length -1 ;
}
if(!this.getItems().eq(index).hasClass('sloaded')) {
this.getItems().eq(index).addClass('loading');
}
},
onSeek: function(event, tabIndex) {
var root = this.getRoot();
var indx = 0;
tabIndex += 1;
if ($(root).parents('#games-preview').length > 0) {
$(root).find('li[class~="act"]').each(function() {
indx = $(this).index();
});
$('#games-preview ul:eq(' + tabIndex + ') li:eq(' + indx + ') a').click();
}
$.scrolling.status = false;
getSlide(this.getRoot(), tabIndex);
}
});
getSlide($(".vertical .sb-content"));
$("ul.tabs").tabs("div.panes > .tab-item"
, { onBeforeClick: function(event, i) {
var pane = this.getPanes().eq(i)
if (!pane.hasClass('ajaxed')) {
var container = pane.find('.list');
container.html('
');
container.load(this.getTabs().eq(i).attr("href"));
pane.addClass('ajaxed');
}
}
});
// Disabling default click for slider controls & hide item-focus
$('.next, .prev').click(function(){
$('#item-focus').css({'display': 'none'});
return false;
});
}
function getSlide(slider, slnum) {
// // Function creates dom temp element, requests new sontent from php file and addis it to temp slides.
// // Afterward it's cloned and added to scroller
//
//
// // Noslides means that last time it checked for slides there wasn't any so it won't bother again.
// // if (jQuery.data(slider.find('ul').eq(api.getIndex()+1)[0], "noslides") == true) return false;
//
// // Creating temp container for slides
// if($('#temp-slide').length) $('#temp-slide').empty();
// else $('body').append('