var sysnameG = '';
function gamehall(sysname, isSilent, additionalParams)
{
	sysnameG = sysname;
	var flashvars = {
		settings: '/actions/flash/settings/' + sysname,
		silent: isSilent,
		mode: (top !== self ? 'frame' : 'common'),
		ver: CONFIG_GLOBAL.fileCache,
		cdn: CONFIG_GLOBAL.CDN
	};

	if(typeof additionalParams.mode != 'undefined') {
		flashvars.mode = additionalParams.mode;
	}

	if (typeof additionalParams.flashvars != 'undefined') {
		flashvars = $.extend({}, flashvars, additionalParams.flashvars);
		delete additionalParams.flashvars;
	}

	var params = {
		menu: 'false',
		scale: 'noScale',
		allowFullscreen: 'true',
		allowFullScreenInteractive: 'true',
		allowScriptAccess: 'always',
		bgcolor: '000000',
		wmode: 'window',
        allowFullScreenInteractive:"true"
	};

	for(var k in additionalParams) if(additionalParams.hasOwnProperty(k)) {
		params[k] = additionalParams[k];
	}

	var attributes = {
		id: 'slotmenu2'
	};
	swfobject.embedSWF(
		Pod.require('slotmenuUrl'),
		'ShowGame', document.documentElement.clientWidth, document.documentElement.clientHeight, defineMinFlashPlayerVersion(),
		CONFIG_GLOBAL.CDN + 'files/slots/swf/slotmenu/expressInstall.swf',
		flashvars, params, attributes
	);
	return swfobject;
}

function resizeSlot() {
	getMovie('slotmenu2').width = document.documentElement.clientWidth + 'px';
	getMovie('slotmenu2').height = document.documentElement.clientHeight + 'px';
}

function useOfAttributes(){
	var image = $("#image_back");
	image.css({'left': '50%'});
	var pos_image = image.offset();
	var h = $(window).height();
	image.css({'height': h + 'px'});
	var w = image.width();
	image.css({'left': pos_image.left - w/2});
}

function resizeImageBack() {
	if ($('#oy_box').length > 0){

		if ($('#image_back').length == 0) {
			$("#slotmenu2").css('height','1px');
			$('#oy_box').prepend('<img id="image_back" src="'+ CONFIG_GLOBAL.CDN+'files/default/img/popup/popup_fon/'+sysnameG+'.jpg" style="position: absolute; top: 0; left: 25%; height: 1px;"/>');
		}
		var image_back = $("#image_back");
		image_back.load(function() {
			useOfAttributes();
		});
		if(image_back[0].complete) {
			useOfAttributes();
		}
	}
}

$(window).on('focus', function () {
    $(this).trigger('resize');
});