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)/10)*10; if(newX < -100) newX = -100; if(newX > 100) newX = 100; $('dragHandle').style.left = newX + 'px'; newX = Math.round(newX/10)*10; newHeight = gameHeight * (100 + newX )/100; newWidth = gameWidth * (100 + newX )/100; (newWidth+30 > 758) ? contentWidth = newWidth+30 : contentWidth = 758; (newWidth+170 > 970) ? containerWidth = newWidth+170 : containerWidth = 970; (newWidth+50 > 778) ? bannerWidth = newWidth+50 : bannerWidth = 778; (newWidth+50 > 778) ? imagesWidth = newWidth+50 : imagesWidth = 778; $('content').style.width = contentWidth+'px'; $('slogan').style.width = contentWidth+'px'; $('container').style.width = containerWidth+'px'; $('topImages').style.width = imagesWidth+'px'; $('bottomImages').style.width = imagesWidth+'px'; if($('bannerRight')){ $('bannerRight').style.left = bannerWidth+'px'; } $('showSize').style.height = newHeight + 'px'; $('showSize').style.width = newWidth + 'px'; return false; if(document.all) { ev.cancelBubble = true; ev = false; } else { ev.preventDefault(); } } function zoom(direction){ if(direction == 'in'){ gameWidth = Math.round(gameWidth * 1.1); gameHeight = Math.round(gameHeight * 1.1); }else if(direction == 'out'){ gameWidth = Math.round(gameWidth / 1.1); gameHeight = Math.round(gameHeight / 1.1); } if(gameWidth > 750){ $('gameFrameDiv').style.width = gameWidth+'px'; $('container').style.width = gameWidth+12+'px'; $('content').style.width = gameWidth+12+'px'; $('menu').style.marginLeft = ((gameWidth-780)/2)+'px'; $('controller').style.left = gameWidth-((gameWidth - 440) /2)+'px'; }else{ $('gameFrameDiv').style.width = 768+'px'; $('container').style.width = 780+'px'; $('content').style.width = 780+'px'; $('menu').style.marginLeft = 0+'px'; $('controller').style.left = 630+'px'; } $('gameIFrame').style.height = gameHeight + 'px'; $('gameIFrame').style.width = gameWidth + 'px'; } 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'; }