function myLog(message){
if(window.console && 1){
console.log(message + "\n");
}
}
function processLoginKeyPress(event)
{
var key = (event)? event.which : window.event.keyCode;
if(key == 13){
document.getElementById('loginForm').submit();
}
}
function enterPressed(event)
{
var key = (event && event.which != null) ? event.which : window.event.keyCode;
if(key == 13){
return true;
}else{
return false;
}
}
function showSubMenu(menu) {
document.getElementById("subMenuCat" + menu).style.display="block";
}
function hideSubMenu(menu) {
document.getElementById("subMenuCat" + menu).style.display="none";
}
function openForum(url){
window.open(url, '_blank');
}
function displayDebugPopup(text)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '
';
popupLayer.innerHTML = output;
}
function hideDebugPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayShipRepairPopup(prem, currentHP, maxHP, action){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
hull = currentHP / maxHP;
if(prem){
ids = '_prem';
}else{
ids = '';
}
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideShipRepairPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayRepairShipConfirmPopup(confirmText, okAction){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideRepairShipConfirmPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayCancelQuestConfirmPopup(confirmText, okAction){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideCancelQuestConfirmPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayImprintPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '';
xajax_LgPlayer.getImprint();
popupLayer.innerHTML = output;
}
function hideImprintPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayTutorialPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '';
xajax_LgPlayer.getTutorials();
popupLayer.innerHTML = output;
}
function hideTutorialPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayNotifyPopup(text, action)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideNotifyPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayConfirmPopup(text, action)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideConfirmPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displayComingSoonPopup(text)
{
if(!text){
text = '';
}
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideComingSoonPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function is_int(input){
return typeof(input)=='number'&&parseInt(input)==input;
}
function isNumber(str) {
for(var position=0; position "9") )
return false;
};
return true;
};
function incr(targetID, amount, max)
{
var target = document.getElementById(targetID);
if(max && parseInt(target.value) + amount <= max)
{
target.value = parseInt(target.value) + amount;
}
if(!max){
target.value = parseInt(target.value) + amount;
}
}
function decr(targetID, amount, min)
{
if(!min) min=0;
var target = document.getElementById(targetID);
if(parseInt(target.value) - amount >= min)
{
target.value = parseInt(target.value) - amount;
}
}
function correctInt(targetID, min, max){
var target = document.getElementById(targetID);
var value = parseInt(target.value)
if(isNaN(value)){
target.value = min;
}else{
if(value > max){
target.value = max;
}
}
}
function number_format (number, decimals, dec_point, thousands_sep)
{
var exponent = "";
var numberstr = number.toString ();
var eindex = numberstr.indexOf ("e");
if (eindex > -1)
{
exponent = numberstr.substring (eindex);
number = parseFloat (numberstr.substring (0, eindex));
}
if (decimals != null)
{
var temp = Math.pow (10, decimals);
number = Math.round (number * temp) / temp;
}
var sign = number < 0 ? "-" : "";
var integer = (number > 0 ?
Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
var fractional = number.toString ().substring (integer.length + sign.length);
dec_point = dec_point != null ? dec_point : ".";
fractional = decimals != null && decimals > 0 || fractional.length > 1 ?
(dec_point + fractional.substring (1)) : "";
if (decimals != null && decimals > 0)
{
for (i = fractional.length - 1, z = decimals; i < z; ++i)
fractional += "0";
}
thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ?
thousands_sep : null;
if (thousands_sep != null && thousands_sep != "")
{
for (i = integer.length - 3; i > 0; i -= 3)
integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
}
return sign + integer + fractional + exponent;
}
/**
* BEGIN - buy confirmation popup
*/
function displayBuyConfirmPopup(amountEntryID, itemType, dItemID, confirmText)
{
var popupLayer = document.getElementById('popupLayer');
var amountEntry = document.getElementById(amountEntryID);
confirmText = confirmText.replace(/\[amount\]/, amountEntry.value);
var okAction = 'xajax_LgItem.buyItem(\''+itemType+'\', '+dItemID+', \''+ amountEntry.value +'\');';
popupLayer.style.visibility = 'visible';
var output = '';
output += '';
popupLayer.innerHTML = output;
popupLayer.style.zIndex = 100;
}
function hideBuyConfirmPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/**
* END - buy confirmation popup
*/
/**
* BEGIN - sell confirmation popup
*/
function displaySellConfirmPopup(amountEntryID, itemType, dItemID, listItems, confirmText)
{
var popupLayer = document.getElementById('popupLayer');
var amountEntry = document.getElementById(amountEntryID);
if(!amountEntry && isNumber(amountEntryID)){
var amount = amountEntryID;
}else{
var amount = amountEntry.value;
}
confirmText = confirmText.replace(/\[amount\]/, amount);
var okAction = 'xajax_LgItem.sellItem(\''+itemType+'\', '+dItemID+', \''+ amount +'\', \''+ listItems +'\');';
popupLayer.style.visibility = 'visible';
var output = '';
output += '';
popupLayer.innerHTML = output;
popupLayer.style.zIndex = 100;
}
function hideSellConfirmPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/**
* END - sell confirmation popup
*/
/**
* BEGIN - bid confirmation popup
*/
function displayBidConfirmPopup(amountEntryID, itemType, dItemID, confirmText, action)
{
var popupLayer = document.getElementById('popupLayer');
var amountEntry = document.getElementById(amountEntryID);
if(amountEntry.value.length && amountEntry.value.match(/^[0-9]*$/) && amountEntry.value > 0){
confirmText = confirmText.replace(/\[amount\]/, amountEntry.value);
var okAction = action+'(\''+itemType+'\', '+dItemID+', \''+ amountEntry.value +'\');';
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}else{
displayNotifyPopup('Please enter a valid bid.');
}
}
function hideBidConfirmPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/**
* END - bid confirmation popup
*/
/**
* BEGIN - item details popup
*/
function displayItemDetailsPopup(itemType, dItemID)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
xajax_LgItem.getItemDetails(itemType, dItemID);
}
function hideItemDetailsPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = 100;
}
/**
* END - item details popup
*/
/**
* BEGIN - bazar History popup
*/
function displayBazarHistoryPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
CSBfleXcroll('bazarHistoryScrollbox');
xajax_LgBazarItem.getBazarHistoryList();
}
function hideBazarHistoryPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = 100;
}
/**
* END - bazar History popup
*/
/**
* BEGIN - GameNews popup
* Author: Georg Steffers
*/
function displayGameNewsPopup ( cType, newsTag )
/* invars: (int) cType - 0 = display newslist
1 = display newsdetail
(string) newsTag - tag of the news to be shown
ignored when cType = 0 */
{
var popupLayer = document.getElementById('popupLayer');
// get content via xajax call that will use a smarty template
// to create the HTML: 0 is init whole popup
xajax_LgGameNews.getNewsHTML ( cType, newsTag, 0 );
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
}
function updateGameNewsPopup ( cType, newsTag )
/* invars: (int) cType - 0 = display newslist
1 = display newsdetail
(string) newsTag - tag of the news to be shown
ignored when cType = 0 */
{
// get content via xajax call that will use a smarty template
// to create the HTML: 1 is update content
xajax_LgGameNews.getNewsHTML ( cType, newsTag, 1 );
}
/**
* BEGIN - News popup
* Georg Steffers: Attention...this is not at all my code...seems to be a quick
*/
function displayNewsPopup(id,content)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
CSBfleXcroll('bazarHistoryScrollbox');
if (id && !content){
xajax_LgClan.getClanNewsById(id);
}
//xajax_LgBazarItem.getBazarHistoryList();
}
function hideNewsPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = 100;
}
/**
* END - News popup
*/
/****************************************/
function showClanNewsPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideClanNewsPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/******************************************/
/**
* BEGIN - no hitpoints popup
*/
function displayNoHitpointsPopup(text)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
CSBfleXcroll('bazarHistoryScrollbox');
//xajax_LgBazarItem.getBazarHistoryList();
}
function hideNoHitpointsPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = 100;
}
/**
* END - no hitpoints popup
*/
/**
* BEGIN - no hitpoints popup
*/
function displayUpdateUserDataPopup(notifyText, username, email)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideUpdateUserDataPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = 100;
}
/**
* END - no hitpoints popup
*/
function displayChooseFactionLayer(factionID)
{
var popupLayer = document.getElementById('chooseFactionLayer');
popupLayer.style.visibility = 'visible';
popupLayer.innerHTML = '';
popupLayer.style.zIndex = 120;
$('bannerContent').style.display='none';
xajax_LgPlayer.getChooseFactionLayer(factionID);
}
function displayFactionDetailsLayer()
{
var popupLayer = document.getElementById('chooseFactionLayer');
popupLayer.style.visibility = 'visible';
popupLayer.innerHTML = '';
popupLayer.style.zIndex = 120;
xajax_LgPlayer.getFactionDetailsLayer();
}
function hideChooseFactionLayer()
{
var popupLayer = document.getElementById('chooseFactionLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML = '';
popupLayer.style.zIndex = 120;
$('bannerContent').style.display='block';
}
function showChooseFactionBigImage(img){
$('chooseFactionBigImageContainer').setStyle({ opacity: 0 });
$('chooseFactionBigImageContainer').setStyle({ visibility: 'visible'});
$('chooseFactionBigImageContainer').setStyle({ 'z-index': '120'});
bgDiv = new Element('div');
bgDiv.id = 'chooseFactionBigImage_bg';
imgDiv = new Element('div');
imgDiv.id = 'img';
imgEl = new Element('img');
imgEl.setAttribute('src', img);
imgEl.onclick = closeChooseFactionBigImage;
imgDiv.appendChild(imgEl);
$('chooseFactionBigImageContainer').appendChild(bgDiv);
$('chooseFactionBigImageContainer').appendChild(imgDiv);
if(BrowserDetect.browser == 'Explorer' || BrowserDetect.browser == 'Chrome'){
$('chooseFactionBigImageContainer').setStyle({ opacity: 1 });
}else{
tween = new OpacityTween($('chooseFactionBigImageContainer'), Tween.regularEaseOut, 0, 100, 0.5, '');
tween.start();
}
}
function closeChooseFactionBigImage(){
startValue = $('chooseFactionBigImageContainer').getStyle('opacity') * 100;
$('chooseFactionBigImageContainer').setStyle({ 'z-index': '120'});
if(BrowserDetect.browser == 'Explorer' || BrowserDetect.browser == 'Chrome'){
$('chooseFactionBigImageContainer').style.visibility = 'hidden';
$('chooseFactionBigImageContainer').innerHTML = '';
}else{
tween = new OpacityTween($('chooseFactionBigImageContainer'), Tween.regularEaseOut, startValue, 0, 0.4, '');
tween.start();
tween.onMotionFinished = function(){
$('chooseFactionBigImageContainer').style.visibility = 'hidden';
$('chooseFactionBigImageContainer').innerHTML = '';
}
}
}
/**
* BEGIN - survey popup
*/
function displaySurveyPopup(confirmText){
var popupLayer = document.getElementById('popupLayer');
var okAction = "showSurvey()";
popupLayer.style.visibility = 'visible';
var output = '';
output += '';
popupLayer.innerHTML = output;
popupLayer.style.zIndex = 100;
}
function hideSurveyPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/**
* END - survey confirmation popup
*/
/**
* BEGIN - survey popup
*/
function displayCreateClanSquadConfirmPopup(name, confirmText){
var popupLayer = document.getElementById('popupLayer');
var okAction = "xajax_LgClan.createSquad(\'"+name+"\', true)";
popupLayer.style.visibility = 'visible';
var output = '';
output += '';
popupLayer.innerHTML = output;
popupLayer.style.zIndex = 100;
}
function hideCreateClanSquadConfirmPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
/**
* END - survey confirmation popup
*/
/**
* BEGIN - Game client popup
*/
var gameClientWindow = null;
var helpWindow = null;
function showGameClientPopup(){
if(window.gameClientWindow){
window.gameClientWindow.onunload = '';
}
window.gameClientWindow = window.open("index.php?action=internalGameClient&HDClient=0", "gameClientWindow", "width=1012,height=653,status=0,scrollbars=0,resizable=0");
xajax_LgPlayer.logStartClick();
}
function showGameClientPopupHD(){
if(window.gameClientWindow){
window.gameClientWindow.onunload = '';
}
window.gameClientWindow = window.open("index.php?action=internalGameClient&HDClient=1", "gameClientWindow", "width=1600,height=1200,status=no,scrollbars=no,resizable=no");
xajax_LgPlayer.logStartClick();
}
function destroyGameClientWindow(){
if(window.gameClientWindow){
window.gameClientWindow.close();
}
}
function showTutorialPopup(swfFile){
window.tutorialWindow = window.open("tutorialVideo.php?swfFile="+escape(swfFile), "tutorialWindow", "width=1015,height=700,status=no,scrollbars=no,resizable=no");
window.tutorialWindow.focus();
}
function resizePopup(w,h){
window.resizeTo(w,h);
}
/**
* END - Game client popup
*/
function showHelp(){
helpWindow = window.open("http://wiki.deepolis.com", "helpWindow", "width=1012,height=653,status=yes,scrollbars=yes,resizable=yes");
//helpWindow = window.open("http://wiki.test.deepolis.de", "helpWindow", "width=1012,height=653,status=yes,scrollbars=yes,resizable=yes");
helpWindow.focus();
}
function showShop(){
window.location = "index.php?action=internalShop&subAction=merchant";
window.focus();
}
function showSurvey(){
hideSurveyPopup();
surveyWindow = window.open("http://survey.bigpoint.com/index.php?sid=21", "surveyWindow", "width=650,height=720,status=yes,scrollbars=yes,resizable=yes");
surveyWindow.focus();
}
function showClanApplyPopup(uClanID, tag, name){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 100;
var output = '';
output += '';
popupLayer.innerHTML = output;
}
function hideClanApplyPopup()
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}
function displaySelectSquadPopup(text, action)
{
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'visible';
popupLayer.style.zIndex = 1112;
var output = '';
output += '';
popupLayer.innerHTML = output;
clanSquadSelect(document.uClanSquadID);
}
function hideSelectSquadPopup(){
var popupLayer = document.getElementById('popupLayer');
popupLayer.style.visibility = 'hidden';
popupLayer.innerHTML='';
popupLayer.style.zIndex = -100;
}