var cstart = 80;
var gstart = 20;
var gameid;
var gwidth;
var gheight;
function getFlashVersion(){
// ie
try {
try {
// avoid fp6 minor version lookup issues
// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try { axo.AllowScriptAccess = 'always'; }
catch(e) { return '6,0,0'; }
} catch(e) {}
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
// other browsers
} catch(e) {
try {
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
}
} catch(e) {}
}
return '0,0,0';
}
function getBrowserVersion(){
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName = navigator.appName;
var fullVersion = ''+parseFloat(navigator.appVersion);
var majorVersion = parseInt(navigator.appVersion,10);
var nameOffset,verOffset,ix;
// In Opera, the true version is after "Opera" or after "Version"
if ((verOffset=nAgt.indexOf("OPR"))!=-1) {
browserName = "Opera";
fullVersion = nAgt.substring(verOffset+6);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
// In Firefox, the true version is after "Firefox"
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
browserName = "Firefox";
fullVersion = nAgt.substring(verOffset+8);
}
// In Chrome, the true version is after "Chrome"
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
browserName = "Chrome";
fullVersion = nAgt.substring(verOffset+7);
}
// In MSIE < 11, the true version is after "MSIE" in userAgent
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
browserName = "Internet Explorer";
fullVersion = nAgt.substring(verOffset+5);
}
// IE >= 11
else if ((verOffset=nAgt.indexOf("rv:"))!=-1) {
browserName = "Internet Explorer";
fullVersion = nAgt.substring(verOffset+3,verOffset+5);
}
// In Safari, the true version is after "Safari" or after "Version"
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
browserName = "Safari";
fullVersion = nAgt.substring(verOffset+7);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
// In most other browsers, "name/version" is at the end of userAgent
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) {
browserName = nAgt.substring(nameOffset,verOffset);
fullVersion = nAgt.substring(verOffset+1);
if (browserName.toLowerCase()==browserName.toUpperCase()) {
browserName = navigator.appName;
}
}
// trim the fullVersion string at semicolon/space if present
if ((ix=fullVersion.indexOf(";"))!=-1)
fullVersion=fullVersion.substring(0,ix);
if ((ix=fullVersion.indexOf(" "))!=-1)
fullVersion=fullVersion.substring(0,ix);
majorVersion = parseInt(''+fullVersion,10);
if (isNaN(majorVersion)) {
fullVersion = ''+parseFloat(navigator.appVersion);
majorVersion = parseInt(navigator.appVersion,10);
}
return browserName+' '+fullVersion;
}
function GameList(page){
$("#main_list").html("
").load("ajax_game_list.php"+page);
}
function show_flash_preloader(src, height, width) {
document.write('');
}
function show_flash(src, height, width, param1, param2) {
$('#game').html('');
__gameObj = new GosFlashObject('gameid');
__gameObj.activeGame();
}
function show_shockwave(src, height, width) {
document.write('');
__gameObj = new GosFlashObject('gameid');
__gameObj.activeGame();
}
function LoadMoreCats(){
$.ajax({
type: "GET",
url: "../site/ajax_category_expand.php",
data: "start="+cstart,
success: function(msg){
$("#cat_list").append(msg);
}
});
cstart = cstart+80;
}
function LoadMoreLatest(){
$.ajax({
type: "GET",
url: "../site/ajax_latest_games.php",
data: "start="+gstart,
success: function(msg){
$("#latest_games").append(msg);
}
});
gstart = gstart+20;
}
function rank(action,site_id,game_id,tpl,lang_id) {
rndnum = Math.random()*10000000;
if (action=="yes"||action=="no") {
$.ajax({
type: "GET",
url: "../site/rank.php",
data: "game_id="+game_id+"&site_id="+site_id+"&action="+action+"&rnd="+rndnum+"&tpl="+tpl+"&lang_id="+lang_id,
success: function(msg){
$("#rnk").html(msg);
}
});
return true;
}
$.ajax({
type: "GET",
url: "../site/rank.php",
data: "game_id="+game_id+"&rnd="+rndnum+"&tpl="+tpl+"&site_id="+site_id+"&lang_id="+lang_id,
success: function(msg){
$("#rnk").html(msg);
}
});
return true;
}
function report(game_id){
$.ajax({
type: "GET",
url: "../site/report.php",
data: "game_id="+game_id,
success: function(msg){
$("#reporter").html(msg);
}
});
}
function preloader() {
if (!loaded) {
if(counter==0) {
$("#gmfr").hide();
if($("#preloader_bar").progressbar) $("#preloader_bar").progressbar({value: 0});
}
if (counter>=duration) {
preloader_end();
} else {
if($("#preloader_bar").progressbar) $("#preloader_bar").progressbar('value',(counter/duration)*100);
$("#preloader_text2").html("El juego empieza en "+(duration-counter)+" segundos ");
counter++;
}
if (counterskip>=skipduration-1) {
$("#preloader_text").html('');
$("#preloader_text a").click(function(){preloader_end();});
} else {
counterskip++;
}
setTimeout("preloader()",1000);
}
}
function preloader_end() {
$("#game").css("visibility",'visible');
$("#game").css("display","block");
$("#gmfr").css("visibility",'visible');
$("#gmfr").css("display","block");
$("#preloader_text2").css("display","none");
$("#preloader_bar").css("display","none");
$("#preloader_text").css("display","none");
$("#preloader").css("display","none");
$("#mx-bnt").show();
loaded=1;
showGame();
//loadJSlater();
}
var inShowGame = false;
function showGame(){
let browser = getBrowserVersion();
/*if (!hasFlash() && browser.indexOf('Firefox') > -1 && (gameCategoriesIds.indexOf(',101,') > -1 || gamefiletype == 1)) {
if($('#afg').length > 0) $('#afg').hide();
$('.game-no-flash').show();
$('#gmfr').hide();
$('#mx-bnt').show();
return;
}*/
//if(inShowGame) return;
var element = $('#gmfr');
var game_type = element.data('game_type');
inShowGame = true;
if(!game_type && gamedata) {
//console.log('Old method failed, reverting to new');
game_type = gamedata.game_type;
}
var param1 = '', param2 = '', html = '';
var html = '';
//console.log('In showgame 1 - game type=' + game_type);
if(game_type == '1'){
if(gamedata.block_external_links == 1){
param1 ='';
param2 = 'allowNetworking="internal"';
}
if(gamedata.allow_script_access != '0'){
param1 +='';
param2 +=' allowScriptAccess="'+gamedata.allow_script_access+'"';
}
html = '';
} else if(game_type == '2'){
if(gamedata.block_external_links == '1'){
param1 ='';
param2 = 'allowNetworking="internal"';
}
if(gamedata.allow_script_access != ''){
param1 +='';
param2 +=' allowScriptAccess="'+gamedata.allow_script_access+'"';
}
html = '';
} else if(game_type == '3' || game_type == '4' || game_type == '5' || game_type == '6'){
if(gamedata.custom_code) html = gamedata.custom_code.replace(/\\'/g, "");;
}
if(html != '') {
element.html(html);
element.show();
}
if(document.getElementById('afg')) document.getElementById('afg').style.display = 'none';
$('#mx-bnt').show();
}
function hasFlash() {
let hasFlash = false;
try {
let fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (fo) {
hasFlash = true;
}
} catch (e) {
if (navigator.mimeTypes
&& navigator.mimeTypes['application/x-shockwave-flash'] != undefined
&& navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
hasFlash = true;
}
}
return hasFlash;
}
// 17/6 new AFG
/*function removeAdSwf() {
alert(2);
document.getElementById("preloader").style.visibility = "hidden";
preloader_end()
}
function noAdsReturned() {
document.getElementById("preloader").style.visibility = "hidden";
preloader_end()
}*/
function fav(action,site_id,game_id) {
return true;
if (action=="yes"||action=="no") {
$.ajax({
type: "GET",
url: "../site/favorite.php",
data: "game_id="+game_id+"&site_id="+site_id+"&action="+action,
success: function(msg){
$("#favorite").html(msg);
members();
}
});
return true;
}
$.ajax({
type: "GET",
url: "../site/favorite.php",
data: "game_id="+game_id+"&site_id="+site_id,
success: function(msg){
$("#favorite").html(msg);
}
});
return true;
}
function members() {
return true;
$.ajax({
type: "GET",
url: "../site/members.php",
data: {tpl:'tpl4'},
success: function(msg){
$("#members").html(msg);
}
});
return true;
}
$(function(){
members();
});
/****************************************************************************/
/* flash object
* v1.2 */
/****************************************************************************/
GosFlashObject = function (_foid){
//private //////////////////////////////////////////////////
var S_NOTLOADED = 1;
var S_LOADING = 2;
var S_ACTIVE = 3;
var w=-1;
var h=-1;
var foid = _foid; //flash object id
var s = S_NOTLOADED; //status
//public //////////////////////////////////////////////////
this.fo = null; //the flash object
//functions //////////////////////////////////////////////
/**
* find flash object - cross browser
* look at http://blog.codefidelity.com/?p=14
* @param foid DOM id of flash object
* @return flash object. null if no object is found
*/
this.findObj = function(_foid){
if(_foid && typeof(_foid)=='string') foid=_foid;
else if(_foid){this.fo=_foid;return _foid;}
if (window.document[foid]) return window.document[foid];
if (navigator.appName.indexOf("Microsoft Internet")==-1)
if (document.embeds && document.embeds[foid]) return document.embeds[foid];
else return $(foid);
return null;
}
this.size = function(_w, _h){if(s==S_ACTIVE){if(_w>=0) w=_w; if(_h>=0) h=_h;} return this;}
this.resize = function(_w, _h){
if(s==S_ACTIVE){
this.size(_w, _h);
this.fo.width = w;
this.fo.height = h;
if (w < parseInt(document.getElementById('head').style.width)) divw = document.getElementById('head').style.width;
else divw = w+"px";
document.getElementById('gamewrapperid').style.height=_h+"px";
document.getElementById('gamewrapperid').style.width=divw;
document.getElementById('flash-wrapper').style.width=divw;
}
return this;
}
/* f: zoom factor. positive(1) to zoom in, negative (-1) to zoom out.
* factor size also changes the zoom factor */
this.zoom = function(_f){if(s==S_ACTIVE){zf = 1 + _f * 0.1; this.resize(w*zf, h*zf);}return this;}
this.reload = function(){
if(s==S_ACTIVE){
tfoid = this.fo.getAttribute("id");
var fop = this.fo.parentNode;
var temp=fop.innerHTML;
fop.innerHTML='';
fop.innerHTML=temp;
this.fo = this.findObj(tfoid);
}
}
//init
this.init = function(){
this.fo = this.findObj(foid);
if(this.fo){
w=this.fo.width;
h=this.fo.height;
}
}
this.init();
this.activeGame=function(){
s=S_ACTIVE;
}
}
function show_div(id){
if(document.getElementById(id).style.display=='none') document.getElementById(id).style.display='block';
else document.getElementById(id).style.display='none';
}
function getcookie(name) {
name= name+"="
cookiestring=document.cookie+";";
if (cookiestring.indexOf(name,0)==-1) {
return null;
} else {
start=cookiestring.indexOf(name,0)+name.length;
numchar=cookiestring.indexOf(";",start)-start;
return unescape(cookiestring.substr(start,numchar));
}
}
function newcookie(name) {
var date = new Date();
var nemesis_temp = date.getTime();
var nemesis = (parseInt(nemesis_temp) / 1000);
document.cookie = name+"="+escape(nemesis)+";path=/";
}
function isEmail(argvalue) {
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(argvalue)) return false;
else return true;
}
$(document).ready(function(){
$('.contact-submit').click(function(){
var name = $('[name="name"]').val();
var email = $('[name="email"]').val();
var subject = $('[name="subject"]').val();
var message = $('[name="message"]').val();
var captcha = $('[name="captcha"]').val();
var domain_name = $('[name="domain_name"]').val();
var flash_version = $('[name="flash_version"]').val();
var uagent = $('[name="uagent"]').val();
var referer = $('[name="referer"]').val();
if(name!='' && isEmail(email) && subject!='' && message!=''&&captcha!=''){
$.post( 'send_contact.php',
{ name:name, email:email,subject:subject,message:message,captcha:captcha,domain_name:domain_name,uagent:uagent,flash_version:flash_version,referer:referer },
function( data ) {
if(data === 'S') {
alert('Message sent!');
location.reload();
} else if(data === 'R') alert('The captcha is wrong!');
else alert('Message not sent!');
}
);
} else alert('All fields are required!');
return false;
});
});