var rayAppUserData = new Array(); function GetAppUserData(intAppId) { if (typeof rayAppUserData[intAppId] != 'undefined') return; var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { objAppUserData = JSON.parse(this.responseText); rayAppUserData[intAppId] = objAppUserData; } } xhttp.open('GET', TACustom_BaseUrlMain + '/games/AppUserDataAjax.php/?appid=' + intAppId, false); xhttp.send(); } function PopulateAppUserData(intAppId) { GetAppUserData(intAppId); objAppUserData = rayAppUserData[intAppId]; // watch var elemButtonWatch = document.getElementById("elemAppUserData_watch_" + intAppId); if (elemButtonWatch && objAppUserData.userid) { if (objAppUserData.appuserwatch) elemButtonWatch.style.backgroundColor = '#ffff00'; elemButtonWatch.style.display = 'block'; } // your rating var elemYourRating = document.getElementById("elemAppUserData_yourrating_" + intAppId); if (elemYourRating && objAppUserData.appuserrating) elemYourRating.innerHTML = objAppUserData.appuserratingstars; } function AppUserWatch(intAppId, boolWatch) { GetAppUserData(intAppId); objAppUserData = rayAppUserData[intAppId]; var strData = 'appid=' + intAppId + '&watch=' + boolWatch + '&token=' + objAppUserData.appusercsrftoken; var xhttp = new XMLHttpRequest(); xhttp.open ('POST', TACustom_BaseUrlMain + '/games/AppWatchAjax.php', true); xhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhttp.send (strData); var elemAppUserWatch = document.getElementById("elemAppUserData_watch_" + intAppId); var strColor = (boolWatch) ? '#ffff00' : null; elemAppUserWatch.style.backgroundColor = strColor; }