var serverPath = "http://www.shockwavegames.us/";var favoritesLeftPos = document.getElementById("mainTable").offsetLeft+(typeof(gameDivWidth) != "undefined" ? parseInt(gameDivWidth)+164 : 732); var favoritesTopPos = (typeof(gameDivWidth) != "undefined" ? 0 : 94); var domainPath = 'http://'+(window.location.toString().indexOf("www.") > -1 ? "www." : "")+serverPath.replace("www.","").replace("http://",""); var domainImagePath = domainPath+'slike/'; var bookmarkServerPath = domainPath; var gamePath = domainPath+'game/'; function Bookmark(id,mapImageId,title,path) { this.id = id; this.title = title; this.imageId = mapImageId; this.url = (this.title == "Bela" ? "http://www." + "play" + "bela.com/game/" : bookmarkServerPath+'game/') + (this.title.substring(0,1).toLowerCase() + "/" + this.title.toLowerCase() + "/"); this.isToBeDeleted = false; } function BookmarkMenuObject(bookmarks) { this.time = "1284046715"; this.path = (window.location.toString().indexOf("game/") > -1 ? "../../" : "game/"); this.bookmarks = null; this.favoritesLeftPos = favoritesLeftPos; this.favoritesTopPos = ( typeof(favoritesTopPos) != "undefined" ? favoritesTopPos : 0 ); this.menuId = "myFavoritesDiv"; this.mouseOutEventHdlr = ' onmouseout="if(animatedcollapse.checkMouseOut(arguments[0] || window.event,'+"'"+'bookmark'+"','"+this.menuId+"'"+')) { bookmarkMenuObj.submitDeleteQueue(); }" '; this.pageSize = 5; this.playedGameId = 0; this.playedGameImageMapId = ""; this.playedGameTitle = ""; this.playedGameFavorited = false; this.deleteQueue = null if( document.getElementById("FavoritesImgDiv") != null ) { this.playedGameId = playedGameId; this.playedGameImageMapId = playedGameImageMapId; this.playedGameTitle = playedGameTitle; } this.showBookmarksMenu = function() { animatedcollapse.show(this.menuId); bookmarkMenuObj.setTimedFocus(); } this.logout = function() { SetCookie("userId","",365,"/"); this.displayLogin(); } this.displayPage = function(page) { if( document.getElementById("loginInfoDiv") != null ) { document.getElementById("loginInfoDiv").innerHTML = 'You are logged in as '+this.userId+': ' + '' + '
Log out
'; } this.page = page; this.numPages = Math.ceil(this.bookmarks.length/this.pageSize); this.displayedBookmars = new Array(); this.bookmarkHTML = '
' + '
' + '
  Welcome '+this.userId+'!' + 'Log out
' + '
'; for( var i=(this.pageSize*(this.page-1)); i= (this.pageSize*(this.page)) ) { break; } else { this.bookmarkHTML += '
' + '
'; if(this.deleteQueue != null && this.deleteQueue.contains(this.bookmarks[i].id) ) { this.displayedBookmars.push(i); } } } this.pagingHTML = ""; if( this.numPages > 1 ) { this.pagingHTML += '
'; if( this.page == 1 ) { this.pagingHTML += "
1
"; } else { this.pagingHTML += ""; } this.pagingHTML += "
...
"; this.sPage = this.page - 2; if( this.sPage <= 1 ) { this.sPage = 2; } for( var i=this.sPage; i<=this.numPages; i++ ) { if( i == this.page ) { this.pagingHTML += "
" + i + "
"; } else if( i == this.sPage+3 ) { break; } else { this.pagingHTML += ""; } } if( this.numPages > 4 && this.page < this.numPages ) { this.pagingHTML += ""; } if( this.page < this.numPages ) { this.pagingHTML += ""; } this.pagingHTML += "
"; } if( this.bookmarks.length == 0 ) { this.bookmarkHTML += '
' + ' When you play a game, click on "Add to Favorites" to add it here.
' + '
'; } else { this.bookmarkHTML += this.pagingHTML + '
' + 'Click on a game to play it. Unclick a checkbox to remove a game.
' + ''; } document.getElementById(this.menuId).innerHTML = this.bookmarkHTML + ''; for( var i=0; i' + '
' + '
Your nickname:
' + '
' + '
Enter or create
your secret code:
' + '
' + '
Submit >>
' + '

' + ''; document.getElementById(this.menuId).innerHTML = this.loginHTML; if( document.getElementById("loginInfoDiv") != null ) { document.getElementById("loginInfoDiv").innerHTML = 'You are not logged in. Click here to login >>

Play games and earn experience points.'; } } this.setBookmarks = function(responseData) { bookmarkMenuObj.bookmarkedGamePlayed = false; if( responseData == "ResetLogin" ) { bookmarkMenuObj.displayLogin(); } else if( responseData.substring(0,6) == "Error:" ) { if( document.getElementById("bookmarkErrorDiv") != null ) { document.getElementById("bookmarkErrorDiv").innerHTML = '
'+responseData.substring(6)+'
'; if( responseData.indexOf("nickname") == -1 && document.getElementById("bookmarkLoginCodeInput") != null ) { document.getElementById("bookmarkLoginCodeInput").style.backgroundColor = "#390B2E"; document.getElementById("bookmarkLoginCodeInput").focus(); } } else { // internal error } } else { bookmarkMenuObj.bookmarks = new Array(); var cookieDeleteQueue = GetCookie("deleteQueue"); var storedDeleteQueue = ( cookieDeleteQueue != null && cookieDeleteQueue.length > 0 ? cookieDeleteQueue.split(",") : null); if( responseData.length > 0 && responseData != "Success" ) { var bookmark64 = decode64(responseData).split(","); for( var i=0; i
Add to 
Favorites"; } else { document.getElementById("FavoritesImgDiv").innerHTML = "
This game is saved in my favorites."; } } } this.login = function() { this.userId = document.getElementById("bookmarkLoginNameInput").value.toString().trim(); this.password = document.getElementById("bookmarkLoginCodeInput").value.toString().trim(); if( this.userId.length < 3 || this.password.length < 3 ) { if( this.userId.length < 3 ) { document.getElementById("bookmarkLoginNameInput").style.backgroundColor = "#390B2E"; document.getElementById("bookmarkLoginNameInput").focus(); } if( this.password.length < 3 ) { document.getElementById("bookmarkLoginCodeInput").style.backgroundColor = "#390B2E"; if( this.userId.length >= 3 ) { document.getElementById("bookmarkLoginCodeInput").focus(); } } } else { InitiateAjaxRequest(bookmarkServerPath+'bookmarkUpdate.php?action=login&userId='+encode64(this.userId)+"&password="+encode64(this.password),bookmarkMenuObj.setBookmarks,null,null); } } this.addToFavorites = function() { if( this.bookmarks == null ) { this.playedGameFavorited = true; animatedcollapse.show(this.menuId); this.setTimedFocus(); return; } var isFavoritedGame = false; var insertIx = 0; var fLetter = this.playedGameTitle.toUpperCase().charAt(0); for( var i=0; i
This game is saved in my favorites."; } this.repositionFavoritesMenu = function() { if( document.getElementById(this.menuId+"Menu") != null ) { document.getElementById(this.menuId+"Menu").style.left = document.getElementById("mainTable").offsetLeft+338; document.getElementById(this.menuId).style.left = document.getElementById("mainTable").offsetLeft+338; } } this.setTimedFocus = function() { setTimeout('if( document.getElementById("bookmarkLoginNameInput") != null ) { document.getElementById("bookmarkLoginNameInput").focus(); } ',1000); } this.checkDeleteQueue = function(id,ix) { if( this.deleteQueue == null ) { this.deleteQueue = new Array(); } var bChecked = document.getElementById("bookmarkCheckbox"+ix).checked; if( bChecked ) { document.getElementById("bookmarkA"+ix).style.textDecoration = "none"; document.getElementById("bookmarkA"+ix).style.color = "#4AF852"; for( var i=0; i
Add to
Favorites"; } } } var bookmarkTempArr = new Array(); for( var i=0; i' + '' + '' + '
' + '
Loading...
' + '
' ); animatedcollapse.addDiv(this.menuId, 'fade=1,height='+(((this.pageSize+2)*19))+'px'); animatedcollapse.init(); } var bookmarkMenuObj = new BookmarkMenuObject(); bookmarkMenuObj.userId = GetCookie("userId"); if( bookmarkMenuObj.userId != null && bookmarkMenuObj.userId.toString().length > 0 ) { InitiateAjaxRequest(bookmarkServerPath+'bookmarkUpdate.php?action=relogin&playedgameId='+bookmarkMenuObj.playedGameId+'&userId='+encode64(bookmarkMenuObj.userId),bookmarkMenuObj.setBookmarks,null,null); } else { bookmarkMenuObj.displayLogin(); if( document.getElementById("FavoritesImgDiv") != null ) { document.getElementById("FavoritesImgDiv").innerHTML = "
Add to
Favorites
"; } if( bookmarkMenuObj.playedGameId > 0 ) { InitiateAjaxRequest(bookmarkServerPath+'bookmarkUpdate.php?action=anonplay&playedgameId='+bookmarkMenuObj.playedGameId,null,null,null); } } window.onresize = bookmarkMenuObj.repositionFavoritesMenu;