var xStartHandle = 0; var xStartMouse = 0; var duration = 10; var count = 0; var showTextTimer = true; var showLoadingBar = true; var canSkipAd = true; var doneLoading = false; var textArray = new Array(); textArray['timerText'] = 'The game starts in %gameTimer% seconds...'; 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 startSizeDrag(someVar, ev){ var mousePos = mouseCoords(ev); xStartMouse = mousePos.x; xStartHandle = parseInt($('dragHandle').style.left || 0); document.onmousemove = handleMove; document.onmouseup = killHandleMove; $('gameIFrame').style.visibility = 'hidden'; $('showSize').style.border = '1px dashed #1a74a6'; if(document.all) { ev.cancelBubble = true; ev = false; } else { ev.preventDefault(); } } function handleMove(ev){ ev = ev || window.event; var mousePos = mouseCoords(ev); newX = Math.round((xStartHandle + mousePos.x - xStartMouse)); if(newX < -100) newX = -100; if(newX > 100) newX = 100; $('dragHandle').style.left = newX + 'px'; newX = Math.round(newX); newHeight = gameHeight * (100 + newX )/100; newWidth = gameWidth * (100 + newX )/100; (newWidth+10 > 740) ? contentWidth = newWidth+10 : contentWidth = 740; (newWidth+150 > 970) ? socialMargin = -Math.round((newWidth+150)/2 + 70 + 7) : socialMargin = -563; (newWidth+150 > 970) ? containerWidth = newWidth+150 : containerWidth = 970; (newWidth+30 > 760) ? bannerWidth = newWidth+30 : bannerWidth = 760; (newWidth+30 > 760) ? imagesWidth = newWidth+30 : imagesWidth = 760; $('content').style.width = contentWidth+'px'; $('container').style.width = containerWidth+'px'; $('topImages').style.width = imagesWidth+'px'; $('bottomImages').style.width = imagesWidth+'px'; if($('navigationSocial')){ $('navigationSocial').style.marginLeft = socialMargin+'px'; } if($('bannerRight')){ $('bannerRight').style.left = bannerWidth+'px'; } $('showSize').style.height = newHeight + 'px'; $('showSize').style.width = newWidth + 'px'; //navigationSocial return false; if(document.all) { ev.cancelBubble = true; ev = false; } else { ev.preventDefault(); } } function killHandleMove (){ $('gameIFrame').style.height = parseInt($('showSize').style.height) + 'px'; $('gameIFrame').style.width = parseInt($('showSize').style.width) + 'px'; $('gameIFrame').style.visibility = 'visible'; $('showSize').style.border = ''; document.onmousemove = null; document.onmouseup = null; } function launchPopupFixed(file, width, height) { mywindow = window.open (file, "mywindow", "top=0,left=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=0,resizable=0,width=" + width + ",height=" + height); } function advertisementCounter (){ if(!doneLoading){ count++; if(showTextTimer) $('advertisementTimerText').innerHTML = textArray['timerText'].replace('%gameTimer%', (duration - count)); if(showLoadingBar) $('loadingBar').style.width = (200 - Math.round(((duration - count) / duration ) * 200)) + 'px'; if(count > 2 && canSkipAd){ if($('skipAd')) $('skipAd').style.display = 'block'; } if(count - duration >= 0){ prerollDone(); }else{ if($('resizeHandler')) $('resizeHandler').style.display = 'none'; if($('actionsBlock')) $('actionsBlock').style.display = 'none'; if($('showSize')) $('showSize').style.visibility = 'hidden'; if($('showSize')) $('showSize').style.height = '0'; setTimeout("advertisementCounter()", 1000); } } } function prerollDone(){ doneLoading = true; duration = 0; if($('prerollAdvertisement')) $('prerollAdvertisement').style.display = 'none'; if($('resizeHandler')) $('resizeHandler').style.display = 'block'; if($('actionsBlock')) $('actionsBlock').style.display = 'block'; if($('showSize')) $('showSize').style.marginBottom = '3px'; if($('showSize')) $('showSize').style.visibility = 'visible'; if($('showSize')) $('showSize').style.height = gameHeight + 'px'; }